Linux Driver

2016年8月7日 星期日

ARM mbed client Code

What is mbed client?

ARM mbed Client is a library that provides the means to connect constrained embedded devices to mbed Device Connector Service, mbed Device Server and to mbed-enabled cloud services from our partners.

  • Manage devices on mbed Device Server.
  • Securely communicate with internet services over the industry standard TLS/DTLS.
  • Fully control the endpoint and application logic.

M2MInterface  --> register_object()          ----callback--> object_register()
                               unregistered_object()  ----callback--> object_unregister()
                               update_registration()    ----callback--> registration_updated()

M2MInterfaceObserver 類別上的5個Callback函式列表

virtual void bootstrap_done (M2MSecurity *server_object)=0
A callback indicating that the bootstap has been performed successfully. More...
virtual void object_registered (M2MSecurity *security_object, const M2MServer &server_object)=0
A callback indicating that the device object has been registered successfully to the LWM2M server. More...
virtual void object_unregistered (M2MSecurity *server_object)=0
A callback indicating that the device object has been successfully unregistered from the LWM2M server. More...
virtual void registration_updated (M2MSecurity *security_object, const M2MServer &server_object)=0
A callback indicating that the device object registration has been successfully updated on the LWM2M server. More...
virtual void error (M2MInterface::Error error)=0
A callback indicating that there was an error during the operation. More...
virtual void value_updated (M2MBase *base, M2MBase::BaseType type)=0
A callback indicating that the value of the resource object is updated by the server.Whenever there is a valid PUT operation for any of the resources, the application will receive a callback:

void error(M2MInterface::Error error){
        _error = true;
        String error_code;
switch(error) {
        case M2MInterface::ErrorNone:
             error_code += "M2MInterface::ErrorNone";
        case M2MInterface::AlreadyExists:
             error_code += "M2MInterface::AlreadyExists";


        printf("\nError occured  : %s\n", error_code.c_str());

There are two types of resources you can create
Dynamic: 值會改變, 當server 請求時要負責傳回值
Static: 值不改變
 configure different types of Objects, Object Instances and Resources 

mbed Client supports the following three features introduced in the subsequent chapters:

mbed docs

  1. ARM mbed Client Guide
  2. ARM mbed Client API

沒有留言 :