//整点上报时间线状态\r
if(curTime.tm_min == 0 && curTime.tm_sec == 0)\r
{\r
- do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_TIMELINE_GET_STATUS, NULL, 0);\r
+ //获取是否绑定\r
+ if(uapi_ln_is_device_bound()) \r
+ {\r
+ do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_TIMELINE_GET_STATUS, NULL, 0);\r
+ }\r
}\r
//每天凌晨2点检查夜间更新状态\r
if(curTime.tm_hour == 2 && curTime.tm_min == 0 && curTime.tm_sec == 0)\r
char *g_ln_last_target_version = NULL; // 最近一次查询到的 OTA 包目标版本(动态分配)
char *g_ln_last_package_md5 = NULL; // 最近一次查询到的 OTA 包 MD5(动态分配)
int g_ln_last_package_size = 0; // 最近一次查询到的 OTA 包大小(字节)
-int g_ln_is_device_bound = 0; /* 设备绑定状态 */
+static int g_ln_is_device_bound = 0; /* 设备绑定状态 */
char g_ln_device_user_id[64] = {0}; // 设备绑定用户ID
static int g_ln_is_file_downloading = 0; // 是否正在下载文件
char g_ln_character_id[64] = {0}; // 角色ID
{
return g_audio_play_status;
}
+//是否绑定设备
+int uapi_ln_is_device_bound(void)
+{
+ return g_ln_is_device_bound;
+}
+//设置是否绑定设备
+void uapi_ln_set_device_bound(int bound)
+{
+ g_ln_is_device_bound = bound;
+}
/* 下载文件
@param url 文件URL
printf("[WS] DeviceBind:设备绑定\n");
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);
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);
ln_ws_send_device_unbind_ack(uapi_ln_get_user_id(), true, "解绑成功");
break;
void uapi_ln_set_audio_play_status(int status);
/* 获取ws音频播放状态 */
int uapi_ln_get_audio_play_status(void);
+//是否绑定设备
+int uapi_ln_is_device_bound(void);
+//设置是否绑定设备
+void uapi_ln_set_device_bound(int bound);
/* ============================== 共享全局状态(跨文件) ============================== */
extern char *g_device_token;
if (data == NULL || cJSON_IsNull(data))
{
push_bind_and_unbind_notification(LN_DEVICE_BIND_STATUS_UNBOUND);
+ uapi_ln_set_device_bound(0);
}
else if (cJSON_IsString(data) && data->valuestring && data->valuestring[0])
{
printf("device getUserId: data=%s\n", data->valuestring);
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);
}
}
cJSON_Delete(root);