🏆 Join the TuyaOpen AI Hardware Contest! 100 days to build the future of AI devicesLearn More →
Skip to main content

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.