Skip to content

Commit

Permalink
Merge pull request #395 from openwsn-berkeley/develop_FW-548
Browse files Browse the repository at this point in the history
FW-548. implementing MSF algorithm for adapting to traffic.
  • Loading branch information
changtengfei authored Mar 20, 2018
2 parents 81d7388 + 66e6cd4 commit dcf26e9
Show file tree
Hide file tree
Showing 42 changed files with 1,957 additions and 1,648 deletions.
8 changes: 4 additions & 4 deletions bsp/boards/python/openwsnmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static PyObject* OpenMote_getState(OpenMote* self) {
PyObject* monitor_expiration_vars;
PyObject* neighbors_vars;
PyObject* sixtop_vars;
PyObject* sf0_vars;
PyObject* msf_vars;
PyObject* schedule_vars;
PyObject* schedule_dbg;
PyObject* ieee154e_vars;
Expand Down Expand Up @@ -114,10 +114,10 @@ static PyObject* OpenMote_getState(OpenMote* self) {
// TODO
PyDict_SetItemString(returnVal, "sixtop_vars", sixtop_vars);

// sf0_vars
sf0_vars = PyDict_New();
// msf_vars
msf_vars = PyDict_New();
// TODO
PyDict_SetItemString(returnVal, "sf0_vars", sf0_vars);
PyDict_SetItemString(returnVal, "msf_vars", msf_vars);

// schedule_vars
schedule_vars = PyDict_New();
Expand Down
4 changes: 2 additions & 2 deletions bsp/boards/python/openwsnmodule_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "iphc_obj.h"
#include "neighbors_obj.h"
#include "sixtop_obj.h"
#include "sf0_obj.h"
#include "msf_obj.h"
#include "schedule_obj.h"
#include "icmpv6echo_obj.h"
#include "icmpv6rpl_obj.h"
Expand Down Expand Up @@ -204,7 +204,7 @@ struct OpenMote {
sixtop_vars_t sixtop_vars;
neighbors_vars_t neighbors_vars;
schedule_vars_t schedule_vars;
sf0_vars_t sf0_vars;
msf_vars_t msf_vars;
// l2a
adaptive_sync_vars_t adaptive_sync_vars;
ieee802154_security_vars_t ieee802154_security_vars;
Expand Down
7 changes: 4 additions & 3 deletions drivers/common/openserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "schedule.h"
#include "icmpv6rpl.h"
#include "icmpv6echo.h"
#include "sf0.h"
#include "msf.h"



Expand Down Expand Up @@ -182,6 +182,7 @@ owerror_t openserial_printCritical(
) {
opentimers_id_t id;
uint32_t reference;

// blink error LED, this is serious
leds_error_blink();

Expand Down Expand Up @@ -795,7 +796,7 @@ void openserial_handleCommands(void){
cellOptions, // cellOptions
celllist_add, // celllist to add
celllist_delete, // celllist to delete (not used)
sf0_getsfid(), // sfid
msf_getsfid(), // sfid
listOffset, // list command offset (not used)
maxListLen // list command maximum celllist (not used)
);
Expand All @@ -820,7 +821,7 @@ void openserial_handleCommands(void){
break;
case COMMAND_SET_UINJECTPERIOD:
comandParam_8 = openserial_vars.inputBuf[ptr];
sf0_appPktPeriod(comandParam_8);
msf_appPktPeriod(comandParam_8);
break;
case COMMAND_SET_ECHO_REPLY_STATUS:
comandParam_8 = openserial_vars.inputBuf[ptr];
Expand Down
62 changes: 29 additions & 33 deletions inc/opendefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ static const uint8_t infoStackName[] = "OpenWSN ";
#define LENGTH_ADDR64b 8
#define LENGTH_ADDR128b 16

#define MAXNUMNEIGHBORS 10
#define MAXNUMNEIGHBORS 30

// maximum celllist length
#define CELLLIST_MAX_LEN 3
#define CELLLIST_MAX_LEN 5

enum {
E_SUCCESS = 0,
Expand Down Expand Up @@ -144,40 +144,36 @@ enum {
COMPONENT_NEIGHBORS = 0x0d,
COMPONENT_SCHEDULE = 0x0e,
COMPONENT_SIXTOP_RES = 0x0f,
COMPONENT_SF = 0x10,
//IPHC
COMPONENT_OPENBRIDGE = 0x11,
COMPONENT_IPHC = 0x12,
COMPONENT_OPENBRIDGE = 0x10,
COMPONENT_IPHC = 0x11,
//IPv6
COMPONENT_FORWARDING = 0x13,
COMPONENT_ICMPv6 = 0x14,
COMPONENT_ICMPv6ECHO = 0x15,
COMPONENT_ICMPv6ROUTER = 0x16,
COMPONENT_ICMPv6RPL = 0x17,
COMPONENT_FORWARDING = 0x12,
COMPONENT_ICMPv6 = 0x13,
COMPONENT_ICMPv6ECHO = 0x14,
COMPONENT_ICMPv6ROUTER = 0x15,
COMPONENT_ICMPv6RPL = 0x16,
//TRAN
COMPONENT_OPENTCP = 0x18,
COMPONENT_OPENUDP = 0x19,
COMPONENT_OPENCOAP = 0x1a,
COMPONENT_OPENUDP = 0x17,
COMPONENT_OPENCOAP = 0x18,
// applications
COMPONENT_C6T = 0x1b,
COMPONENT_CEXAMPLE = 0x1c,
COMPONENT_CINFO = 0x1d,
COMPONENT_CLEDS = 0x1e,
COMPONENT_CSENSORS = 0x1f,
COMPONENT_CSTORM = 0x20,
COMPONENT_CWELLKNOWN = 0x21,
COMPONENT_TECHO = 0x22,
COMPONENT_TOHLONE = 0x23,
COMPONENT_UECHO = 0x24,
COMPONENT_UINJECT = 0x25,
COMPONENT_RRT = 0x26,
COMPONENT_SECURITY = 0x27,
COMPONENT_USERIALBRIDGE = 0x28,
COMPONENT_UEXPIRATION = 0x29,
COMPONENT_UMONITOR = 0x2a,
COMPONENT_CJOIN = 0x2b,
COMPONENT_OPENOSCOAP = 0x2c,
COMPONENT_CINFRARED = 0x2d,
COMPONENT_C6T = 0x19,
COMPONENT_CEXAMPLE = 0x1a,
COMPONENT_CINFO = 0x1b,
COMPONENT_CLEDS = 0x1c,
COMPONENT_CSENSORS = 0x1d,
COMPONENT_CSTORM = 0x1e,
COMPONENT_CWELLKNOWN = 0x1f,
COMPONENT_UECHO = 0x20,
COMPONENT_UINJECT = 0x21,
COMPONENT_RRT = 0x22,
COMPONENT_SECURITY = 0x23,
COMPONENT_USERIALBRIDGE = 0x24,
COMPONENT_UEXPIRATION = 0x25,
COMPONENT_UMONITOR = 0x26,
COMPONENT_CJOIN = 0x27,
COMPONENT_OPENOSCOAP = 0x28,
COMPONENT_CINFRARED = 0x29,
};

/**
Expand Down Expand Up @@ -386,7 +382,7 @@ typedef struct {
asn_t asn;
uint8_t joinPrio;
bool f6PNORES;
uint8_t generation;
bool inBlacklist;
uint8_t sequenceNumber;
uint8_t backoffExponenton;
uint8_t backoff;
Expand Down
4 changes: 2 additions & 2 deletions kernel/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ typedef enum {
TASKPRIO_RPL = 0x04,
TASKPRIO_TCP_TIMEOUT = 0x05,
TASKPRIO_COAP = 0x06,
TASKPRIO_ADAPTIVE_SYNC = 0x07,
TASKPRIO_SF0 = 0x08,
TASKPRIO_ADAPTIVE_SYNC = 0x07,
TASKPRIO_MSF = 0x08,
// tasks trigger by other interrupts
TASKPRIO_BUTTON = 0x09,
TASKPRIO_SIXTOP_TIMEOUT = 0x0a,
Expand Down
14 changes: 7 additions & 7 deletions openapps/c6t/c6t.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "idmanager.h"
#include "openqueue.h"
#include "neighbors.h"
#include "sf0.h"
#include "msf.h"

//=========================== defines =========================================

Expand Down Expand Up @@ -94,7 +94,7 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,
break;
}

if (sf0_candidateAddCellList(celllist_add,1)==FALSE){
if (msf_candidateAddCellList(celllist_add,1)==FALSE){
// set the CoAP header
outcome = E_FAIL;
coap_header->Code = COAP_CODE_RESP_CHANGED;
Expand All @@ -105,10 +105,10 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,
IANA_6TOP_CMD_ADD, // code
&neighbor, // neighbor
1, // number cells
LINKOPTIONS_TX, // cellOptions
CELLOPTIONS_TX, // cellOptions
celllist_add, // celllist to add
NULL, // celllist to delete (not used)
sf0_getsfid(), // sfid
msf_getsfid(), // sfid
0, // list command offset (not used)
0 // list command maximum celllist (not used)
);
Expand All @@ -134,7 +134,7 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,
}

// call sixtop
if (sf0_candidateRemoveCellList(celllist_delete,&neighbor,1)==FALSE){
if (msf_candidateRemoveCellList(celllist_delete,&neighbor,1)==FALSE){
// set the CoAP header
outcome = E_FAIL;
coap_header->Code = COAP_CODE_RESP_CHANGED;
Expand All @@ -145,10 +145,10 @@ owerror_t c6t_receive(OpenQueueEntry_t* msg,
IANA_6TOP_CMD_ADD, // code
&neighbor, // neighbor
1, // number cells
LINKOPTIONS_TX, // cellOptions
CELLOPTIONS_TX, // cellOptions
celllist_add, // celllist to add
NULL, // celllist to delete (not used)
sf0_getsfid(), // sfid
msf_getsfid(), // sfid
0, // list command offset (not used)
0 // list command maximum celllist (not used)
);
Expand Down
Loading

0 comments on commit dcf26e9

Please sign in to comment.