NanoService Example for u-blox Cellular modems
Dependencies: Beep LM75B MMA7660 mbed nsdl_lib
Fork of NSDL_HelloWorld by
Diff: main.cpp
- Revision:
- 9:ccb9e53d5471
- Parent:
- 8:8452c1eaa690
- Child:
- 11:3b7ae478dcd1
diff -r 8452c1eaa690 -r ccb9e53d5471 main.cpp
--- a/main.cpp Mon Oct 28 19:38:15 2013 +0000
+++ b/main.cpp Wed Oct 30 00:32:48 2013 +0000
@@ -5,21 +5,21 @@
#include "Socket.h"
#include "Endpoint.h"
#include "UDPSocket.h"
-#include "C12832_lcd.h"
+// #include "C12832_lcd.h"
#include "nsdl_support.h"
-#include "dbg.h"
// Include various resources
#include "temperature.h"
#include "light.h"
#include "gps.h"
#include "relay.h"
-static C12832_LCD lcd;
-Serial pc(USBTX, USBRX); // tx, rx
+// static C12832_LCD lcd;
// ****************************************************************************
// Configuration section
+#define MODEM_UBLOX_CDMA
+
#ifndef MODEM_APN
#warning APN not specified, using "internet"
#define MODEM_APN "internet"
@@ -72,9 +72,9 @@
int ret = modem.connect(MODEM_APN, MODEM_USERNAME, MODEM_PASSWORD);
if(ret)
{
- NSDL_DEBUG("Could not connect\n");
+ printf("Could not connect\n");
}
- NSDL_DEBUG("Connection OK\n");
+ printf("Connection OK\n");
mbed_interface_uid(mbed_uid);
mbed_uid[32] = '\0';
@@ -93,11 +93,11 @@
nsp.set_address(NSP_ADDRESS, NSP_PORT);
- NSDL_DEBUG("name: %s", endpoint_name);
- NSDL_DEBUG("NSP=%s - port %d\n", NSP_ADDRESS, NSP_PORT);
+ printf("name: %s", endpoint_name);
+ printf("NSP=%s - port %d\n", NSP_ADDRESS, NSP_PORT);
- lcd.locate(0,22);
- lcd.printf("EP name:%s\n", endpoint_name);
+ // lcd.locate(0,22);
+ // lcd.printf("EP name:%s\n", endpoint_name);
}
// ****************************************************************************
@@ -108,7 +108,7 @@
sn_nsdl_resource_info_s *resource_ptr = NULL;
sn_nsdl_ep_parameters_s *endpoint_ptr = NULL;
- NSDL_DEBUG("Creating resources");
+ printf("Creating resources");
/* Create resources */
resource_ptr = (sn_nsdl_resource_info_s*)nsdl_alloc(sizeof(sn_nsdl_resource_info_s));
@@ -137,9 +137,9 @@
/* Register with NSP */
endpoint_ptr = nsdl_init_register_endpoint(endpoint_ptr, (uint8_t*)endpoint_name, ep_type, lifetime_ptr);
if(sn_nsdl_register_endpoint(endpoint_ptr) != 0)
- pc.printf("NSP registering failed\r\n");
+ printf("NSP registering failed\r\n");
else
- pc.printf("NSP registering OK\r\n");
+ printf("NSP registering OK\r\n");
nsdl_clean_register_endpoint(&endpoint_ptr);
nsdl_free(resource_ptr->resource_parameters_ptr);
@@ -152,10 +152,10 @@
int main()
{
- lcd.cls();
- lcd.locate(0,0);
- lcd.printf("mbed NanoService u-blox");
- NSDL_DEBUG("mbed NanoService u-blox Example App 0.1\n");
+ // lcd.cls();
+ // lcd.locate(0,0);
+ // lcd.printf("mbed NanoService u-blox");
+ printf("mbed NanoService u-blox Example App 0.1\n");
// Initialize Cellular interface first
cellular_init();



