mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
132 lines
4.2 KiB
Diff
132 lines
4.2 KiB
Diff
|
*** stock_iot-lab_M3/openwsn/07-App/rxl1/rxl1.c Thu Apr 24 11:01:37 2014
|
||
|
--- riot-openwsn-wip/openwsn/07-App/rxl1/rxl1.c Thu Apr 24 16:55:54 2014
|
||
|
***************
|
||
|
*** 27,38 ****
|
||
|
|
||
|
//=========================== prototypes ======================================
|
||
|
|
||
|
! error_t rxl1_receive(OpenQueueEntry_t* msg,
|
||
|
coap_header_iht* coap_header,
|
||
|
coap_option_iht* coap_options);
|
||
|
void rxl1_timer();
|
||
|
void rxl1_sendDone(OpenQueueEntry_t* msg,
|
||
|
! error_t error);
|
||
|
|
||
|
//=========================== public ==========================================
|
||
|
|
||
|
--- 27,38 ----
|
||
|
|
||
|
//=========================== prototypes ======================================
|
||
|
|
||
|
! owerror_t rxl1_receive(OpenQueueEntry_t* msg,
|
||
|
coap_header_iht* coap_header,
|
||
|
coap_option_iht* coap_options);
|
||
|
void rxl1_timer();
|
||
|
void rxl1_sendDone(OpenQueueEntry_t* msg,
|
||
|
! owerror_t error);
|
||
|
|
||
|
//=========================== public ==========================================
|
||
|
|
||
|
***************
|
||
|
*** 60,69 ****
|
||
|
|
||
|
//=========================== private =========================================
|
||
|
|
||
|
! error_t rxl1_receive(OpenQueueEntry_t* msg,
|
||
|
coap_header_iht* coap_header,
|
||
|
coap_option_iht* coap_options) {
|
||
|
! error_t outcome;
|
||
|
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
|
||
|
|
||
|
if (coap_header->Code==COAP_CODE_REQ_POST) {
|
||
|
--- 60,69 ----
|
||
|
|
||
|
//=========================== private =========================================
|
||
|
|
||
|
! owerror_t rxl1_receive(OpenQueueEntry_t* msg,
|
||
|
coap_header_iht* coap_header,
|
||
|
coap_option_iht* coap_options) {
|
||
|
! owerror_t outcome;
|
||
|
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
|
||
|
|
||
|
if (coap_header->Code==COAP_CODE_REQ_POST) {
|
||
|
***************
|
||
|
*** 83,89 ****
|
||
|
msg->length = 0;
|
||
|
|
||
|
// CoAP header
|
||
|
- coap_header->OC = 0;
|
||
|
coap_header->Code = COAP_CODE_RESP_VALID;
|
||
|
|
||
|
outcome = E_SUCCESS;
|
||
|
--- 83,88 ----
|
||
|
***************
|
||
|
*** 101,107 ****
|
||
|
memcpy(&msg->payload[0],&rawdata[8],8);
|
||
|
|
||
|
// set the CoAP header
|
||
|
- coap_header->OC = 0;
|
||
|
coap_header->Code = COAP_CODE_RESP_CONTENT;
|
||
|
|
||
|
outcome = E_SUCCESS;
|
||
|
--- 100,105 ----
|
||
|
***************
|
||
|
*** 116,122 ****
|
||
|
|
||
|
void rxl1_timer() {
|
||
|
OpenQueueEntry_t* pkt;
|
||
|
! error_t outcome;
|
||
|
uint8_t numOptions;
|
||
|
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
|
||
|
|
||
|
--- 114,120 ----
|
||
|
|
||
|
void rxl1_timer() {
|
||
|
OpenQueueEntry_t* pkt;
|
||
|
! owerror_t outcome;
|
||
|
uint8_t numOptions;
|
||
|
uint8_t rawdata[SENSITIVE_ACCEL_TEMPERATURE_DATALEN];
|
||
|
|
||
|
***************
|
||
|
*** 143,154 ****
|
||
|
packetfunctions_reserveHeaderSize(pkt,sizeof(rxl1_path0)-1);
|
||
|
memcpy(&pkt->payload[0],&rxl1_path0,sizeof(rxl1_path0)-1);
|
||
|
packetfunctions_reserveHeaderSize(pkt,1);
|
||
|
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
|
||
|
sizeof(rxl1_path0)-1;
|
||
|
numOptions++;
|
||
|
// content-type option
|
||
|
packetfunctions_reserveHeaderSize(pkt,2);
|
||
|
! pkt->payload[0] = COAP_OPTION_CONTENTTYPE << 4 |
|
||
|
1;
|
||
|
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
|
||
|
numOptions++;
|
||
|
--- 141,152 ----
|
||
|
packetfunctions_reserveHeaderSize(pkt,sizeof(rxl1_path0)-1);
|
||
|
memcpy(&pkt->payload[0],&rxl1_path0,sizeof(rxl1_path0)-1);
|
||
|
packetfunctions_reserveHeaderSize(pkt,1);
|
||
|
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
|
||
|
sizeof(rxl1_path0)-1;
|
||
|
numOptions++;
|
||
|
// content-type option
|
||
|
packetfunctions_reserveHeaderSize(pkt,2);
|
||
|
! pkt->payload[0] = COAP_OPTION_NUM_CONTENTFORMAT << 4 |
|
||
|
1;
|
||
|
pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM;
|
||
|
numOptions++;
|
||
|
***************
|
||
|
*** 171,176 ****
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
! void rxl1_sendDone(OpenQueueEntry_t* msg, error_t error) {
|
||
|
openqueue_freePacketBuffer(msg);
|
||
|
}
|
||
|
--- 169,174 ----
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
! void rxl1_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
|
||
|
openqueue_freePacketBuffer(msg);
|
||
|
}
|