Skip to content

Commit

Permalink
FW-277. Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
twatteyne committed Oct 1, 2014
1 parent 8282952 commit dc20927
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 436 deletions.
49 changes: 21 additions & 28 deletions bsp/boards/python/openwsnmodule_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@
#include "icmpv6rpl_obj.h"
#include "opencoap_obj.h"
#include "opentcp_obj.h"
#include "ohlone_obj.h"
#include "r6t_obj.h"
#include "tcpinject_obj.h"
#include "idmanager_obj.h"
#include "openqueue_obj.h"
#include "openrandom_obj.h"
#include "uart_obj.h"
#include "rinfo_obj.h"
#include "udpstorm_obj.h"
#include "rrt_obj.h"
#include "rleds_obj.h"
#include "rwellknown_obj.h"
// applications
#include "c6t_obj.h"
#include "cexample_obj.h"
#include "cinfo_obj.h"
#include "cleds_obj.h"
#include "cstorm_obj.h"
#include "cwellknown_obj.h"
#include "techo_obj.h"
#include "tohlone_obj.h"
#include "tohlone_obj.h"
#include "uecho_obj.h"

// notifications sent from the C mote to the Python BSP
enum {
Expand Down Expand Up @@ -182,7 +184,7 @@ struct OpenMote {
bsp_timer_icb_t bsp_timer_icb;
radio_icb_t radio_icb;
radiotimer_icb_t radiotimer_icb;
//===== stack
//===== openstack
// l4
icmpv6echo_vars_t icmpv6echo_vars;
icmpv6rpl_vars_t icmpv6rpl_vars;
Expand All @@ -208,24 +210,15 @@ struct OpenMote {
// kernel
scheduler_vars_t scheduler_vars;
scheduler_dbg_t scheduler_dbg;
//===== applications
//+++++ TCP
//- debug
tcpinject_vars_t tcpinject_vars;
//- common
ohlone_vars_t ohlone_vars;
//+++++ UDP
//- debug
//- common
udpstorm_vars_t udpstorm_vars;
//+++++ CoAP
//- debug
//- common
rinfo_vars_t rinfo_vars;
rrt_vars_t rrt_vars;
rleds_vars_t rleds_vars;
rwellknown_vars_t rwellknown_vars;
r6t_vars_t r6t_vars;
//===== openapps
c6t_vars_t c6t_vars;
cexample_vars_t cexample_vars;
cinfo_vars_t cinfo_vars;
cleds_vars_t cleds_vars;
cstorm_vars_t cstorm_vars;
cwellknown_vars_t cwellknown_vars;
tohlone_vars_t tohlone_vars;

};

#endif
11 changes: 0 additions & 11 deletions drivers/common/openserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include "icmpv6echo.h"
#include "idmanager.h"
#include "openqueue.h"
#include "tcpinject.h"
#include "udpinject.h"
#include "openbridge.h"
#include "leds.h"
#include "schedule.h"
Expand Down Expand Up @@ -394,15 +392,6 @@ void openserial_stop() {
case SERFRAME_PC2MOTE_DATA:
openbridge_triggerData();
break;
case SERFRAME_PC2MOTE_TRIGGERTCPINJECT:
tcpinject_trigger();
break;
case SERFRAME_PC2MOTE_TRIGGERUDPINJECT:
udpinject_trigger();
break;
case SERFRAME_PC2MOTE_TRIGGERICMPv6ECHO:
icmpv6echo_trigger();
break;
case SERFRAME_PC2MOTE_TRIGGERSERIALECHO:
//echo function must reset input buffer after reading the data.
openserial_echo(&openserial_vars.inputBuf[1],inputBufFill-1);
Expand Down
3 changes: 0 additions & 3 deletions drivers/common/openserial.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ enum {
#define SERFRAME_PC2MOTE_SETBRIDGE ((uint8_t)'B')
#define SERFRAME_PC2MOTE_SETROOTBRIDGE ((uint8_t)'Z')
#define SERFRAME_PC2MOTE_DATA ((uint8_t)'D')
#define SERFRAME_PC2MOTE_TRIGGERTCPINJECT ((uint8_t)'T')
#define SERFRAME_PC2MOTE_TRIGGERUDPINJECT ((uint8_t)'U')
#define SERFRAME_PC2MOTE_TRIGGERICMPv6ECHO ((uint8_t)'E')
#define SERFRAME_PC2MOTE_TRIGGERSERIALECHO ((uint8_t)'S')

//=========================== typedef =========================================
Expand Down
103 changes: 29 additions & 74 deletions openapps/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,29 @@ localEnv = env.Clone()
target = 'libopenapps'
sources_c = [
os.path.join('openapps.c'),
#os.path.join('heli','heli.c'),
#os.path.join('imu','imu.c'),
os.path.join('layerdebug','layerdebug.c'),
os.path.join('r6t','r6t.c'),
os.path.join('ohlone','ohlone.c'),
os.path.join('ohlone','ohlone_webpages.c'),
os.path.join('rex','rex.c'),
#os.path.join('rheli','rheli.c'),
os.path.join('rinfo','rinfo.c'),
os.path.join('rrt','rrt.c'),
os.path.join('rleds','rleds.c'),
os.path.join('rreg','rreg.c'),
#os.path.join('rrube','rrube.c'),
#os.path.join('rt','rt.c'),
os.path.join('rwellknown','rwellknown.c'),
#os.path.join('rxl1','rxl1.c'),
os.path.join('tcpecho','tcpecho.c'),
os.path.join('tcpinject','tcpinject.c'),
os.path.join('tcpprint','tcpprint.c'),
os.path.join('udpecho','udpecho.c'),
os.path.join('udpinject','udpinject.c'),
os.path.join('udpprint','udpprint.c'),
os.path.join('udprand','udprand.c'),
os.path.join('udplatency','udplatency.c'),
os.path.join('udpstorm','udpstorm.c'),
os.path.join('c6t', 'c6t.c'),
os.path.join('cexample', 'cexample.c'),
os.path.join('cinfo', 'cinfo.c'),
os.path.join('cleds', 'cleds.c'),
os.path.join('cstorm', 'cstorm.c'),
os.path.join('cwellknown', 'cwellknown.c'),
os.path.join('techo', 'techo.c'),
os.path.join('tohlone', 'tohlone.c'),
os.path.join('tohlone', 'tohlone_webpages.c'),
os.path.join('uecho', 'uecho.c'),
]
sources_h = [
os.path.join('openapps.h'),
#os.path.join('heli','heli.h'),
#os.path.join('imu','imu.h'),
os.path.join('layerdebug','layerdebug.h'),
os.path.join('ohlone','ohlone.h'),
os.path.join('ohlone','ohlone_webpages.h'),
os.path.join('r6t','r6t.h'),
os.path.join('rex','rex.h'),
#os.path.join('rheli','rheli.h'),
os.path.join('rinfo','rinfo.h'),
os.path.join('rrt','rrt.h'),
os.path.join('rleds','rleds.h'),
os.path.join('rreg','rreg.h'),
#os.path.join('rrube','rrube.h'),
#os.path.join('rt','rt.h'),
os.path.join('rwellknown','rwellknown.h'),
#os.path.join('rxl1','rxl1.h'),
os.path.join('tcpecho','tcpecho.h'),
os.path.join('tcpinject','tcpinject.h'),
os.path.join('tcpprint','tcpprint.h'),
os.path.join('udpecho','udpecho.h'),
os.path.join('udpinject','udpinject.h'),
os.path.join('udpprint','udpprint.h'),
os.path.join('udprand','udprand.h'),
os.path.join('udplatency','udplatency.h'),
os.path.join('udpstorm','udpstorm.h'),
os.path.join('c6t', 'c6t.h'),
os.path.join('cexample', 'cexample.h'),
os.path.join('cinfo', 'cinfo.h'),
os.path.join('cleds', 'cleds.h'),
os.path.join('cstorm', 'cstorm.h'),
os.path.join('cwellknown', 'cwellknown.h'),
os.path.join('techo', 'techo.h'),
os.path.join('tohlone', 'tohlone.h'),
os.path.join('tohlone', 'tohlone_webpages.h'),
os.path.join('uecho', 'uecho.h'),
]

if localEnv['board']=='python':
Expand All @@ -82,30 +52,15 @@ else:
localEnv.Append(
CPPPATH = [
os.path.join('#','openapps'),
os.path.join('#','openapps','heli'),
os.path.join('#','openapps','imu'),
os.path.join('#','openapps','layerdebug'),
os.path.join('#','openapps','ohlone'),
os.path.join('#','openapps','r6t'),
os.path.join('#','openapps','rex'),
os.path.join('#','openapps','rheli'),
os.path.join('#','openapps','rinfo'),
os.path.join('#','openapps','rrt'),
os.path.join('#','openapps','rleds'),
os.path.join('#','openapps','rreg'),
os.path.join('#','openapps','rrube'),
os.path.join('#','openapps','rt'),
os.path.join('#','openapps','rwellknown'),
os.path.join('#','openapps','rxl1'),
os.path.join('#','openapps','tcpecho'),
os.path.join('#','openapps','tcpinject'),
os.path.join('#','openapps','tcpprint'),
os.path.join('#','openapps','udpecho'),
os.path.join('#','openapps','udpinject'),
os.path.join('#','openapps','udpprint'),
os.path.join('#','openapps','udprand'),
os.path.join('#','openapps','udplatency'),
os.path.join('#','openapps','udpstorm'),
os.path.join('#','openapps','c6t'),
os.path.join('#','openapps','cexample'),
os.path.join('#','openapps','cinfo'),
os.path.join('#','openapps','cleds'),
os.path.join('#','openapps','cstorm'),
os.path.join('#','openapps','cwellknown'),
os.path.join('#','openapps','techo'),
os.path.join('#','openapps','tohlone'),
os.path.join('#','openapps','uecho'),
# openstack
os.path.join('#','openstack','04-TRAN'),
os.path.join('#','openstack','cross-layers'),
Expand Down
2 changes: 1 addition & 1 deletion openapps/c6t/c6t.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void c6t_init() {
c6t_vars.desc.path0val = (uint8_t*)(&c6t_path0);
c6t_vars.desc.path1len = 0;
c6t_vars.desc.path1val = NULL;
c6t_vars.desc.componentID = COMPONENT_R6T;
c6t_vars.desc.componentID = COMPONENT_C6T;
c6t_vars.desc.callbackRx = &c6t_receive;
c6t_vars.desc.callbackSendDone = &c6t_sendDone;

Expand Down
5 changes: 0 additions & 5 deletions openapps/cexample/cexample.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ const uint8_t cexample_path0[] = "ex";

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

typedef struct {
coap_resource_desc_t desc;
opentimer_id_t timerId;
} cexample_vars_t;

cexample_vars_t cexample_vars;

//=========================== prototypes ======================================
Expand Down
5 changes: 5 additions & 0 deletions openapps/cexample/cexample.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

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

typedef struct {
coap_resource_desc_t desc;
opentimer_id_t timerId;
} cexample_vars_t;

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

//=========================== prototypes ======================================
Expand Down
8 changes: 4 additions & 4 deletions openapps/uecho/uecho.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ void uecho_receive(OpenQueueEntry_t* request) {
uint16_t temp_l4_destination_port;
OpenQueueEntry_t* reply;

reply = openqueue_getFreePacketBuffer(COMPONENT_UDPECHO);
reply = openqueue_getFreePacketBuffer(COMPONENT_UECHO);
if (reply==NULL) {
openserial_printError(
COMPONENT_UDPLATENCY,
COMPONENT_UECHO,
ERR_NO_FREE_PACKET_BUFFER,
(errorparameter_t)0,
(errorparameter_t)0
);
return;
}

reply->owner = COMPONENT_UDPECHO;
reply->owner = COMPONENT_UECHO;

// reply with the same OpenQueueEntry_t
reply->creator = COMPONENT_UDPECHO;
reply->creator = COMPONENT_UECHO;
reply->l4_protocol = IANA_UDP;
temp_l4_destination_port = request->l4_destination_port;
reply->l4_destination_port = request->l4_sourcePortORicmpv6Type;
Expand Down
58 changes: 13 additions & 45 deletions openstack/04-TRAN/opentcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
#include "bsp_timer.h"
#include "scheduler.h"
#include "opentimers.h"
//TCP applications
#include "ohlone.h"
#include "tcpecho.h"
#include "tcpinject.h"
#include "tcpprint.h"
// applications
#include "tohlone.h"
#include "techo.h"

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

Expand Down Expand Up @@ -120,16 +118,10 @@ void opentcp_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
tcp_change_state(TCP_STATE_ESTABLISHED);
switch(tcp_vars.myPort) {
case WKP_TCP_HTTP:
ohlone_connectDone(E_SUCCESS);
tohlone_connectDone(E_SUCCESS);
break;
case WKP_TCP_ECHO:
tcpecho_connectDone(E_SUCCESS);
break;
case WKP_TCP_INJECT:
tcpinject_connectDone(E_SUCCESS);
break;
case WKP_TCP_DISCARD:
tcpprint_connectDone(E_SUCCESS);
techo_connectDone(E_SUCCESS);
break;
default:
openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,
Expand All @@ -148,16 +140,10 @@ void opentcp_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
tcp_change_state(TCP_STATE_ESTABLISHED);
switch(tcp_vars.myPort) {
case WKP_TCP_HTTP:
ohlone_receive(tcp_vars.dataReceived);
tohlone_receive(tcp_vars.dataReceived);
break;
case WKP_TCP_ECHO:
tcpecho_receive(tcp_vars.dataReceived);
break;
case WKP_TCP_INJECT:
tcpinject_receive(tcp_vars.dataReceived);
break;
case WKP_TCP_DISCARD:
tcpprint_receive(tcp_vars.dataReceived);
techo_receive(tcp_vars.dataReceived);
break;
default:
openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,
Expand Down Expand Up @@ -253,16 +239,10 @@ void opentcp_receive(OpenQueueEntry_t* msg) {
case TCP_STATE_CLOSED: //[receive] establishement
switch(msg->l4_destination_port) {
case WKP_TCP_HTTP:
shouldIlisten = ohlone_shouldIlisten();
shouldIlisten = tohlone_shouldIlisten();
break;
case WKP_TCP_ECHO:
shouldIlisten = tcpecho_shouldIlisten();
break;
case WKP_TCP_INJECT:
shouldIlisten = tcpinject_shouldIlisten();
break;
case WKP_TCP_DISCARD:
shouldIlisten = tcpprint_shouldIlisten();
shouldIlisten = techo_shouldIlisten();
break;
default:
openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,
Expand Down Expand Up @@ -435,16 +415,10 @@ void opentcp_receive(OpenQueueEntry_t* msg) {
//I receive ACK, data message sent
switch(tcp_vars.myPort) {
case WKP_TCP_HTTP:
ohlone_sendDone(tcp_vars.dataToSend,E_SUCCESS);
tohlone_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
case WKP_TCP_ECHO:
tcpecho_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
case WKP_TCP_INJECT:
tcpinject_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
case WKP_TCP_DISCARD:
tcpprint_sendDone(tcp_vars.dataToSend,E_SUCCESS);
techo_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
default:
openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,
Expand All @@ -458,16 +432,10 @@ void opentcp_receive(OpenQueueEntry_t* msg) {
//I receive FIN[+ACK], I send ACK
switch(tcp_vars.myPort) {
case WKP_TCP_HTTP:
ohlone_sendDone(tcp_vars.dataToSend,E_SUCCESS);
tohlone_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
case WKP_TCP_ECHO:
tcpecho_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
case WKP_TCP_INJECT:
tcpinject_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
case WKP_TCP_DISCARD:
tcpprint_sendDone(tcp_vars.dataToSend,E_SUCCESS);
techo_sendDone(tcp_vars.dataToSend,E_SUCCESS);
break;
default:
openserial_printError(COMPONENT_OPENTCP,ERR_UNSUPPORTED_PORT_NUMBER,
Expand Down
Loading

0 comments on commit dc20927

Please sign in to comment.