OpenWSN Firmware
sixtop.h
Go to the documentation of this file.
1 #ifndef __SIXTOP_H
2 #define __SIXTOP_H
3 
11 #include "opentimers.h"
12 #include "openwsn.h"
13 
14 //=========================== define ==========================================
15 
20 };
21 
22 // states of the sixtop-to-sixtop state machine
23 typedef enum {
24  SIX_IDLE = 0x00, // ready for next event
25  // ADD: source
26  SIX_SENDING_ADDREQUEST = 0x01, // generating LinkRequest packet
27  SIX_WAIT_ADDREQUEST_SENDDONE = 0x02, // waiting for SendDone confirmation
28  SIX_WAIT_ADDRESPONSE = 0x03, // waiting for response from the neighbor
29  SIX_ADDRESPONSE_RECEIVED = 0x04, // I received the link response request command
30  // ADD: destinations
31  SIX_ADDREQUEST_RECEIVED = 0x05, // I received the link request command
32  SIX_SENDING_ADDRESPONSE = 0x06, // generating resLinkRespone command packet
33  SIX_WAIT_ADDRESPONSE_SENDDONE = 0x07, // waiting for SendDone confirmation
34  // REMOVE: source
35  SIX_SENDING_REMOVEREQUEST = 0x08, // generating resLinkRespone command packet
36  SIX_WAIT_REMOVEREQUEST_SENDDONE = 0x09, // waiting for SendDone confirmation
37  // REMOVE: destinations
38  SIX_REMOVEREQUEST_RECEIVED = 0x0a // I received the remove link request command
40 
41 //=========================== typedef =========================================
42 
43 #define SIX2SIX_TIMEOUT_MS 2000
44 
45 //=========================== module variables ================================
46 
47 typedef struct {
49  bool busySendingKA; // TRUE when busy sending a keep-alive
50  bool busySendingEB; // TRUE when busy sending an enhanced beacon
51  uint8_t dsn; // current data sequence number
52  uint8_t mgtTaskCounter; // counter to determine what management task to do
54  opentimer_id_t timeoutTimerId; // TimeOut timer id
55  uint16_t kaPeriod; // period of sending KA
57  uint8_t commandID;
59 
60 //=========================== prototypes ======================================
61 
62 // admin
63 void sixtop_init(void);
64 void sixtop_setKaPeriod(uint16_t kaPeriod);
65 // scheduling
66 void sixtop_addCells(open_addr_t* neighbor, uint16_t numCells);
67 void sixtop_removeCell(open_addr_t* neighbor);
68 // from upper layer
70 // from lower layer
71 void task_sixtopNotifSendDone(void);
72 void task_sixtopNotifReceive(void);
73 // debugging
74 bool debugPrint_myDAGrank(void);
75 bool debugPrint_kaPeriod(void);
76 
82 #endif
Definition: sixtop.h:27
bool busySendingEB
Definition: sixtop.h:50
uint16_t kaPeriod
Definition: sixtop.h:55
Definition: sixtop.h:31
Definition: sixtop.h:29
bool debugPrint_myDAGrank()
Trigger this module to print status information, over serial.
Definition: sixtop.c:498
Definition: sixtop.h:33
Definition: sixtop.h:36
Definition: sixtop.h:35
Definition: sixtop.h:38
uint8_t owerror_t
Definition: openwsn.h:265
opentimer_id_t timeoutTimerId
Definition: sixtop.h:54
void sixtop_init()
Definition: sixtop.c:118
Definition: sixtop.h:26
void sixtop_addCells(open_addr_t *neighbor, uint16_t numCells)
Definition: sixtop.c:152
void task_sixtopNotifSendDone()
Definition: sixtop.c:340
Definition: sixtop.h:17
bool busySendingKA
Definition: sixtop.h:49
void sixtop_setKaPeriod(uint16_t kaPeriod)
Definition: sixtop.c:142
#define opentimer_id_t
Definition: opentimers.h:28
six2six_state_t
Definition: sixtop.h:23
Definition: openwsn.h:276
Definition: sixtop.h:18
owerror_t sixtop_send(OpenQueueEntry_t *msg)
Definition: sixtop.c:317
Definition: sixtop.h:28
uint8_t dsn
Definition: sixtop.h:51
uint8_t commandID
Definition: sixtop.h:57
Definition: sixtop.h:47
Definition: sixtop.h:24
Definition: sixtop.h:19
opentimer_id_t maintenanceTimerId
Definition: sixtop.h:53
void task_sixtopNotifReceive()
Definition: sixtop.c:413
Definition: openwsn.h:288
sixtop_CommandID_num
Definition: sixtop.h:16
uint8_t mgtTaskCounter
Definition: sixtop.h:52
bool debugPrint_kaPeriod()
Trigger this module to print status information, over serial.
Definition: sixtop.c:516
void sixtop_removeCell(open_addr_t *neighbor)
Definition: sixtop.c:234
six2six_state_t six2six_state
Definition: sixtop.h:56
uint16_t periodMaintenance
Definition: sixtop.h:48
Definition: sixtop.h:32