tkl_wired | Wired Ethernet Driver
The tkl_wired.c file is a wired driver that provides functionality for obtaining the status of a wired connection, including the link status, IP address, MAC address, and registering a callback function for status changes. This file is automatically generated by the TuyaOS, with certain areas marked for developers to customize and implement relevant logic.
API Descriptionโ
tkl_wired_get_statusโ
OPERATE_RET tkl_wired_get_status(TKL_WIRED_STAT_E *status);
Functionโ
Retrieves the link status of the wired connection.
Parametersโ
status: Pointer to store the link status.
Return Valueโ
OPRT_OK: Success.- Other error codes: Refer to
tuya_error_code.h.
tkl_wired_set_status_cbโ
OPERATE_RET tkl_wired_set_status_cb(TKL_WIRED_STATUS_CHANGE_CB cb);
Functionโ
Registers a callback function for network status changes.
Parametersโ
cb: Callback function to be invoked on status change.
Return Valueโ
OPRT_OK: Success.- Other error codes: Refer to
tuya_error_code.h.
tkl_wired_get_ipโ
OPERATE_RET tkl_wired_get_ip(NW_IP_S *ip);
Functionโ
Retrieves the IP address of the wired connection.
Parametersโ
ip: Pointer to store the IP address.
Return Valueโ
OPRT_OK: Success.- Other error codes: Refer to
tuya_error_code.h.
tkl_wired_get_macโ
OPERATE_RET tkl_wired_get_mac(NW_MAC_S *mac);
Functionโ
Retrieves the MAC address of the wired connection.
Parametersโ
mac: Pointer to store the MAC address.
Return Valueโ
OPRT_OK: Success.- Other error codes: Refer to
tuya_error_code.h.
Noteโ
The default MAC address is hardcoded.
tkl_wired_set_macโ
OPERATE_RET tkl_wired_set_mac(const NW_MAC_S *mac);
Functionโ
Sets the MAC address of the wired connection.
Parametersโ
mac: Pointer containing the MAC address to be set.
Return Valueโ
OPRT_OK: Success.- Other error codes: Refer to
tuya_error_code.h.
Noteโ
In the current coding style, the tkl_wired_set_mac function only returns OPRT_OK and does not actually set the MAC address.