Voice Alarm Clock

Last Updated on : 2023-02-13 03:30:15download

The voice services allow the user to create schedules such as alarm clocks and reminders with voice commands. This topic describes the APIs used for alarm clock features, such as updating and getting alarm clocks.

Initialize voice alarm clock

Function prototype OPERATE_RET tuya_iot_clock_init(TY_IOT_CLOCK_CBS_S *cb)
Function description Initialize the alarm clock service.
Parameter cb: The callback for updating the alarm clock.
Return value OPERATE_RET, 0: Success. Other values: Failure. See the error code.
Detailed description This interface has been integrated into home_init_ex, so there is no need to manually call it. You need to configure the callback cbs.clock_cbs.update_cb when home_init_ex is run. If you set this callback to NULL, the voice alarm clock is not enabled.

Update voice alarm clock

Function prototype OPERATE_RET tuya_iot_clock_async()
Function description Update the alarm clock resources.
Parameter VOID
Return value OPERATE_RET, 0: Success. Other values: Failure. See the error code.
Detailed description The user proactively updates the data of voice alarm clocks.

Get the voice alarm clock list

Function prototype OPERATE_RET tuya_iot_clock_get_list(OUT TY_IOT_CLOCK_BRIEF_INFO_S **clock_list, OUT UINT_T *clock_num)
Function description Get the voice alarm clock list.
Parameter clock_list: The alarm clock list.

clock_num: The number of alarm clocks.
Return value OPERATE_RET, 0: Success. Other values: Failure. See the error code.
Detailed description After this interface is called to get the alarm clock list, tuya_iot_clock_free_list should be called to free the allocated resources.

Free the voice alarm clock list

Function prototype OPERATE_RET tuya_iot_clock_free_list(IN TY_IOT_CLOCK_BRIEF_INFO_S *clock_list)
Function description Free the resources allocated to the voice alarm clock list.
Parameter clock_list: The alarm clock list.
Return value OPERATE_RET, 0: Success. Other values: Failure. See the error code.
Detailed description The user frees the resources allocated to the voice alarm clock list.

Delete a voice alarm clock

Function prototype OPERATE_RET tuya_iot_clock_delete(IN TY_IOT_CLOCK_TYPE_E type, IN UINT64_T timerid)
Function description Delete the specified voice alarm clock.
Parameter type: Alarm clock or reminder. For more information, see TY_IOT_CLOCK_TYPE_E.
timerid: The unique identifier of an alarm clock.
Return value OPERATE_RET, 0: Success. Other values: Failure. See the error code.
Detailed description The user frees the resources allocated for the specified voice alarm clock.