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.
Dependencies: mbed SocketModem nanoservice_client_1_12
Diff: main.cpp
- Revision:
- 3:1e981a0aebfb
- Parent:
- 2:1592223f12e1
- Child:
- 4:5bfd59673a99
diff -r 1592223f12e1 -r 1e981a0aebfb main.cpp
--- a/main.cpp Mon Feb 17 22:42:20 2014 +0000
+++ b/main.cpp Mon Feb 17 22:50:23 2014 +0000
@@ -8,6 +8,8 @@
#include "IPStack.h"
#include "MTSSerialFlowControl.h"
+// NanoService includes
+
using namespace mts;
Cellular* cellular;
@@ -78,6 +80,29 @@
DEBUG("TCP connection to NSP successful.");
}
+void socket_event_loop()
+{
+ //sn_nsdl_addr_s received_packet_address;
+ //uint8_t received_address[4];
+ char buffer[2048];
+
+ //memset(&received_packet_address, 0, sizeof(sn_nsdl_addr_s));
+ //received_packet_address.addr_ptr = received_address;
+
+ while(1)
+ {
+ int n = cellular->read(buffer, sizeof(buffer), -1);
+ if (n < 0)
+ {
+ DEBUG("Socket error\n\r");
+ }
+ else
+ {
+ DEBUG("Received %d bytes\r\n", n);
+ //sn_nsdl_process_coap((uint8_t*)buffer, n, &received_packet_address);
+ }
+ }
+}
int main()
{
@@ -90,4 +115,8 @@
// Bind the socket and configure NSP settings
nsp_init();
+ // Start socket listening loop
+ socket_event_loop();
+
+
}
