do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_CHARACTER, NULL, 0);
push_bind_and_unbind_notification(LN_DEVICE_BIND_STATUS_BOUND);
uapi_ln_set_device_bound(1);
- ln_ws_ack_user_id_from_json(json_str);
+ if (json_str) {
+ ln_ws_ack_user_id_from_json(json_str);
+ }
ln_ws_send_device_bind_ack(uapi_ln_get_user_id(), true, "绑定成功");
break;
}
printf("[WS] DeviceUnbind:设备解绑\n");
push_bind_and_unbind_notification(LN_DEVICE_BIND_STATUS_UNBOUND);
uapi_ln_set_device_bound(0);
- ln_ws_ack_user_id_from_json(json_str);
+ if (json_str) {
+ ln_ws_ack_user_id_from_json(json_str);
+ }
ln_ws_send_device_unbind_ack(uapi_ln_get_user_id(), true, "解绑成功");
break;
}
case WS_CMD_SCHEDULE_REMINDER:
{
printf("[WS] ScheduleReminder:日程提醒\n");
- // if (json_str)
+ if (json_str)
{
do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_SCHEDULE_REMINDER, json_str, strlen(json_str));
}
}
case WS_CMD_CHOOSE_STORY_RESPONSE:
{
- push_text_to_ui(data_msg->text_content);
- // 如果finished=true,通知ThunderBirdModel
- if (data_msg && data_msg->finished) {
- push_story_response_finished_notification(true);
+ if (data_msg) {
+ if (data_msg->text_content) {
+ push_text_to_ui(data_msg->text_content);
+ }
+ // 如果finished=true,通知ThunderBirdModel
+ if (data_msg->finished) {
+ push_story_response_finished_notification(true);
+ }
+ if (ln_http_download_is_initialized() && data_msg->audio_url && data_msg->audio_url[0] != '\0') {
+ ln_http_download_file(data_msg->audio_url, 100*1000);
+ }
}
- if(ln_http_download_is_initialized())
- ln_http_download_file(data_msg->audio_url, 100*1000);
break;
}
case WS_CMD_RANDOM_STORY_RESPONSE:
{
- push_text_to_ui(data_msg->text_content);
- // 如果finished=true,通知ThunderBirdModel
- if (data_msg && data_msg->finished) {
- push_story_response_finished_notification(true);
+ if (data_msg) {
+ if (data_msg->text_content) {
+ push_text_to_ui(data_msg->text_content);
+ }
+ // 如果finished=true,通知ThunderBirdModel
+ if (data_msg->finished) {
+ push_story_response_finished_notification(true);
+ }
+ if (ln_http_download_is_initialized() && data_msg->audio_url && data_msg->audio_url[0] != '\0') {
+ ln_http_download_file(data_msg->audio_url, 100*1000);
+ }
}
- if(ln_http_download_is_initialized())
- ln_http_download_file(data_msg->audio_url, 100*1000);
break;
}
case WS_CMD_AUDIO_PLAYBACK_START:
{
uapi_ln_set_audio_play_status(1);
+ break;
}
case WS_CMD_AUDIO_PLAYBACK_END:
{
if (ret != OSAL_SUCCESS)
{
printf("Error ln http send failed! err=0x%x! \r\n", ret);
+ if (send_data.data != NULL) {
+ free(send_data.data);
+ }
}
}