Updated on 2023-02-16 GMT+08:00

Device Reporting the Upgrade Status

Function

This API is used by a device to report the upgrade status.

Topic

Upstream: $oc/devices/{device_id}/sys/events/up

Parameters

Parameter

Mandatory or Optional

Type

Description

object_device_id

Optional

String

Indicates the device that the event is about. If this parameter is not carried, the device specified in the topic is considered to be the device involved.

services

Optional

List<ServiceEvent>

Indicates a list of services that the event is about.

ServiceEvent structure

Parameter

Mandatory or Optional

Type

Description

service_id

Mandatory

String

System field. The value is fixed to $ota.

event_type

Mandatory

String

System field. The value is fixed to upgrade_progress_report.

event_time

Optional

String

Indicates the time when the event occurs.

paras

Mandatory

Object

Indicates the event parameters in JSON format.

paras structure

Parameter

Mandatory or Optional

Type

Description

result_code

Mandatory

Integer

Indicates the device upgrade status.

  • 0: successful upgrade
  • 1: device in use
  • 2: poor signal
  • 3: already the latest version
  • 4: low battery
  • 5: insufficient storage space
  • 6: download timeout
  • 7: upgrade package verification failure
  • 8: unsupported upgrade package type
  • 9: insufficient memory
  • 10: upgrade package installation failure
  • 255: internal exception

progress

Optional

Integer

Indicates the device upgrade progress. The value ranges from 0 to 100.

version

Mandatory

String

Indicates the current version of the device. (The version reported after the upgrade must be the same as that set in IoTDA when you upload the software or firmware package.)

description

Optional

String

Describes the upgrade status, such as the cause for upgrade failure.

Example

Topic: $oc/devices/{device_id}/sys/events/up  
Data format:
{
    "object_device_id": "{object_device_id}",
    "services": [{
        "service_id": "$ota",
        "event_type": "upgrade_progress_report",
        "event_time": "20151212T121212Z",
        "paras": {
            "result_code": 0,
            "progress": 80,
            "version": "V2.0",
            "description": "upgrade processing"
        }
    }]
}