*** stock_iot-lab_M3/openwsn/07-App/rwellknown/rwellknown.c Thu Apr 24 11:01:37 2014 --- riot-openwsn-wip/openwsn/07-App/rwellknown/rwellknown.c Thu Apr 24 16:55:54 2014 *************** *** 4,10 **** #include "openqueue.h" #include "packetfunctions.h" #include "openserial.h" ! //=========================== variables ======================================= typedef struct { --- 4,10 ---- #include "openqueue.h" #include "packetfunctions.h" #include "openserial.h" ! #include "idmanager.h" //=========================== variables ======================================= typedef struct { *************** *** 19,33 **** //=========================== prototypes ====================================== ! error_t rwellknown_receive(OpenQueueEntry_t* msg, coap_header_iht* coap_header, coap_option_iht* coap_options); void rwellknown_sendDone(OpenQueueEntry_t* msg, ! error_t error); //=========================== public ========================================== ! void rwellknown_init() { // prepare the resource descriptor for the /.well-known/core path rwellknown_vars.desc.path0len = sizeof(rwellknown_path0)-1; rwellknown_vars.desc.path0val = (uint8_t*)(&rwellknown_path0); --- 19,37 ---- //=========================== prototypes ====================================== ! owerror_t rwellknown_receive(OpenQueueEntry_t* msg, coap_header_iht* coap_header, coap_option_iht* coap_options); void rwellknown_sendDone(OpenQueueEntry_t* msg, ! owerror_t error); //=========================== public ========================================== ! void rwellknown_init(void) { ! ! ! if(idmanager_getIsDAGroot()==TRUE) return; ! // prepare the resource descriptor for the /.well-known/core path rwellknown_vars.desc.path0len = sizeof(rwellknown_path0)-1; rwellknown_vars.desc.path0val = (uint8_t*)(&rwellknown_path0); *************** *** 42,51 **** //=========================== private ========================================= ! error_t rwellknown_receive(OpenQueueEntry_t* msg, coap_header_iht* coap_header, coap_option_iht* coap_options) { ! error_t outcome; if (coap_header->Code==COAP_CODE_REQ_GET) { // reset packet payload --- 46,55 ---- //=========================== private ========================================= ! owerror_t rwellknown_receive(OpenQueueEntry_t* msg, coap_header_iht* coap_header, coap_option_iht* coap_options) { ! owerror_t outcome; if (coap_header->Code==COAP_CODE_REQ_GET) { // reset packet payload *************** *** 57,69 **** // add return option packetfunctions_reserveHeaderSize(msg,2); ! msg->payload[0] = COAP_OPTION_CONTENTTYPE << 4 | 1; msg->payload[1] = COAP_MEDTYPE_APPLINKFORMAT; // set the CoAP header ! coap_header->OC = 1; ! coap_header->Code = COAP_CODE_RESP_CONTENT; outcome = E_SUCCESS; } else { --- 61,72 ---- // add return option packetfunctions_reserveHeaderSize(msg,2); ! msg->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 | 1; msg->payload[1] = COAP_MEDTYPE_APPLINKFORMAT; // set the CoAP header ! coap_header->Code = COAP_CODE_RESP_CONTENT; outcome = E_SUCCESS; } else { *************** *** 72,77 **** return outcome; } ! void rwellknown_sendDone(OpenQueueEntry_t* msg, error_t error) { openqueue_freePacketBuffer(msg); } \ No newline at end of file --- 75,80 ---- return outcome; } ! void rwellknown_sendDone(OpenQueueEntry_t* msg, owerror_t error) { openqueue_freePacketBuffer(msg); } \ No newline at end of file