Last Updated on : 2024-11-20 08:51:48download
This topic describes the APIs used to implement the functionality of the engineering mode.
typedef struct {
TY_ENGR_GW_GET_LOG_CB engineer_get_log;
TY_ENGR_GW_SYNC_CONFIG_CB engineer_sync_config;
TY_ENGR_GW_FIN_CB engineer_finish;
TY_ENGR_GW_RESET_CB engineer_reset;
} TY_ENGR_GW_INFRA_CBS_S;
Functional specification
The callbacks for operations in the engineering mode.
Member description
Member | Description |
---|---|
engineer_get_log | The callback to invoke when the device logs are returned. For more information, see TY_ENGR_GW_GET_LOG_CB. |
engineer_sync_config | The callback to invoke when the operation mode is switched to the normal mode. For more information, see TY_ENGR_GW_SYNC_CONFIG_CB. |
engineer_finish | The callback to invoke when the engineering mode is finished. For more information, see TY_ENGR_GW_FIN_CB. |
engineer_reset | The callback to invoke when the engineering configuration is reset. For more information, see TY_ENGR_GW_RESET_CB. |
typedef struct {
TY_ENGR_GW_UG_LAN_INFORM_CB gw_lan_ug_cb;
TY_ENGR_DEV_UG_LAN_INFORM_CB dev_lan_ug_cb;
TY_ENGR_GW_SET_CHANNEL_CB gw_set_channel_cb;
TY_ENGR_GW_GET_CHANNEL_CB gw_get_channel_cb;
TY_ENGR_GW_SCE_PANEL_BIND_CB gw_sce_panel_cb;
}TY_ENGR_GW_ZIG_CBS_S;
Functional specification
The callbacks for Zigbee features in engineering mode.
Member description
Member | Description |
---|---|
gw_lan_ug_cb | The callback to invoke when the firmware update of the gateway is initiated. For more information, see TY_ENGR_GW_UG_LAN_INFORM_CB. |
dev_lan_ug_cb | The callback to invoke when the firmware update of the sub-device is initiated. For more information, see TY_ENGR_DEV_UG_LAN_INFORM_CB. |
gw_set_channel_cb | The callback to invoke when the Zigbee channel is set. For more information, see TY_ENGR_GW_SET_CHANNEL_CB. |
gw_get_channel_cb | The callback to invoke when the Zigbee channel is returned. For more information, see TY_ENGR_GW_GET_CHANNEL_CB. |
gw_sce_panel_cb | The callback to invoke when a Zigbee standard scene is configured for a scene panel. For more information, see TY_ENGR_GW_SCE_PANEL_BIND_CB. |
typedef struct {
INT_T btn;
CHAR_T *grp;
CHAR_T *sce;
CHAR_T *sce_name;
}TY_SCE_PANEL_S;
Functional specification
The configuration of a Zigbee standard scene in engineering mode.
Member description
Member | Description |
---|---|
btn | The button ID set for a Zigbee standard scene in engineering mode. |
grp | The group ID set for a Zigbee standard scene in engineering mode. |
sce | The scene ID set for a Zigbee standard scene in engineering mode. |
sce_name | The name set for a Zigbee standard scene in engineering mode. |
OPERATE_RET tuya_engineer_sdk_init(IN CONST CHAR_T *product_key, IN TY_ENGR_GW_INFRA_CBS_S *eng_infra_cbs, IN TY_ENGR_GW_ZIG_CBS_S* eng_zig_cbs);
Functional description
Initializes the engineering mode, which must be called before the SDK initialization APIs including tuya_iot_wired_wf_sdk_init
, tuya_iot_wf_sdk_init
, and tuya_iot_sdk_init
.
eng_zig_cbs
represents Zigbee specific callbacks. If you use functions to enable the Tuya-specific Zigbee features, eng_zig_cbs
will become invalid.
Parameter description
Parameter name | Description |
---|---|
product_key | The product ID (PID) of the gateway. |
eng_infra_cbs | The callbacks for basic operations in engineering mode. For more information, see TY_ENGR_GW_INFRA_CBS_S. |
eng_zig_cbs | The callbacks for Zigbee features in engineering mode. If you enable the Tuya-specific Zigbee features, this parameter will become invalid. For more information, see TY_ENGR_GW_ZIG_CBS_S. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
VOID tuya_set_engineer_mode(VOID);
Functional description
Sets the operation mode to the engineering mode.
Parameter description
Parameter name | Description |
---|---|
VOID | / |
Return value
Return value | Description |
---|---|
VOID | / |
OPERATE_RET tuya_engineer_extra_lan_data_report(IN CHAR_T *data);
Functional description
Reports data in engineering mode by using the LAN extension protocol. The gateway will transmit the raw data to the specified mobile app.
Parameter description
Parameter name | Description |
---|---|
data | The data reported by using the LAN extension protocol. The gateway will transmit the raw data to the specified mobile app. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
OPERATE_RET tuya_engineer_is_need_sync(BOOL_T *status);
Functional description
Gets the progress to determine whether the operation mode is switched to the normal mode after construction is finished.
Parameter description
Parameter name | Description |
---|---|
status | TRUE indicates the operation mode is not switched to the normal mode after construction is finished. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
OPERATE_RET tuya_engineer_set_tuya_zigbee_enable(VOID);
Functional description
Enables the Tuya-specific features in engineering mode.
Parameter description
Parameter name | Description |
---|---|
VOID | / |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
OPERATE_RET tuya_iot_engineer_process_register(IN GW_ENGR_PROCESS_CB cb);
Functional description
Registers the function that gets the status of the gateway pairing process in engineering mode.
Parameter description
Parameter name | Description |
---|---|
cb | The callback to invoke when the status of the gateway pairing process in engineering mode is reported. For more information, see GW_ENGR_PROCESS_CB. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_GET_LOG_CB)(OUT CHAR_T *path, IN CONST INT_T len);
Functional description
The callback to invoke when the device logs are returned.
Parameter description
Parameter name | Description |
---|---|
path | The path of the device logs. |
len | The maximum number of bytes for the absolute path of device logs, defaulting to 64 bytes. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_SYNC_CONFIG_CB)(VOID);
Functional description
The callback to invoke when the operation mode is switched to the normal mode.
Parameter description
Parameter name | Description |
---|---|
VOID | / |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_FIN_CB)(VOID);
Functional description
The callback to invoke when the engineering is finished.
Parameter description
Parameter name | Description |
---|---|
VOID | / |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_RESET_CB)(VOID);
Functional description
The callback to invoke when the engineering configuration is reset.
Parameter description
Parameter name | Description |
---|---|
VOID | / |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_SCE_PANEL_BIND_CB)(IN CONST CHAR_T *dev_id,IN CONST TY_SCE_PANEL_S *sce_panel, IN CONST INT_T btn_num);
Functional description
The callback to invoke when a Zigbee standard scene is bound for a scene panel.
Parameter description
Parameter name | Description |
---|---|
dev_id | The device ID of the scene panel. |
sce_panel | The configuration of a Zigbee standard scene in engineering mode. For more information, see TY_SCE_PANEL_S. |
btn_num | The number of scenes configured for a scene panel. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_UG_LAN_INFORM_CB)(IN CONST FW_UG_S *fw);
Functional description
The callback to invoke when the firmware update of a gateway is initiated.
Parameter description
Parameter name | Description |
---|---|
fw | The version of the update. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_DEV_UG_LAN_INFORM_CB)(IN CONST CHAR_T *dev_id,IN CONST FW_UG_S *fw);
Functional description
The callback to invoke when the firmware update of the sub-device is initiated.
Parameter description
Parameter name | Description |
---|---|
dev_id | The device ID of the sub-device to update. |
fw | The version of the update. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_SET_CHANNEL_CB)(IN INT_T channel);
Functional description
The callback to invoke when the Zigbee channel is set.
Parameter description
Parameter name | Description |
---|---|
channel | The Zigbee channel. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*TY_ENGR_GW_GET_CHANNEL_CB)(OUT INT_T *channel);
Functional description
The callback to invoke when the Zigbee channel is returned.
Parameter description
Parameter name | Description |
---|---|
channel | The Zigbee channel. |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*GW_ENGR_PROCESS_CB)(GW_ENGR_PROCESS_T process);
Functional description
The callback to invoke when the status of the gateway pairing process in engineering mode is reported.
Parameter description
Parameter name | Description |
---|---|
process | The status of the gateway pairing process in engineering mode. For more information, see GW_ENGR_PROCESS_T . |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
typedef OPERATE_RET (*GW_ENGR_PROCESS_CB)(GW_ENGR_PROCESS_T process);
Functional description
The callback to invoke when the status of the gateway pairing process in engineering mode is reported.
Parameter description
Parameter name | Description |
---|---|
process | The status of the gateway pairing process in engineering mode. For more information, see GW_ENGR_PROCESS_T . |
Return value
Return value | Description |
---|---|
OPRT_OK | Operation succeeded. |
Error code | For more information about the error code, see tuya_error_code.h . |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback