Skip to content

Device services

The EdgeX REST and MQTT device services allow for an easy point of integration with this reference design. The above events can be sent to the underlying EdgeX framework using either of these device services.

EdgeX REST Device service

This reference design has configured the EdgeX REST device service to have the following devices which accept the above events.

pos-rest - Accepts the above POS events and defines the following device resources for each POS Event:

  • basket-open
  • scanned-item
  • payment-start
  • payment-success
  • basket-close

scale-rest - Accepts the above Scale events and defines the following device resource for the single Scale Event:

  • weight

cv-roi-rest - Accepts the above CV ROI events and defines the following device resource for the single CV ROI Event:

  • cv-roi-event

rfid-roi-rest- Accepts the above RFID ROI events and defines the following device resource for the single RFID ROI Event:

  • rfid-roi-event

POSTing to EdgeX REST Device Service

This EdgeX REST Device service defines a parametrized endpoint for POSTing the JSON data for the event. This endpoint has the form:

/resource/{device name}/{resource name}

where {device name} is one of the above defined devices and {resource name} is one of the defined resource for that device.

Example URL for POSTing basket-open JSON data:

http://localhost:59986/api/v3/resource/pos-rest/basket-open where the JSON body is:

{
    "lane_id" : "1",
    "basket_id": "abc-012345-def",
    "customer_id": "joe5",
    "employee_id": "mary1",
    "event_time" : 15736013010000
}

EdgeX MQTT Device service

This reference design has configured the EdgeX MQTT device service to have the following devices which accept the above events.

pos-mqtt - Accepts the above POS events and defines the following device commands for each POS Event:

  • basket-open
  • scanned-item
  • payment-start
  • payment-success
  • basket-close

scale-mqtt - Accepts the above Scale events and defines the following device command for the single Scale Event:

  • weight

cv-roi-mqtt - Accepts the above ROI events and defines the following device command for the single CV ROI Event:

  • cv-roi-event

rfid-roi-mqtt Accepts the above RFID events and defines the following device command for the single RFID ROI Event:

  • rfid-roi-event

Publishing to EdgeX MQTT Device Service

This EdgeX MQTT Device service accepts events published to the edgex/# topic. Events published to this topic must conform to the follow JSON schema:

{
    "name" : "<device name>",
    "cmd" : "<command name>",
    "<command name>" : "<event data json>"
}

where <device name> is one of the above defined devices and <command name> is one of the defined commands for that device and <event data json> is a string containing the event data JSON, i.e not embedded JSON.

Example JSON for publishing weight data:

{
    "name" : "scale-mqtt",
    "cmd" : "weight",
    "weight" : "{\"lane_id\":\"1\",\"ScaleId\":\"abc123\",\"total\":3.25,\"delta\":1.15,\"units\":\"lbs\",\"event_time\":15736013940000}"
}