com.ibm.wiotp.sdk.devicemgmt.internal.handler

Class DeviceUpdateRequestHandler

  • All Implemented Interfaces:
    org.eclipse.paho.client.mqttv3.IMqttMessageListener


    public class DeviceUpdateRequestHandler
    extends DMRequestHandler

    Update device attributes
    Watson IoT Platform can send this request to a device to update values of one or more device attributes. Supported update targets are location, metadata, device information and firmware.

    Topic
    iotdm-1/device/update

    Message format
    Request:
    {
    "d": {
    "value": { }
    },
    "reqId": "string"
    }

    "value" is the new value of the device attribute.
    It is a complex field matching the device model.
    Only writeable fields should be updated as a result of this operation.
    Values can be updated in:

    • location (see Update location section for details)
    • metadata (Optional)
    • deviceInfo (Optional)
    • mgmt.firmware (see Firmware update process for details)


    Response:
    {
    "rc": number,
    "message": "string",
    "d": {
    "fields": [
    "string"
    ]
    },
    "reqId": "string"
    }

    "message" field can be specified if "rc" is not 200.
    If any field value could not be retrieved,
    "rc" should be set to 404 (if not found) or 500 (any other reason).
    "fields" array should contain the name of each field that could not be updated.
    • Constructor Detail

      • DeviceUpdateRequestHandler

        public DeviceUpdateRequestHandler(ManagedClient dmClient)
    • Method Detail

      • handleRequest

        public void handleRequest(com.google.gson.JsonObject jsonRequest,
                                  String topic)
        This method handles all the update requests from IBM Watson IoT Platform
        Specified by:
        handleRequest in class DMRequestHandler

Copyright © 2019. All rights reserved.