Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: cc3000_hello_world_demo cc3000_simple_socket_demo cc3000_ntp_demo cc3000_ping_demo ... more
Diff: Socket/Socket.cpp
- Revision:
- 13:5e36c267e62f
- Parent:
- 11:5e3771b29385
- Child:
- 16:f3676ae62f96
--- a/Socket/Socket.cpp	Tue Oct 01 21:17:44 2013 +0000
+++ b/Socket/Socket.cpp	Wed Oct 02 15:00:07 2013 +0000
@@ -28,22 +28,17 @@
 
 int Socket::init_socket(int type, int protocol) {
     if (_sock_fd != -1) {
-#if (CC3000_DEBUG == 1)
-        printf("DEBUG: Socket was initialized previously.\r\n");
-#endif
+        DBG_SOCKET("Socket was initialized previously");
         return -1;
     }
 
     int fd = _cc3000_module->_socket.socket(AF_INET, type, protocol);
     if (fd < -1) {
-#if (CC3000_DEBUG == 1)
-        printf("DEBUG: Failed to create new socket (type: %d, protocol: %d).\r\n",type, protocol);
-#endif
+        DBG_SOCKET("Failed to create new socket (type: %d, protocol: %d)",type, protocol);
         return -1;
     }
-#if (CC3000_DEBUG == 1)
-        printf("DEBUG: Socket created (fd: %d type: %d, protocol: %d).\r\n",fd, type, protocol);
-#endif
+    
+    DBG_SOCKET("Socket created (fd: %d type: %d, protocol: %d)",fd, type, protocol);
     _sock_fd = fd;
 
     return 0;
@@ -75,9 +70,9 @@
     fd_set* writeset = (write) ? (&fdSet) : (NULL);
 
     int ret = _cc3000_module->_socket.select(_sock_fd+1, readset, writeset, NULL, timeout);
-#if (CC3000_DEBUG == 1)
-    printf("DEBUG: Select on sock_fd: %d, returns %d. fdSet: %d\r\n",_sock_fd, ret, fdSet);
-#endif
+
+    DBG_SOCKET("Select on sock_fd: %d, returns %d. fdSet: %d", _sock_fd, ret, fdSet);
+
     // TODO
     //return (ret <= 0 || !FD_ISSET(_sock_fd, &fdSet)) ? (-1) : (0);
     if (FD_ISSET(_sock_fd, &fdSet)) {
     SimpleLink Wi-Fi CC3000
            SimpleLink Wi-Fi CC3000
         Avnet Wi-Go System
            Avnet Wi-Go System