cc3000 hostdriver with the mbed socket interface. Hacked TCP Classes for better control of non-blocking sockets.

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Files at this revision

API Documentation at this revision

Comitter:
mfurseman
Date:
Fri Oct 31 19:44:52 2014 +0000
Parent:
48:1e6068103f0b
Commit message:
Hacked _closed_sockets to public and used it for socket

Changed in this revision

Socket/TCPSocketConnection.cpp Show annotated file Show diff for this revision Revisions of this file
Socket/TCPSocketServer.cpp Show annotated file Show diff for this revision Revisions of this file
cc3000.cpp Show annotated file Show diff for this revision Revisions of this file
cc3000.h Show annotated file Show diff for this revision Revisions of this file
--- a/Socket/TCPSocketConnection.cpp	Mon Oct 27 20:27:28 2014 +0000
+++ b/Socket/TCPSocketConnection.cpp	Fri Oct 31 19:44:52 2014 +0000
@@ -42,6 +42,8 @@
         close();
         return -1;
     }
+    
+    _cc3000_module->_closed_sockets[0] = false;
 
     return 0;
 }
@@ -50,6 +52,10 @@
     if (_sock_fd < 0) {
         return -1;
     }
+    
+    if(_cc3000_module->_closed_sockets[0]) {
+        return -1;
+    }
 
     if (!_blocking) {
         TimeInterval timeout(_timeout);
@@ -67,6 +73,10 @@
     if (_sock_fd < 0) {
         return -1;
     }
+    
+    if(_cc3000_module->_closed_sockets[0]) {
+        return -1;
+    }
 
     int writtenLen = 0;
     TimeInterval timeout(_timeout);
@@ -96,6 +106,10 @@
     if (_sock_fd < 0) {
         return -1;
     }
+    
+    if(_cc3000_module->_closed_sockets[0]) {
+        return -1;
+    }
 
     if (!_blocking) {
         TimeInterval timeout(_timeout);
@@ -112,6 +126,10 @@
     if (_sock_fd < 0) {
         return -1;
     }
+    
+    if(_cc3000_module->_closed_sockets[0]) {
+        return -1;
+    }
 
     int readLen = 0;
     TimeInterval timeout(_timeout);
--- a/Socket/TCPSocketServer.cpp	Mon Oct 27 20:27:28 2014 +0000
+++ b/Socket/TCPSocketServer.cpp	Fri Oct 31 19:44:52 2014 +0000
@@ -78,6 +78,8 @@
     /* s_addr is returned in the little endian */
     connection._remote_host.sin_addr.s_addr = htonl(connection._remote_host.sin_addr.s_addr);
     connection._sock_fd = fd;
+    
+    _cc3000_module->_closed_sockets[0] = false;
 
     return 0;
 }
--- a/cc3000.cpp	Mon Oct 27 20:27:28 2014 +0000
+++ b/cc3000.cpp	Fri Oct 31 19:44:52 2014 +0000
@@ -1,3 +1,4 @@
+
 /*****************************************************************************
 *
 *  C++ interface/implementation created by Martin Kojtal (0xc0170). Thanks to
--- a/cc3000.h	Mon Oct 27 20:27:28 2014 +0000
+++ b/cc3000.h	Fri Oct 31 19:44:52 2014 +0000
@@ -1771,6 +1771,7 @@
     cc3000_nvmem        _nvmem;
     cc3000_netapp       _netapp;
     cc3000_wlan         _wlan;
+    bool                _closed_sockets[MAX_SOCKETS];
 #ifndef CC3000_UNENCRYPTED_SMART_CONFIG
     cc3000_security     _security;
 #endif
@@ -1779,7 +1780,6 @@
 private:
     tStatus                  _status;
     netapp_pingreport_args_t _ping_report;
-    bool                     _closed_sockets[MAX_SOCKETS];
 #if (CC3000_ETH_COMPAT == 1)
     uint8_t                  _phrase[30];
     uint8_t                  _ssid[30];