1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/openwsn/patches/07-App_layerdebug_layerdebug.c.patch
2014-05-14 15:06:50 +02:00

245 lines
7.5 KiB
Diff

*** stock_iot-lab_M3/openwsn/07-App/layerdebug/layerdebug.c Thu Apr 24 11:01:37 2014
--- riot-openwsn-wip/openwsn/07-App/layerdebug/layerdebug.c Thu Apr 24 16:55:54 2014
***************
*** 7,13 ****
#include "openserial.h"
#include "openrandom.h"
#include "scheduler.h"
!
// include layer files to debug
#include "neighbors.h"
--- 7,14 ----
#include "openserial.h"
#include "openrandom.h"
#include "scheduler.h"
! #include "IEEE802154E.h"
! #include "idmanager.h"
// include layer files to debug
#include "neighbors.h"
***************
*** 34,45 ****
//=========================== prototypes ======================================
! error_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
! error_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
--- 35,46 ----
//=========================== prototypes ======================================
! owerror_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
! owerror_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options);
***************
*** 50,56 ****
void layerdebug_task_neighbors_cb();
void layerdebug_sendDone(OpenQueueEntry_t* msg,
! error_t error);
//=========================== public ==========================================
--- 51,57 ----
void layerdebug_task_neighbors_cb();
void layerdebug_sendDone(OpenQueueEntry_t* msg,
! owerror_t error);
//=========================== public ==========================================
***************
*** 100,109 ****
//schedule stats
void layerdebug_task_schedule_cb() {
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t numOptions;
uint8_t size;
// create a CoAP RD packet
pkt = openqueue_getFreePacketBuffer(COMPONENT_LAYERDEBUG);
if (pkt==NULL) {
--- 101,120 ----
//schedule stats
void layerdebug_task_schedule_cb() {
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t numOptions;
uint8_t size;
+ // don't run if not synch
+ if (ieee154e_isSynch() == FALSE) return;
+
+ // don't run on dagroot
+ if (idmanager_getIsDAGroot()) {
+ opentimers_stop( layerdebug_vars.schtimerId);
+ opentimers_stop( layerdebug_vars.nbstimerId);
+ return;
+ }
+
// create a CoAP RD packet
pkt = openqueue_getFreePacketBuffer(COMPONENT_LAYERDEBUG);
if (pkt==NULL) {
***************
*** 131,142 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(schedule_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&schedule_layerdebug_path0,sizeof(schedule_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
sizeof(schedule_layerdebug_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++;
--- 142,153 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(schedule_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&schedule_layerdebug_path0,sizeof(schedule_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(schedule_layerdebug_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++;
***************
*** 162,168 ****
void layerdebug_task_neighbors_cb() {
OpenQueueEntry_t* pkt;
! error_t outcome;
uint8_t numOptions;
uint8_t size;
--- 173,179 ----
void layerdebug_task_neighbors_cb() {
OpenQueueEntry_t* pkt;
! owerror_t outcome;
uint8_t numOptions;
uint8_t size;
***************
*** 195,206 ****
packetfunctions_reserveHeaderSize(pkt,sizeof(neighbors_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&neighbors_layerdebug_path0,sizeof(neighbors_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_LOCATIONPATH-COAP_OPTION_CONTENTTYPE) << 4 |
sizeof(neighbors_layerdebug_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++;
--- 206,217 ----
packetfunctions_reserveHeaderSize(pkt,sizeof(neighbors_layerdebug_path0)-1);
memcpy(&pkt->payload[0],&neighbors_layerdebug_path0,sizeof(neighbors_layerdebug_path0)-1);
packetfunctions_reserveHeaderSize(pkt,1);
! pkt->payload[0] = (COAP_OPTION_NUM_URIPATH) << 4 |
sizeof(neighbors_layerdebug_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++;
***************
*** 222,236 ****
return;
}
! void layerdebug_sendDone(OpenQueueEntry_t* msg, error_t error) {
openqueue_freePacketBuffer(msg);
}
! error_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
uint8_t size;
--- 233,247 ----
return;
}
! void layerdebug_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}
! owerror_t layerdebug_schedule_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
uint8_t size;
***************
*** 250,256 ****
msg->payload[0] = MAXACTIVESLOTS;
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 261,266 ----
***************
*** 263,272 ****
return outcome;
}
! error_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! error_t outcome;
uint8_t size;
--- 273,282 ----
return outcome;
}
! owerror_t layerdebug_neighbors_receive(OpenQueueEntry_t* msg,
coap_header_iht* coap_header,
coap_option_iht* coap_options) {
! owerror_t outcome;
uint8_t size;
***************
*** 287,293 ****
msg->payload[0] = size;
// set the CoAP header
- coap_header->OC = 0;
coap_header->Code = COAP_CODE_RESP_CONTENT;
outcome = E_SUCCESS;
--- 297,302 ----