
This is a simple mbed client example demonstrating, registration of a device with mbed Device Connector and reading and writing values as well as deregistering on different Network Interfaces including Ethernet, WiFi, 6LoWPAN ND and Thread respectively.
Fork of mbed-os-example-client by
Revision 59:b2569564d62c, committed 2017-01-27
- Comitter:
- mbed_official
- Date:
- Fri Jan 27 14:45:11 2017 +0000
- Parent:
- 58:e5468bc5bf9a
- Child:
- 60:64b1819f4793
- Commit message:
- Fix the cert len in simpleclient.h (#170)
The set_resource_value function will automatically add the null termination ('\0'). To avoid getting two of them added - 1 to after the sizeof in function create_register_object in file simpleclient.h.
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-client
Changed in this revision
simpleclient.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/simpleclient.h Thu Jan 26 14:30:12 2017 +0000 +++ b/simpleclient.h Fri Jan 27 14:45:11 2017 +0000 @@ -174,9 +174,9 @@ // Add ResourceID's and values to the security ObjectID/ObjectInstance security->set_resource_value(M2MSecurity::M2MServerUri, _server_address); security->set_resource_value(M2MSecurity::SecurityMode, M2MSecurity::Certificate); - security->set_resource_value(M2MSecurity::ServerPublicKey, SERVER_CERT, sizeof(SERVER_CERT)); - security->set_resource_value(M2MSecurity::PublicKey, CERT, sizeof(CERT)); - security->set_resource_value(M2MSecurity::Secretkey, KEY, sizeof(KEY)); + security->set_resource_value(M2MSecurity::ServerPublicKey, SERVER_CERT, sizeof(SERVER_CERT) - 1); + security->set_resource_value(M2MSecurity::PublicKey, CERT, sizeof(CERT) - 1); + security->set_resource_value(M2MSecurity::Secretkey, KEY, sizeof(KEY) - 1); } return security; }