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: EthernetInterface PololuLedStripx mbed-rtos mbed nanoservice_client_1_12_X
Fork of LPC1768_LWM2M_Client by
Revision 5:fcfba34d1aeb, committed 2014-09-28
- Comitter:
- michaeljkoster
- Date:
- Sun Sep 28 03:12:33 2014 +0000
- Parent:
- 4:71b211dbe14c
- Child:
- 6:30232e15ea5f
- Commit message:
- EP name from IP address
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Sep 28 01:00:23 2014 +0000
+++ b/main.cpp Sun Sep 28 03:12:33 2014 +0000
@@ -11,8 +11,6 @@
//#define LED_COUNT 120
rgb_color colors[LED_COUNT];
-extern "C" void mbed_mac_address(char *mac);
-
Serial pc(USBTX, USBRX); // tx, rx
// ****************************************************************************
@@ -67,6 +65,8 @@
UDPSocket server;
Endpoint nsp;
+char * ipstring;
+char * uid;
static void nsp_init()
{
@@ -75,9 +75,18 @@
nsp.set_address(NSP_ADDRESS, NSP_PORT);
- mbed_mac_address(mac);
- sprintf(macstring, "%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- strncat(endpoint_name, macstring, 12);
+ ipstring = eth.getIPAddress();
+ uid = ipstring;
+
+ while(*ipstring)
+ {
+ if(*ipstring =='.')
+ *ipstring='-';
+ ipstring++;
+
+ }
+ strncat( endpoint_name, uid, strlen(uid) );
+ pc.printf("\r\nep name: %s\r\n", endpoint_name);
NSDL_DEBUG("name: %s", endpoint_name);
NSDL_DEBUG("NSP=%s - port %d\n", NSP_ADDRESS, NSP_PORT);
