From 6184e5715b3699b338acc946c0176c6f4af29b0b Mon Sep 17 00:00:00 2001 From: Andreas Reder Date: Wed, 10 Apr 2013 07:32:45 +0200 Subject: [PATCH] corrected border-router resources, added run.sh and flash.sh --- examples/osd/native-border-router/border-router.c | 15 +++++++-------- examples/osd/native-border-router/run.sh | 5 +++++ examples/osd/slip-radio/flash.sh | 2 ++ examples/osd/slip-radio/run.sh | 6 ++++++ 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100755 examples/osd/native-border-router/run.sh create mode 100755 examples/osd/slip-radio/flash.sh create mode 100755 examples/osd/slip-radio/run.sh diff --git a/examples/osd/native-border-router/border-router.c b/examples/osd/native-border-router/border-router.c index 0284573b5..83fbe9ac7 100644 --- a/examples/osd/native-border-router/border-router.c +++ b/examples/osd/native-border-router/border-router.c @@ -337,7 +337,7 @@ PROCESS_THREAD(border_router_process, ev, data) * Resources are defined by the RESOURCE macro. * Signature: resource name, the RESTful methods it handles, and its URI path (omitting the leading slash). */ -RESOURCE(rpl, METHOD_GET, "rpl", "title=\"rpl routing\";rt=\"Text\""); +RESOURCE(rpl, METHOD_GET, "rpl", "title=\"rpl routing table\";rt=\"application/json\""); /* * A handler function named [resource name]_handler must be implemented for each RESOURCE. @@ -401,7 +401,7 @@ rpl_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_s } -RESOURCE(info, METHOD_GET, "info", "title=\"Info\";rt=\"text\""); +RESOURCE(info, METHOD_GET, "info", "title=\"Info\";rt=\"application/json\""); /* * A handler function named [resource name]_handler must be implemented for each RESOURCE. @@ -417,9 +417,8 @@ info_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_ int length = 0; /* |<-------->| */ /* Some data that has the length up to REST_MAX_CHUNK_SIZE. For more, see the chunk resource. */ - // jSON Format - index += sprintf(message + index,"{\n \"version\" : \"V0.1\",\n"); - index += sprintf(message + index," \"name\" : \"native coap router\"\n"); + index += sprintf(message + index,"{\n \"version\" : \"V0.2\",\n"); + index += sprintf(message + index," \"name\" : \"native coap border router\"\n"); index += sprintf(message + index,"}\n"); length = strlen(message); @@ -430,9 +429,9 @@ info_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_ } -RESOURCE(osd_net_conf, METHOD_GET | METHOD_POST, "osd-net-conf", "title=\"osd configs\""); +RESOURCE(network, METHOD_GET | METHOD_PUT, "network", "title=\"osd configs\"; rt=\"application/json\""); void -osd_net_conf_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) +network_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) { char message[100]; uint8_t buf[10]; @@ -499,7 +498,7 @@ PROCESS_THREAD(rest_server, ev, data) /* Activate the application-specific resources. */ rest_activate_resource(&resource_rpl); - rest_activate_resource(&resource_osd_net_conf); + rest_activate_resource(&resource_network); rest_activate_resource(&resource_info); while(1) { diff --git a/examples/osd/native-border-router/run.sh b/examples/osd/native-border-router/run.sh new file mode 100755 index 000000000..768ad2e82 --- /dev/null +++ b/examples/osd/native-border-router/run.sh @@ -0,0 +1,5 @@ +#!/bin/bash +make clean TARGET=native +make TARGET=native +mv border-router.native border-router + diff --git a/examples/osd/slip-radio/flash.sh b/examples/osd/slip-radio/flash.sh new file mode 100755 index 000000000..633f3f434 --- /dev/null +++ b/examples/osd/slip-radio/flash.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo avrdude -pm128rfa1 -c arduino -P/dev/ttyUSB0 -b57600 -e -U flash:w:slip-radio.osd-merkur.hex:a -U eeprom:w:slip-radio.osd-merkur.eep:a diff --git a/examples/osd/slip-radio/run.sh b/examples/osd/slip-radio/run.sh new file mode 100755 index 000000000..056794e5d --- /dev/null +++ b/examples/osd/slip-radio/run.sh @@ -0,0 +1,6 @@ +#!/bin/bash +make clean TARGET=osd-merkur +make TARGET=osd-merkur +avr-size slip-radio.osd-merkur +avr-objcopy -j .text -j .data -O ihex slip-radio.osd-merkur slip-radio.osd-merkur.hex +avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex slip-radio.osd-merkur slip-radio.osd-merkur.eep