Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ dummyFunc = Builder(action='', suffix='.ihex')
# add the build variables
if env['panid']:
env.Append(CPPDEFINES={'PANID_DEFINED': env['panid']})
if env['dagroot'] == 1:
env.Append(CPPDEFINES='DAGROOT')
if env['role'] == 'root':
env.Append(CPPDEFINES={'ROLE_DEFAULT': 'ROLE_PAN_COORDINATOR'})
elif env['role'] == 'coord':
env.Append(CPPDEFINES={'ROLE_DEFAULT': 'ROLE_COORDINATOR'})
elif env['role'] == 'leaf':
env.Append(CPPDEFINES={'ROLE_DEFAULT': 'ROLE_LEAF'})
if env['atmel_24ghz'] == 1:
env.Append(CPPDEFINES='ATMEL_24GHZ')
if env['deadline_option'] == 1:
Expand Down
14 changes: 7 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ project:
shared library.

Variables for special use cases.
dagroot Setting a mote as DAG root is typically done through
role Setting a mote's role is typically done through
OpenVisualizer. In some rare cases when the OpenVisualizer
cannot send commands to the mote (e.g. IoT-LAB platform),
use this flag to build a firmware image which is, by
default, in DAG root mode.
use this flag to build a firmware image with a specific role.
root, coord, leaf. (default coord)
ide qtcreator

Common variables:
Expand Down Expand Up @@ -138,7 +138,7 @@ command_line_options = {
'simhost': ['amd64-linux', 'x86-linux', 'amd64-windows', 'x86-windows'],
'simhostpy': [''], # No reasonable default
'panid': [''],
'dagroot': ['0', '1'],
'role': ['', 'root', 'coord', 'leaf'],
'debug': ['0', '1'],
'atmel_24ghz': ['0', '1'],
'deadline_option': ['0', '1'],
Expand Down Expand Up @@ -243,11 +243,11 @@ command_line_vars.AddVariables(
None, # converter
),
(
'dagroot', # key
'role', # key
'', # help
command_line_options['dagroot'][0], # default
'', # default
validate_option, # validator
int, # converter
None, # converter
),
(
'debug', # key
Expand Down
1 change: 0 additions & 1 deletion bsp/boards/openmote-b-24ghz/board_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
#define BSP_ANTENNA_BASE GPIO_D_BASE
#define BSP_ANTENNA_CC2538_24GHZ GPIO_PIN_4 //!< PD4 -- 2.4ghz
#define BSP_ANTENNA_AT215_24GHZ GPIO_PIN_3 //!< PD3 -- subghz
//#define DAGROOT

//=========================== typedef ========================================

Expand Down
1 change: 0 additions & 1 deletion bsp/boards/openmote-b-subghz/board_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
#define BSP_ANTENNA_BASE GPIO_D_BASE
#define BSP_ANTENNA_CC2538_24GHZ GPIO_PIN_4 //!< PD4 -- 2.4ghz
#define BSP_ANTENNA_AT215_24GHZ GPIO_PIN_3 //!< PD3 -- subghz
//#define DAGROOT

//=========================== typedef ========================================

Expand Down
2 changes: 1 addition & 1 deletion bsp/boards/scum/eui64.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

//=========================== variables =======================================

#ifdef DAGROOT
#if ROLE_DEFAULT == ROLE_PAN_COORDINATOR
const uint8_t eui64[8] = {0x00,0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x88};
#else
const uint8_t eui64[8] = {0x00,0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77};
Expand Down
15 changes: 14 additions & 1 deletion inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@
* When the channel is set to 0, frequency hopping is enabled, otherwise a single channel is used.
*
*/
#define IEEE802154E_SINGLE_CHANNEL 11
// #define IEEE802154E_SINGLE_CHANNEL 11


/**
* \def PACKETQUEUE_LENGTH
Expand All @@ -290,6 +291,18 @@
*/
#define PACKETQUEUE_LENGTH 20


/**
* \def ROLE_DEFAULT
*
* Includes the sensor driver
*
*/
#ifndef ROLE_DEFAULT
#define ROLE_DEFAULT ROLE_COORDINATOR
#endif


// ======================== Board configuration ========================

/**
Expand Down
2 changes: 1 addition & 1 deletion inc/opendefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ enum {
ERR_RCVD_ECHO_REPLY = 0x0b, // received an echo reply
ERR_6LORH_DEADLINE_EXPIRED = 0x0c, // the received packet has expired
ERR_6LORH_DEADLINE_DROPPED = 0x0d, // packet expiry time reached, dropped
ERR_UNEXPECTED_DAO = 0x0e, // unexpected DAO (code location {0}). A change maybe happened on dagroot node.
ERR_UNEXPECTED_DAO = 0x0e, // unexpected DAO (code location {0}). A change maybe happened on PAN coordinator node.
ERR_UNSUPPORTED_ICMPV6_TYPE = 0x0f, // unsupported ICMPv6 type {0} (code location {1})
ERR_6LOWPAN_UNSUPPORTED = 0x10, // unsupported 6LoWPAN parameter {1} at location {0}, dropping packet
ERR_NO_NEXTHOP = 0x11, // no next hop for layer 3 destination {0:x}{1:x}
Expand Down
2 changes: 1 addition & 1 deletion openapps/c6t/c6t.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void c6t_sendDone(
//=========================== public ==========================================

void c6t_init(void) {
if (idmanager_getIsDAGroot() == TRUE) return;
if (idmanager_isPanCoordinator() == TRUE) return;

// prepare the resource descriptor for the /6t path
c6t_vars.desc.path0len = sizeof(c6t_path0) - 1;
Expand Down
4 changes: 2 additions & 2 deletions openapps/cexample/cexample.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ void cexample_task_cb(void) {
return;
}

// don't run on dagroot
if (idmanager_getIsDAGroot()) {
// don't run on PAN coordinator
if (idmanager_isPanCoordinator()) {
opentimers_destroy(cexample_vars.timerId);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions openapps/cinfo/cinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void cinfo_sendDone(
\brief Initialize this module.
*/
void cinfo_init(void) {
// do not run if DAGroot
if (idmanager_getIsDAGroot() == TRUE) return;
// do not run if PAN coordinator
if (idmanager_isPanCoordinator() == TRUE) return;

// prepare the resource descriptor for the /i path
cinfo_vars.desc.path0len = sizeof(cinfo_path0) - 1;
Expand Down
2 changes: 1 addition & 1 deletion openapps/cinfrared/cinfrared.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void cinrared_turnOnOrOff(uint8_t turnOnOrOff);
//=========================== public ==========================================

void cinfrared_init(void) {
if (idmanager_getIsDAGroot() == TRUE) return;
if (idmanager_isPanCoordinator() == TRUE) return;

// prepare the resource descriptor for the /6t path
cinfrared_vars.desc.path0len = sizeof(cinfrared_path0) - 1;
Expand Down
2 changes: 1 addition & 1 deletion openapps/cjoin/cjoin.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void cjoin_task_cb(void) {
}

// don't run if DAG root
if (idmanager_getIsDAGroot() == TRUE) {
if (idmanager_isPanCoordinator() == TRUE) {
opentimers_destroy(cjoin_vars.timerId);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions openapps/csensors/csensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ void csensors_init(void) {
uint8_t i;
uint8_t numSensors;

// do not run if DAGroot
if (idmanager_getIsDAGroot() == TRUE) return;
// do not run if PAN coordinator
if (idmanager_isPanCoordinator() == TRUE) return;

opensensors_init();
memset(&csensors_vars, 0, sizeof(csensors_vars_t));
Expand Down
4 changes: 2 additions & 2 deletions openapps/cstorm/cstorm.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ void cstorm_task_cb(void) {
return;
}

// don't run on dagroot
if (idmanager_getIsDAGroot()) {
// don't run on PAN coordinator
if (idmanager_isPanCoordinator()) {
opentimers_destroy(cstorm_vars.timerId);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion openapps/cwellknown/cwellknown.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void cwellknown_sendDone(
//=========================== public ==========================================

void cwellknown_init(void) {
if (idmanager_getIsDAGroot() == TRUE) return;
if (idmanager_isPanCoordinator() == TRUE) return;

// prepare the resource descriptor for the /.well-known/core path
cwellknown_vars.desc.path0len = sizeof(cwellknown_path0) - 1;
Expand Down
6 changes: 3 additions & 3 deletions openapps/rrt/rrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ void rrt_sendCoAPMsg(char actionMsg, uint8_t *ipv6mote);
*/
void rrt_init(void) {

// do not run if DAGroot
if (idmanager_getIsDAGroot() == TRUE) return;
// do not run if PAN coordinator
if (idmanager_isPanCoordinator() == TRUE) return;

// prepare the resource descriptor for the /rt path
rrt_vars.desc.path0len = sizeof(rrt_path0) - 1;
Expand Down Expand Up @@ -273,4 +273,4 @@ void rrt_sendDone(OpenQueueEntry_t *msg, owerror_t error) {
openqueue_freePacketBuffer(msg);
}

#endif /* OPENWSN_RRT_C */
#endif /* OPENWSN_RRT_C */
6 changes: 3 additions & 3 deletions openapps/uinject/uinject.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ void uinject_task_cb(void) {
return;
}

// don't run on dagroot
if (idmanager_getIsDAGroot()) {
// don't run on PAN coordinator
if (idmanager_isPanCoordinator()) {
opentimers_destroy(uinject_vars.timerId);
return;
}
Expand Down Expand Up @@ -224,4 +224,4 @@ void uinject_task_cb(void) {
}
}

#endif /* OPENWSN_UINJECT_C */
#endif /* OPENWSN_UINJECT_C */
6 changes: 3 additions & 3 deletions openapps/uinject/uinject_dagroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _crcIteration(self,crc,b):

class moteProbe(threading.Thread):

CMD_SET_DAGROOT = '7e5259bbbb00000000000001deadbeefcafedeadbeefcafedeadbeefa7d97e' # prefix: bbbb000000000000 keyindex : 01 keyvalue: deadbeefcafedeadbeefcafedeadbeef
CMD_SET_PAN_COORDINATOR = '7e5259bbbb00000000000001deadbeefcafedeadbeefcafedeadbeefa7d97e' # prefix: bbbb000000000000 keyindex : 01 keyvalue: deadbeefcafedeadbeefcafedeadbeef
CMD_SEND_DATA = '7e44141592000012e63b78001180bbbb0000000000000000000000000001bbbb000000000000141592000012e63b07d007d0000ea30d706f69706f697a837e'
SLOT_DURATION = 0.015
UINJECT_MASK = 'uinject'
Expand All @@ -134,7 +134,7 @@ def __init__(self,serialport=None):
self.busyReceiving = False
self.inputBuf = ''
self.last_counter = None
self.outputBuf = [binascii.unhexlify(self.CMD_SET_DAGROOT)]
self.outputBuf = [binascii.unhexlify(self.CMD_SET_PAN_COORDINATOR)]
self.outputBufLock = threading.RLock()
self.dataLock = threading.Lock()

Expand Down Expand Up @@ -237,4 +237,4 @@ def main():
print 'poipoi'

if __name__=="__main__":
moteProbe('COM7')
moteProbe('COM7')
4 changes: 2 additions & 2 deletions openapps/userialbridge/userialbridge_dagroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def buf2hex(buf):

class moteProbe(threading.Thread):

CMD_SET_DAGROOT = '7e5259bbbb0000000000000c347e'
CMD_SET_PAN_COORDINATOR = '7e5259bbbb0000000000000c347e'

XOFF = 0x13
XON = 0x11
Expand All @@ -41,7 +41,7 @@ def __init__(self,serialport=None):
self.busyReceiving = False
self.inputBuf = ''
self.last_counter = None
self.outputBuf = [binascii.unhexlify(self.CMD_SET_DAGROOT)]
self.outputBuf = [binascii.unhexlify(self.CMD_SET_PAN_COORDINATOR)]
self.outputBufLock = threading.RLock()
self.dataLock = threading.Lock()

Expand Down
16 changes: 8 additions & 8 deletions openstack/02a-MAClow/IEEE802154E.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void ieee154e_init(void) {
// default hopping template
memcpy(&(ieee154e_vars.chTemplate[0]), chTemplate_default, sizeof(ieee154e_vars.chTemplate));

if (idmanager_getIsDAGroot() == TRUE) {
if (idmanager_isPanCoordinator() == TRUE) {
changeIsSync(TRUE);
} else {
changeIsSync(FALSE);
Expand Down Expand Up @@ -342,7 +342,7 @@ void isr_ieee154e_newSlot(opentimers_id_t id) {
ieee154e_vars.slotDuration = TsSlotDuration;

if (ieee154e_vars.isSync == FALSE) {
if (idmanager_getIsDAGroot() == TRUE) {
if (idmanager_isPanCoordinator() == TRUE) {
changeIsSync(TRUE);
ieee154e_resetAsn();
ieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();
Expand Down Expand Up @@ -916,7 +916,7 @@ port_INLINE void activity_ti1ORri1(void) {
}

// desynchronize if needed
if (idmanager_getIsDAGroot() == FALSE) {
if (idmanager_isPanCoordinator() == FALSE) {
if (ieee154e_vars.deSyncTimeout > ieee154e_vars.numOfSleepSlots) {
ieee154e_vars.deSyncTimeout -= ieee154e_vars.numOfSleepSlots;
} else {
Expand Down Expand Up @@ -967,7 +967,7 @@ port_INLINE void activity_ti1ORri1(void) {

// find the next one
ieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();
if (idmanager_getIsSlotSkip() && idmanager_getIsDAGroot() == FALSE) {
if (idmanager_getIsSlotSkip() && idmanager_isPanCoordinator() == FALSE) {
if (ieee154e_vars.nextActiveSlotOffset > ieee154e_vars.slotOffset) {
ieee154e_vars.numOfSleepSlots = ieee154e_vars.nextActiveSlotOffset - ieee154e_vars.slotOffset;
} else {
Expand Down Expand Up @@ -1586,7 +1586,7 @@ port_INLINE void activity_ti9(PORT_TIMER_WIDTH capturedTime) {
break;
}

if (idmanager_getIsDAGroot() == FALSE &&
if (idmanager_isPanCoordinator() == FALSE &&
icmpv6rpl_isPreferredParent(&(ieee154e_vars.ackReceived->l2_nextORpreviousHop))) {
synchronizeAck(ieee802514_header.timeCorrection);
}
Expand Down Expand Up @@ -1946,12 +1946,12 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {
);
#endif
} else {
// synchronize to the received packet if I'm not a DAGroot and this is my preferred parent or in case I'm
// synchronize to the received packet if I'm not a PAN coordinator and this is my preferred parent or in case I'm
// in the middle of the join process when parent is not yet selected or in case I don't have an autonomous
// Tx cell cell to my parent yet

if (
idmanager_getIsDAGroot() == FALSE &&
idmanager_isPanCoordinator() == FALSE &&
(
icmpv6rpl_isPreferredParent(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop)) ||
IEEE802154_security_isConfigured() == FALSE ||
Expand Down Expand Up @@ -2176,7 +2176,7 @@ port_INLINE void activity_ri9(PORT_TIMER_WIDTH capturedTime) {
// clear local variable
ieee154e_vars.ackToSend = NULL;

if ((idmanager_getIsDAGroot() == FALSE &&
if ((idmanager_isPanCoordinator() == FALSE &&
icmpv6rpl_isPreferredParent(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop))) ||
IEEE802154_security_isConfigured() == FALSE) {
synchronizePacket(ieee154e_vars.syncCapturedTime);
Expand Down
8 changes: 4 additions & 4 deletions openstack/02b-MAChigh/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ void schedule_init(void) {
schedule_vars.backoffExponenton = MINBE - 1;
schedule_vars.maxActiveSlots = MAXACTIVESLOTS;

if (idmanager_getIsDAGroot() == TRUE) {
schedule_startDAGroot();
if (idmanager_isPanCoordinator() == TRUE) {
schedule_startPanCoordinator();
}
}

/**
\brief Starting the DAGroot schedule propagation.
\brief Starting the PAN Coordinator schedule propagation.
*/
void schedule_startDAGroot(void) {
void schedule_startPanCoordinator(void) {
slotOffset_t start_slotOffset;
slotOffset_t running_slotOffset;
open_addr_t temp_neighbor;
Expand Down
4 changes: 2 additions & 2 deletions openstack/02b-MAChigh/schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The superframe reappears over time and can be arbitrarily long.
MAXACTIVESLOTS < SLOTFRAME_LENGTH

This would make sure number of slots are available (SLOTFRAME_LENGTH-MAXACTIVESLOTS)
for serial port to transmit data to dagroot.
for serial port to transmit data to PAN coordinator.
*/

#define NUMSLOTSOFF 20
Expand Down Expand Up @@ -175,7 +175,7 @@ typedef struct {
// admin
void schedule_init(void);

void schedule_startDAGroot(void);
void schedule_startPanCoordinator(void);

bool debugPrint_schedule(void);

Expand Down
3 changes: 2 additions & 1 deletion openstack/02b-MAChigh/sixtop.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ port_INLINE void sixtop_sendEB(void) {
(ieee154e_isSynch() == FALSE) ||
(IEEE802154_security_isConfigured() == FALSE) ||
(icmpv6rpl_getMyDAGrank() == DEFAULTDAGRANK) ||
icmpv6rpl_daoSent() == FALSE) {
(icmpv6rpl_daoSent() == FALSE) ||
(idmanager_isLeafNode() == TRUE)) {
// I'm not sync'ed, or did not join, or did not acquire a DAGrank or did not send out a DAO
// before starting to advertize the network, we need to make sure that we are reachable downwards,
// thus, the condition if DAO was sent
Expand Down
Loading