char *header_buf = (char *)malloc(512);
if (!header_buf)
+ {
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
+ }
int hdr = snprintf(header_buf, 512,
"deviceId: %s\r\n"
"deviceToken: %s\r\n"
if (hdr <= 0)
{
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
if (prep != HTTP_SUCCESS)
{
printf("device getCharacter prepare failed %d\n", prep);
+ free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_SUCC;
}
char *header_buf2 = (char *)malloc(512);
if (!header_buf2)
+ {
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
+ }
int hdr = snprintf(header_buf2, 512,
"deviceId: %s\r\n"
"deviceToken: %s\r\n"
if (hdr <= 0)
{
free(header_buf2);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf2);
if (prep != HTTP_SUCCESS)
{
printf("device getUserId prepare failed %d\n", prep);
+ free(header_buf2);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf2);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_SUCC;
}
if (!header_buf)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CHAT_STAMINA] malloc failed for header_buf");
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
int hdr = snprintf(header_buf, 512,
{
free(header_buf);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CHAT_STAMINA] snprintf failed for header_buf");
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CHAT_STAMINA] prepare failed: %d", prep);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
memcpy(json_text, clientData.responseBuf, (size_t)body_len);
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_SUCC;
}
\ No newline at end of file
if (!header_buf)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[EMOJI_REPORT_STATUS] malloc header_buf failed");
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
int hdr = snprintf(header_buf, 512,
{
free(header_buf);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[EMOJI_REPORT_STATUS] build header failed");
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
if (!root)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[EMOJI_REPORT_STATUS] create root object failed");
+ free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
cJSON_AddStringToObject(root, "characterId", character_id);
if (!body)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[EMOJI_REPORT_STATUS] print unformatted failed");
+ free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
free(body);
free(header_buf);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[EMOJI_REPORT_STATUS] prepare auto failed");
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
clientData.postBuf = body;
HttpClientUnprepare(&clientData);
free(header_buf);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[EMOJI_REPORT_STATUS] request failed");
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
free(header_buf);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[EMOJI_REPORT_STATUS] response code not 200");
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
if (clientData.responseBuf && clientData.responseBufLen > 0)
free(body);
HttpClientUnprepare(&clientData);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_SUCC;
}
/* 7.2 上报设备所有表情组状态 */
int group_count)
{
if (!device_id || !device_token || (!groups && group_count > 0) || group_count < 0)
+ {
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
+ }
#ifdef SUPPORT_CAT1_SERVICE
cat1_api_add_cat1_vote();
/* 直接构造自定义请求头,生命周期贯穿整个请求,结束后再释放 */
char *header_buf = (char *)malloc(512);
if (!header_buf)
+ {
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
+ }
int hdr = snprintf(header_buf, 512,
"deviceId: %s\r\n"
"deviceToken: %s\r\n"
if (hdr <= 0)
{
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
/* 组装 JSON 数组 */
cJSON *root = cJSON_CreateObject();
if (!root)
+ {
+ free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
+ }
cJSON *arr = cJSON_CreateArray();
if (!arr)
{
cJSON_Delete(root);
+ free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
for (int i = 0; i < group_count; ++i)
char *body = cJSON_PrintUnformatted(root);
cJSON_Delete(root);
if (!body)
+ {
+ free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
+ }
HTTPC_RESULT prep = ln_http_prepare_auto(&clientData, 2048, LN_CLIENT_PREPARE_SIZE * 2);
if (prep != HTTP_SUCCESS)
(uapi_ln_get_device_version() ? strlen(uapi_ln_get_device_version()) : 5);
char *header_buf = (char *)malloc(hdr_cap + 128);
if (!header_buf)
+ {
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
+ }
int hdr = snprintf(header_buf, hdr_cap + 128,
"deviceId: %s\r\n"
"deviceToken: %s\r\n"
if (hdr <= 0)
{
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
if (prep != HTTP_SUCCESS)
{
printf("[OTA] getTask prepare failed %d\n", prep);
+ free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
{
HttpClientUnprepare(&clientData);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
int ulen = snprintf(url_with_params, url_cap,
HttpClientUnprepare(&clientData);
free(header_buf);
free(url_with_params);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_FAIL;
}
free(header_buf);
if (url_with_params)
free(url_with_params);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
return ERRCODE_SUCC;
}
if (resume_offset >= (long long)total_size)
{
printf("[OTA] local file already complete: %lld >= %d\n", resume_offset, total_size);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
+ uapi_ln_remove_vote();
return 0; // 视为已完成
}
}
if (!fd)
{
printf("[OTA] fopen failed for %s:\n", save_path);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
+ uapi_ln_remove_vote();
return -1;
}
{
printf("[OTA] range prepare failed: %d\n", prep);
fclose(fd);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
{
HttpClientUnprepare(&client_data);
fclose(fd);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
int hdr = snprintf(header_buf, 128, "Range: bytes=%lld-\r\n", resume_offset);
free(header_buf);
HttpClientUnprepare(&client_data);
fclose(fd);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
HttpClientSetCustomHeader(&client, header_buf);
if (header_buf) free(header_buf);
fclose(fd);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return ret;
}
HttpClientClse(&client);
fclose(fd);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return ret;
}
HttpClientClse(&client);
fclose(fd);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
if (header_buf) free(header_buf);
HttpClientClse(&client);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
resume_offset = 0;
fclose(fd);
HttpClientClse(&client);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
total_written += written;
fclose(fd);
HttpClientClse(&client);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
total_written += written;
fclose(fd);
HttpClientClse(&client);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
return -1;
}
}
fclose(fd);
HttpClientClse(&client);
HttpClientUnprepare(&client_data);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
+ uapi_ln_remove_vote();
printf("[OTA] download process finished\n");
{
if (!json_buf || json_len <= 0)
{
- printf("[SCHEDULE_REMINDER] invalid json input\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER] invalid json input\n");
return;
}
cJSON *root = cJSON_Parse(text);
if (!root)
{
- printf("[SCHEDULE_REMINDER] json parse failed\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER] json parse failed\n");
free(text);
return;
}
cJSON *errorCode = cJSON_GetObjectItem(root, "errorCode");
if (errorCode && !cJSON_IsNull(errorCode))
{
- printf("[SCHEDULE_REMINDER] server error: %s\n",
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER] server error: %s\n",
cJSON_IsString(errorCode) ? errorCode->valuestring : "unknown");
cJSON_Delete(root);
free(text);
cJSON *data = cJSON_GetObjectItem(root, "data");
if (!data || !cJSON_IsObject(data))
{
- printf("[SCHEDULE_REMINDER] no data object\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER] no data object\n");
cJSON_Delete(root);
free(text);
return;
g_schedule_reminder.enableVibration = (enableVibration && cJSON_IsNumber(enableVibration)) ? enableVibration->valueint : 0;
// 打印解析结果
- printf("[SCHEDULE_REMINDER] parsed successfully:\n");
- printf(" scheduleId: %d\n", g_schedule_reminder.scheduleId);
- printf(" deviceId: %s\n", g_schedule_reminder.deviceId ? g_schedule_reminder.deviceId : "");
- printf(" scheduleName: %s\n", g_schedule_reminder.scheduleName ? g_schedule_reminder.scheduleName : "");
- printf(" reminderContent: %s\n", g_schedule_reminder.reminderContent ? g_schedule_reminder.reminderContent : "");
- printf(" reminderAudioUrl: %s\n", g_schedule_reminder.reminderAudioUrl ? g_schedule_reminder.reminderAudioUrl : "");
- printf(" enableVoice: %d\n", g_schedule_reminder.enableVoice);
- printf(" enableVibration: %d\n", g_schedule_reminder.enableVibration);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER] parsed successfully:\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " scheduleId: %d\n", g_schedule_reminder.scheduleId);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " deviceId: %s\n", g_schedule_reminder.deviceId ? g_schedule_reminder.deviceId : "");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " scheduleName: %s\n", g_schedule_reminder.scheduleName ? g_schedule_reminder.scheduleName : "");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " reminderContent: %s\n", g_schedule_reminder.reminderContent ? g_schedule_reminder.reminderContent : "");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " reminderAudioUrl: %s\n", g_schedule_reminder.reminderAudioUrl ? g_schedule_reminder.reminderAudioUrl : "");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " enableVoice: %d\n", g_schedule_reminder.enableVoice);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " enableVibration: %d\n", g_schedule_reminder.enableVibration);
#if 0
// 推送文本和日程提醒内容数据给ui
{
if (!json_buf || json_len <= 0)
{
- printf("[SCHEDULE_REMINDER_CONFIG] invalid json input\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER_CONFIG] invalid json input\n");
return;
}
cJSON *root = cJSON_Parse(text);
if (!root)
{
- printf("[SCHEDULE_REMINDER_CONFIG] json parse failed\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER_CONFIG] json parse failed\n");
free(text);
return;
}
cJSON *errorCode = cJSON_GetObjectItem(root, "errorCode");
if (errorCode && !cJSON_IsNull(errorCode))
{
- printf("[SCHEDULE_REMINDER_CONFIG] server error: %s\n",
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER_CONFIG] server error: %s\n",
cJSON_IsString(errorCode) ? errorCode->valuestring : "unknown");
cJSON_Delete(root);
free(text);
cJSON *data = cJSON_GetObjectItem(root, "data");
if (!data || !cJSON_IsObject(data))
{
- printf("[SCHEDULE_REMINDER_CONFIG] no data object\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER_CONFIG] no data object\n");
cJSON_Delete(root);
free(text);
return;
(displayText && cJSON_IsString(displayText)) ? displayText->valuestring : "");
// 打印解析结果
- printf("[SCHEDULE_REMINDER_CONFIG] parsed successfully:\n");
- printf(" scheduleName: %s\n", g_schedule_reminder_config.scheduleName ? g_schedule_reminder_config.scheduleName : "");
- printf(" scheduleId: %d\n", g_schedule_reminder_config.scheduleId);
- printf(" displayText: %s\n", g_schedule_reminder_config.displayText ? g_schedule_reminder_config.displayText : "");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER_CONFIG] parsed successfully:\n");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " scheduleName: %s\n", g_schedule_reminder_config.scheduleName ? g_schedule_reminder_config.scheduleName : "");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " scheduleId: %d\n", g_schedule_reminder_config.scheduleId);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " displayText: %s\n", g_schedule_reminder_config.displayText ? g_schedule_reminder_config.displayText : "");
// 推送任务提醒通知
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER_CONFIG] push task reminder notification\n");
if (!header_buf)
{
free(body);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
int hdr = snprintf(header_buf, 512,
{
free(body);
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
if (prep != HTTP_SUCCESS)
{
free(body);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
printf("connection failed, ret=0x%x\n", ret);
free(body);
HttpClientUnprepare(&clientData);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ret;
}
free(body);
HttpClientClse(&client);
HttpClientUnprepare(&clientData);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ret;
}
free(body);
HttpClientClse(&client);
HttpClientUnprepare(&clientData);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
HttpClientClse(&client);
HttpClientUnprepare(&clientData);
fclose(fd);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
total_written += written;
HttpClientClse(&client);
free(body);
fclose(fd);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_SUCC;
-}
+}
\ No newline at end of file
if (!header_buf)
{
free(body);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
int hdr = snprintf(header_buf, 1024,
printf("story choose: build header failed\n");
free(body);
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
{
printf("story choose: prepare HTTP buffer failed (code: %d)\n", prep);
free(body);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
printf("connection failed, ret=0x%x\n", ret);
free(body);
HttpClientUnprepare(&clientData);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ret;
}
free(body);
HttpClientClse(&client);
HttpClientUnprepare(&clientData);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ret;
}
free(body);
HttpClientClse(&client);
HttpClientUnprepare(&clientData);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
HttpClientClse(&client);
HttpClientUnprepare(&clientData);
fclose(fd);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
total_written += written;
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
fclose(fd);
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_SUCC;
}
/* 普通JSON头 */
char *header_buf = (char *)malloc(512);
if (!header_buf)
+ {
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
+ }
int hdr = snprintf(header_buf, 512,
"deviceId: %s\r\ndeviceToken: %s\r\nContent-Type: application/json\r\n",
device_id, device_token);
if (hdr <= 0)
{
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
HTTPC_RESULT prep = ln_http_prepare_auto(&clientData, 2048, 8 * 1024);
if (prep != HTTP_SUCCESS)
+ {
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
+ }
clientData.postBuf = (char *)"{}";
clientData.postBufLen = 2;
HttpClientClse(&client);
if (header_buf)
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_SUCC;
}
char *header_buf = (char *)malloc(512);
if (!header_buf)
+ {
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
+ }
int hdr = snprintf(header_buf, 512,
"deviceId: %s\r\ndeviceToken: %s\r\nContent-Type: application/json\r\n",
device_id, device_token);
if (hdr <= 0)
{
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
HTTPC_RESULT prep = ln_http_prepare_auto(&clientData, 2048, 8 * 1024);
if (prep != HTTP_SUCCESS)
+ {
+ free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
+ }
clientData.postBuf = (char *)"{}";
clientData.postBufLen = 2;
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_SUCC;
}
if (hdr <= 0)
{
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
HttpClientSetCustomHeader(&client, header_buf);
{
printf("story random: prepare HTTP buffer failed (code: %d)\n", prep);
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
if (escaped_theme)
free(escaped_theme);
free(header_buf);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
int json_len = 0;
free(header_buf);
free(json_body);
free(escaped_theme);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
free(json_body);
free(escaped_theme);
HttpClientUnprepare(&clientData);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ret;
}
free(header_buf);
free(json_body);
free(escaped_theme);
+ HttpClientUnprepare(&clientData);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ret;
}
free(header_buf);
free(json_body);
free(escaped_theme);
+ HttpClientUnprepare(&clientData);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
free(header_buf);
free(json_body);
free(escaped_theme);
+ HttpClientUnprepare(&clientData);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_FAIL;
}
total_written += written;
free(header_buf);
free(json_body);
free(escaped_theme);
+ #ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+ #endif
return ERRCODE_SUCC;
}
char *header_buf = (char *)malloc(512);
if (!header_buf)
{
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
if (hdr <= 0)
{
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
if (prep != HTTP_SUCCESS)
{
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_SUCC;
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ln_get_device_token_http: HttpClientPrepare failed %d", prep);
free(sign_data);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
HttpClientClse(&client);
free(sign_data);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
HttpClientClse(&client);
free(sign_data);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
HttpClientClse(&client);
free(sign_data);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
HttpClientClse(&client);
free(sign_data);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
HttpClientClse(&client);
free(sign_data);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
free(json_text);
HttpClientUnprepare(&clientData);
HttpClientClse(&client);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_FAIL;
}
HttpClientClse(&client);
free(sign_data);
free(header_buf);
+#ifdef SUPPORT_CAT1_SERVICE
+ cat1_api_remove_cat1_vote();
+#endif
uapi_ln_remove_vote();
return ERRCODE_SUCC;
}