Radio Structures in OOP

Dependencies:   mbed mbed-rtos

Revision:
5:146523a0d1f4
Parent:
4:989d51f3e6ef
Child:
6:4a3dbfbc30f1
diff -r 989d51f3e6ef -r 146523a0d1f4 modules/CommModule/CommModule.cpp
--- a/modules/CommModule/CommModule.cpp	Sat Jan 03 11:04:31 2015 +0000
+++ b/modules/CommModule/CommModule.cpp	Wed Jan 14 17:46:44 2015 +0000
@@ -28,7 +28,6 @@
     _rxID = osThreadCreate(&_rxDef, (void*)this);
 
     _txH_called = false;
-    _rxH_called = false;
 }
 
 CommModule::~CommModule()
@@ -103,6 +102,7 @@
             EVENT("Reception: \r\n  Port: %u\r\n  Subclass: %u\r\n", p->port, p->subclass);
 
             osMailFree(inst->_rxQueue, p);  // free memory allocated for mail
+            
         }
     }
 }
@@ -116,14 +116,12 @@
 
 void CommModule::RxHandler(void(*ptr)(RTP_t*), uint8_t portNbr)
 {
-    _rxH_called = true;
     ready();
     _rx_handles[portNbr].attach(ptr);
 }
 
 void CommModule::RxHandler(void(*ptr)(void), uint8_t portNbr)
 {
-    _rxH_called = true;
     ready();
     _rx_handles[portNbr].attach(ptr);
 }
@@ -132,7 +130,7 @@
 void CommModule::openSocket(CommLink *link, void(*rx)(void const *arg), uint8_t portNbr)
 {
     ready();
-    if (_txH_called & _rxH_called) {
+    if (_txH_called) {
         if (std::binary_search(_open_ports->begin(), _open_ports->end(), portNbr)) {
             WARNING("Port number %u already binded to open socket.\r\n", portNbr);
         } else {
@@ -156,7 +154,7 @@
 void CommModule::openSocket(uint8_t portNbr)
 {
     ready();
-    if (_txH_called & _rxH_called) {
+    if (_txH_called) {
         if (std::binary_search(_open_ports->begin(), _open_ports->end(), portNbr)) {
             WARNING("Port number %u already opened.\r\n", portNbr);
         } else {