NanoService Example for u-blox Cellular modems
Dependencies: Beep LM75B MMA7660 mbed nsdl_lib
Fork of NSDL_HelloWorld by
Revision 7:6b068978be9a, committed 2013-10-22
- Comitter:
- bogdanm
- Date:
- Tue Oct 22 10:50:05 2013 +0000
- Parent:
- 6:442775856f5f
- Child:
- 8:8452c1eaa690
- Commit message:
- Endpoint names are no longer constrained to a fixed length. Also changed default prefix to "mbed-" instead of "mbed-demo-"
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| nsdl_support.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 21 21:30:05 2013 +0000
+++ b/main.cpp Tue Oct 22 10:50:05 2013 +0000
@@ -28,7 +28,7 @@
/* Change this IP address to that of your NanoService Platform installation */
static const char* NSP_ADDRESS = "217.140.101.20"; /* demo NSP, web interface at http://nanoservice-demo.mbed.org*/
static const int NSP_PORT = 5683;
-char endpoint_name[16] = "mbed-demo-";
+char endpoint_name[16] = "mbed-";
uint8_t ep_type[] = {"mbed_device"};
uint8_t lifetime_ptr[] = {"1200"};
@@ -53,7 +53,7 @@
mbed_interface_uid(mbed_uid);
mbed_uid[32] = '\0';
- memcpy(&endpoint_name[10], &mbed_uid[27], 6);
+ strncat(endpoint_name, mbed_uid + 27, 15 - strlen(endpoint_name));
lcd.locate(0,11);
lcd.printf("IP:%s", eth.getIPAddress());
--- a/nsdl_support.cpp Mon Oct 21 21:30:05 2013 +0000
+++ b/nsdl_support.cpp Tue Oct 22 10:50:05 2013 +0000
@@ -69,7 +69,7 @@
{
memset(endpoint_structure, 0, sizeof(sn_nsdl_ep_parameters_s));
endpoint_structure->endpoint_name_ptr = name;
- endpoint_structure->endpoint_name_len = 15;
+ endpoint_structure->endpoint_name_len = strlen((char*)name);
endpoint_structure->type_ptr = typename_ptr;
endpoint_structure->type_len = strlen((char*)typename_ptr);
endpoint_structure->lifetime_ptr = lifetime_ptr;



