Setting Measure Points and Invoking Services


Applications can use EnOS open APIs to set measurement points or invoke services for the devices connected via CoAP. The process is shown below.

../../../_images/coap_downstream_flow.png


For more information about the data formats of the request and response, and parameter description, see Invoke Device Services (Pass-through).


When an application calls an API to set measurement points or invoke services from a device, EnOS caches this request. When a device sends a request to EnOS, EnOS will include the request sent by the application in the response to the device’s request, in the form of an Option (2100) that is EnOS-defined.


The format of the response sent to the device by EnOS is as follows:

Code: CoAP return code
Payload: {RequestPayload}
Customized Option 2100: /topic/{RequestTopic}


The application sends a request to invoke services after the device receives the response with option.


The format of the request to query the invoked service is as follows:
GET /topic/{RequestTopic}

And the response to the previous request:

Code: CoAP return code
Payload:


If there are more services to be invoked, EnOS will also include the Option (2100) in the responses. The device will also repeat the process of sending the request to query the service invoked.


After the measurement points are set or services are invoked, the device will send the execution results to EnOS according to the response topic and the data format defined by EnOS.