You are on page 1of 3

10/17/2017 Sensor Management

(/en/ict/) (/en/ict/)

Home (/en/ict) IoT (/en/ict/Products/IoT2) Sensor Management (/en/ict/Products/IoT2/Gateway/SensorMgnt/SDK)

1. Summary
The gateway manages online and offline messages of sensors

2. The gateway registers a sensor


After detecting the access of a sensor, the gateway registers the sensor with Huawei IoT platform by invoking the sensor registration function
provided by the SDK.

Function prototype:

INT RiverAddSensor(CHAR *PhyId, CHAR *Name, CHAR *Type, CHAR *Manufacturer, CHAR *SubsId, CHAR *Location, CHAR *Status);

Parameter Description

Parameter Mandatory/Optional Type Description

PhyId Mandatory CHAR * Sensor ID, used to identify a sensor. The sensor ID
must be unique and can be set to the MAC address of
the sensor.

Name Optional CHAR * Sensor name

Type Mandatory CHAR * Sensor type

Manufacturer Optional CHAR * Sensor vendor

SubsId Optional CHAR * Sensor user ID

Location Optional CHAR * Sensor location

Status Optional CHAR * Sensor status

Execution Results

Field Description

OK Success

FAILED Failure

For example, if the gateway needs to register a smart lamp with the physical address 58bOK-35f7-6e65 in the IoT system, the following
function, of which the PhyId and Type fields are mandatory parameters and others are optional, is invoked:

RiverAddSensor("58bOK-35f7-6e65", "Out door light", "light", "huawei", "Alice", "Shenzhen", "normal");

3. The gateway updates the sensor status

http://developer.huawei.com/en/ict/Products/IoT2/Gateway/SensorMgnt/SDK 1/3
10/17/2017 Sensor Management
When the gateway detects that the sensor is inactive, for example, because no sensor battery is installed, the gateway invokes the
RiverUpdateSensor (CHAR *PhyId, CHAR *Data) interface to inform the SDK that the sensor is offline. After the gateway is restarted or the
sensor becomes online, the gateway invokes the RiverUpdateSensor interface to inform the SDK that the sensor is online.

Function prototype:

INT RiverUpdateSensor(CHAR *PhyId, CHAR *Data);

Parameter Description

Parameter Mandatory/Optional Type Description

PhyId Mandatory CHAR * Sensor ID.

Status Mandatory CHAR * Sensor status, online or offline.

Execution Results

Field Description

OK Success

FAILED Failure

For example, when an added smart lamp is offline, the following function is invoked:

RiverRmvSensor ("58bOK-35f7-6e65");

Quick Links
RemoteLab (http://developer.huawei.com/en/ict/remotelab)

Developer Tools (http://developer.huawei.com/en/ict/tool/)

Marketplace (http://developer.huawei.com/en/ict/marketplace/home/)

Training (http://developer.huawei.com/en/ict/training)

Information For
Enterprises (http://e.huawei.com/en/)

Carriers (http://carrier.huawei.com/en/)

Consumers (http://consumer.huawei.com/en/)

Friendship Links

Others
GitHub (https://github.com/esdk)

Contact Us (mailto:esdk@huawei.com?subject=I want to feedback. &body=Please drop your comments below: (Come from the page of
:http://developer.huawei.com/en/ict/Products/IoT2/Gateway/SensorMgnt/SDK))

Privacy (http://developer.huawei.com/en/ict/site-static/privacy) |
Terms of Use (http://developer.huawei.com/en/ict/site-static/terms_of_use)

http://developer.huawei.com/en/ict/Products/IoT2/Gateway/SensorMgnt/SDK 2/3
10/17/2017 Sensor Management

http://developer.huawei.com/en/ict/Products/IoT2/Gateway/SensorMgnt/SDK 3/3

You might also like