Skip to content

Commit

Permalink
FW-456. add 6p response control command.
Browse files Browse the repository at this point in the history
  • Loading branch information
changtengfei committed Jan 27, 2016
1 parent 8fe1a02 commit 90e9ec2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
12 changes: 12 additions & 0 deletions drivers/common/openserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,18 @@ void openserial_goldenImageCommands(void){
case COMMAND_SET_SLOTDURATION:
ieee154e_setSlotDuration(comandParam_16);
break;
case COMMAND_SET_6PRESPONSE_STATUS:
if (comandParam_8 ==1) {
sixtop_setIsResponseEnabled(TRUE);
} else {
if (comandParam_8 == 0) {
sixtop_setIsResponseEnabled(FALSE);
} else {
// security only can be 1 or 0
break;
}
}
break;
default:
// wrong command ID
break;
Expand Down
3 changes: 2 additions & 1 deletion drivers/common/openserial.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ enum {
COMMAND_SET_6P_LIST = 12,
COMMAND_SET_6P_CLEAR = 13,
COMMAND_SET_SLOTDURATION = 14,
COMMAND_MAX = 15,
COMMAND_SET_6PRESPONSE_STATUS = 15,
COMMAND_MAX = 16,
};

//=========================== module variables ================================
Expand Down
11 changes: 9 additions & 2 deletions openstack/02b-MAChigh/sixtop.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ void sixtop_init() {
sixtop_vars.mgtTaskCounter = 0;
sixtop_vars.kaPeriod = MAXKAPERIOD;
sixtop_vars.ebPeriod = EBPERIOD;
sixtop_vars.isResponseEnabled = TRUE;

sixtop_vars.maintenanceTimerId = opentimers_start(
sixtop_vars.periodMaintenance,
Expand Down Expand Up @@ -597,6 +598,10 @@ bool debugPrint_kaPeriod() {
return TRUE;
}

void sixtop_setIsResponseEnabled(bool isEnabled){
sixtop_vars.isResponseEnabled = isEnabled;
}

//=========================== private =========================================

/**
Expand Down Expand Up @@ -1186,8 +1191,10 @@ void sixtop_notifyReceiveCommand(
processIE_prepend_sixtopIE(response_pkt,len);
// indicate IEs present
response_pkt->l2_payloadIEpresent = TRUE;
// send packet
sixtop_send(response_pkt);
if (sixtop_vars.isResponseEnabled){
// send packet
sixtop_send(response_pkt);
}
// update state
sixtop_vars.six2six_state = SIX_WAIT_RESPONSE_SENDDONE;
// arm timeout
Expand Down
3 changes: 3 additions & 0 deletions openstack/02b-MAChigh/sixtop.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ typedef struct {
six2six_state_t six2six_state;
uint8_t commandID;
six2six_handler_t handler;
bool isResponseEnabled;
} sixtop_vars_t;

//=========================== prototypes ======================================
Expand All @@ -111,6 +112,8 @@ void task_sixtopNotifReceive(void);
// debugging
bool debugPrint_myDAGrank(void);
bool debugPrint_kaPeriod(void);
// control
void sixtop_setIsResponseEnabled(bool isEnabled);

/**
\}
Expand Down
1 change: 1 addition & 0 deletions projects/python/SConscript.env
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ functionsToChange = [
'task_sixtopNotifReceive',
'debugPrint_myDAGrank',
'debugPrint_kaPeriod',
'sixtop_setIsResponseEnabled',
'sixtop_send_internal',
'sixtop_maintenance_timer_cb',
'sixtop_timeout_timer_cb',
Expand Down

0 comments on commit 90e9ec2

Please sign in to comment.