ublox-cellular-psm-mnofix
Dependencies: ublox-at-cellular-interface ublox-cellular-base ublox-cellular-base-n2xx ublox-at-cellular-interface-n2xx
Revision 4:574b2be59d12, committed 2019-11-05
- Comitter:
- qasim-ublox
- Date:
- Tue Nov 05 16:36:31 2019 +0500
- Parent:
- 3:6debe6b322c4
- Commit message:
- Updated Libraries and application.
Changed in this revision
diff -r 6debe6b322c4 -r 574b2be59d12 main.cpp --- a/main.cpp Thu Oct 31 07:31:20 2019 +0000 +++ b/main.cpp Tue Nov 05 16:36:31 2019 +0500 @@ -51,7 +51,6 @@ #define APN NULL #define USERNAME NULL #define PASSWORD NULL -#define TCP_SERVER "os.mbed.com" // Uncomment the following line to enable Icellular Current measurement. // Current drawn by modem is printed on serial every 2 seconds. @@ -216,13 +215,10 @@ // INTERFACE_CLASS *interface = new INTERFACE_CLASS(MDMTXD, MDMRXD, // xxx, // true); -#ifndef TARGET_UBLOX_C030_N211 - TCPSocket sockTcp; -#endif + UDPSocket sockUdp; SocketAddress udpServer; SocketAddress udpSenderAddress; - SocketAddress tcpServer; char buf[1024]; int x; #ifdef TARGET_UBLOX_C027 @@ -275,6 +271,7 @@ print_function("please wait up to 180 seconds for network registration to complete...\n"); //try to re-init modem and perform registration + interface->set_credentials(APN, USERNAME, PASSWORD); for (x = 0; interface->connect(PIN) != 0; x++) { if (x > 0) { bad(); @@ -297,15 +294,12 @@ } #endif - print_function("\nGetting the IP address of \"" TCP_SERVER "\" and \"2.pool.ntp.org\"...\n"); - if ((interface->gethostbyname("2.pool.ntp.org", &udpServer) == 0) && - (interface->gethostbyname(TCP_SERVER, &tcpServer) == 0)) { + print_function("\nGetting the IP address of \"2.pool.ntp.org\"...\n"); + if ((interface->gethostbyname("2.pool.ntp.org", &udpServer) == 0)) { pulseEvent(); udpServer.set_port(123); print_function("\"2.pool.ntp.org\" address: %s on port %d.\n", udpServer.get_ip_address(), udpServer.get_port()); - print_function("\"" TCP_SERVER "\" address: %s on port %d.\n", tcpServer.get_ip_address(), tcpServer.get_port()); - tcpServer.set_port(80); print_function("Performing socket operations in a loop (until the user button is pressed on C030 or forever on C027)...\n"); while (!buttonPressed) { @@ -346,39 +340,6 @@ pulseEvent(); print_function("Socket closed.\n"); } -#ifndef TARGET_UBLOX_C030_N211 - print_function("Opening a TCP socket...\n"); - if ((sockTcp.open(interface)) == 0) { - // TCP Sockets - pulseEvent(); - print_function("TCP socket open.\n"); - sockTcp.set_timeout(10000); - print_function("Connecting socket to %s on port %d...\n", tcpServer.get_ip_address(), tcpServer.get_port()); - if (sockTcp.connect(tcpServer) == 0) { - pulseEvent(); - print_function("Connected, sending HTTP GET request to \"developer.mbed.org\" over socket...\n"); - strcpy (buf, "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\r\n\r\n"); - // Note: since this is a short string we can send it in one go as it will - // fit within the default buffer sizes. Normally you should call sock.send() - // in a loop until your entire buffer has been sent. - if (sockTcp.send((void *) buf, strlen(buf)) == (int) strlen(buf)) { - pulseEvent(); - print_function("Socket send completed, waiting for response...\n"); - x = sockTcp.recv(buf, sizeof (buf)); - if (x > 0) { - pulseEvent(); - print_function("Received %d byte response from server on TCP socket:\n" - "----------------------------------------------------\n%.*s" - "----------------------------------------------------\n", - x, x, buf); - } - } - } - print_function("Closing socket...\n"); - sockTcp.close(); - pulseEvent(); - print_function("Socket closed.\n"); - } #ifdef TARGET_UBLOX_C030_R412M while(modem_asleep == false) { //modem is awake, let it go to sleep again print_function("Waiting for modem to go to PSM sleep\n"); @@ -386,7 +347,7 @@ } } #endif /* TARGET_UBLOX_C030_R412M */ -#endif /* TARGET_UBLOX_C030_N211 */ + wait_ms(5000); #ifndef TARGET_UBLOX_C027 @@ -401,7 +362,7 @@ print_function("Stopped.\n"); } else { bad(); - print_function("Unable to get IP address of \"developer.mbed.org\" or \"2.pool.ntp.org\".\n"); + print_function("Unable to get IP address of \"2.pool.ntp.org\".\n"); } }
diff -r 6debe6b322c4 -r 574b2be59d12 ublox-at-cellular-interface.lib --- a/ublox-at-cellular-interface.lib Thu Oct 31 07:31:20 2019 +0000 +++ b/ublox-at-cellular-interface.lib Tue Nov 05 16:36:31 2019 +0500 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#3d709ee8c3e1 +https://developer.mbed.org/teams/ublox/code/ublox-at-cellular-interface/#0ceb2dfc746c
diff -r 6debe6b322c4 -r 574b2be59d12 ublox-cellular-base.lib --- a/ublox-cellular-base.lib Thu Oct 31 07:31:20 2019 +0000 +++ b/ublox-cellular-base.lib Tue Nov 05 16:36:31 2019 +0500 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ublox/code/ublox-cellular-base/#e67d3d9d2e7e +https://developer.mbed.org/teams/ublox/code/ublox-cellular-base/#24f29bf0d810