Appearance
Device Authorization API
Device Authorization API Overview
| Function | Description |
|---|---|
| Ql_iotDBindcodeSet() | Sets device bind code. |
| Ql_iotDBindcodeGet() | Gets device bind code. |
| Ql_iotRst() | Resets device information. |
API Description
Ql_iotDBindcodeSet
This function enables binding the device to the App. This function is valid only when the device is bound to the App through short-range network (including TCP/IP local area network and BLE). To bind the device , the bind code reported by the device to Developer Center must match the one in the App.
Prototype
c
qbool Ql_iotDBindcodeSet(const char *bindcode, quint32_t timeout)Parameter
- Input
- quint8_t *
bindcode: Device bind code. Range: 0–9, A–F. If this parameter is not configured, the bind code will be randomly generated by the system. Code length is fixed to 16 bytes. - quint32_t
timeout: Allowed binding time. Range: 0-4294967295. Unit: second. When this parameter is 0, it indicates the binding is canceled.
- quint8_t *
Return Value
True:Successful executionFalse: Failed execution
NOTE
- This function is supported in SDK version 2.10.3 and above.
Example
c
qbool ret = Ql_iotDBindcodeSet("1234567891234567", 120);Ql_iotDBindcodeGet
This function gets the device bind code.
Prototype
c
quint32_t Ql_iotDBindcodeGet(char **bindcode)Parameter
- Input
- quint8_t **
bindcode: Device bind code.
- quint8_t **
Return Value
The remaining time before the device binding times out.
NOTE
- This function is supported in SDK version 2.10.3 and above.
Example
c
quint8_t *bindcode = NULL;
quint32_t timeout = Ql_iotDBindcodeGet(&bindcode);Ql_iotRst
This function resets device information, including DeviceSecret and device bind code.
Prototype
c
void Ql_iotRst(void)Parameter
None
Return Value
True: Successful executionFalse: Failed execution
NOTE
- This function is supported in SDK version 2.10.0 and above.
Example
c
qbool ret = Ql_iotRst();