corrected border-router resources, added run.sh and flash.sh

This commit is contained in:
Andreas Reder 2013-04-10 07:32:45 +02:00 committed by harald
parent d8d1550400
commit 6184e5715b
4 changed files with 20 additions and 8 deletions

View file

@ -337,7 +337,7 @@ PROCESS_THREAD(border_router_process, ev, data)
* Resources are defined by the RESOURCE macro. * Resources are defined by the RESOURCE macro.
* Signature: resource name, the RESTful methods it handles, and its URI path (omitting the leading slash). * 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. * 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. * 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; /* |<-------->| */ int length = 0; /* |<-------->| */
/* Some data that has the length up to REST_MAX_CHUNK_SIZE. For more, see the chunk resource. */ /* 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.2\",\n");
index += sprintf(message + index,"{\n \"version\" : \"V0.1\",\n"); index += sprintf(message + index," \"name\" : \"native coap border router\"\n");
index += sprintf(message + index," \"name\" : \"native coap router\"\n");
index += sprintf(message + index,"}\n"); index += sprintf(message + index,"}\n");
length = strlen(message); 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 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]; char message[100];
uint8_t buf[10]; uint8_t buf[10];
@ -499,7 +498,7 @@ PROCESS_THREAD(rest_server, ev, data)
/* Activate the application-specific resources. */ /* Activate the application-specific resources. */
rest_activate_resource(&resource_rpl); rest_activate_resource(&resource_rpl);
rest_activate_resource(&resource_osd_net_conf); rest_activate_resource(&resource_network);
rest_activate_resource(&resource_info); rest_activate_resource(&resource_info);
while(1) { while(1) {

View file

@ -0,0 +1,5 @@
#!/bin/bash
make clean TARGET=native
make TARGET=native
mv border-router.native border-router

View file

@ -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

6
examples/osd/slip-radio/run.sh Executable file
View file

@ -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