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.