if( 0==AlmmgrGetManagement(&data))
{
- for(int i=0;i<data.eventAlarmCnt;i++)
+ for(int i=0;i<EVENT_ALARM_CLOCK_MAX;i++)
{
+ if(data.eventAlarmInfo[i].alarmClockId==i && data.eventAlarmInfo[i].alarmType==TYPE_EVENT_ALARM_CLOCK)
AlmmgrDeleteAlarmClock(&data.eventAlarmInfo[i]);
}
}
if( 0==AlmmgrGetManagement(&data))
{
- for(int i=0;i<data.eventAlarmCnt;i++)
+
+ for(int i=0;i<EVENT_ALARM_CLOCK_MAX;i++)
{
- cJSON* itemJSON = cJSON_CreateObject();
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.eventAlarmInfo[i].alarmClockId);
- cJSON_AddNumberToObject(itemJSON,"id",data.eventAlarmInfo[i].alarmClockId);
+ if(data.eventAlarmInfo[i].alarmClockId==i && data.eventAlarmInfo[i].alarmType==TYPE_EVENT_ALARM_CLOCK)
+ {
+ cJSON* itemJSON = cJSON_CreateObject();
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.eventAlarmInfo[i].alarmClockId);
+ cJSON_AddNumberToObject(itemJSON,"id",data.eventAlarmInfo[i].alarmClockId);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟使能:%d\r\n",data.eventAlarmInfo[i].alarmClockEnable);
- cJSON_AddNumberToObject(itemJSON,"enable",data.eventAlarmInfo[i].alarmClockEnable);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟使能:%d\r\n",data.eventAlarmInfo[i].alarmClockEnable);
+ cJSON_AddNumberToObject(itemJSON,"enable",data.eventAlarmInfo[i].alarmClockEnable);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟重复:%d\r\n",data.eventAlarmInfo[i].repeatPeriod);
- int anNum[7] = {0};
- int repeatPeriod_num=0;
- for(int j=0 ; j<7;j++)
- {
- if(data.eventAlarmInfo[i].repeatPeriod & 0b00000001<<j)
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟重复:%d\r\n",data.eventAlarmInfo[i].repeatPeriod);
+ int anNum[7] = {0};
+ int repeatPeriod_num=0;
+ for(int j=0 ; j<7;j++)
{
- if(j==0)
- {
- anNum[repeatPeriod_num]=7;
- }
- else
+ if(data.eventAlarmInfo[i].repeatPeriod & 0b00000001<<j)
{
- anNum[repeatPeriod_num]=j;
- }
-
+ if(j==0)
+ {
+ anNum[repeatPeriod_num]=7;
+ }
+ else
+ {
+ anNum[repeatPeriod_num]=j;
+ }
- repeatPeriod_num++;
+
+ repeatPeriod_num++;
+ }
}
- }
- if(repeatPeriod_num==0)
- {
- repeatPeriod_num=1;
- }
- cJSON* repeatPeriod= cJSON_CreateIntArray(anNum,repeatPeriod_num);
-
- cJSON_AddItemToObject(itemJSON,"repeat",repeatPeriod);
+ if(repeatPeriod_num==0)
+ {
+ repeatPeriod_num=1;
+ }
+ cJSON* repeatPeriod= cJSON_CreateIntArray(anNum,repeatPeriod_num);
+
+ cJSON_AddItemToObject(itemJSON,"repeat",repeatPeriod);
- uint8_t refreshHour = data.eventAlarmInfo[i].alarmTime >> 16; // 闹钟存储小时位需要右移16位
-
- uint8_t refreshMin = data.eventAlarmInfo[i].alarmTime & 0x00FF; // 得出闹钟时间的分钟位需要将左置位16位清零
+ uint8_t refreshHour = data.eventAlarmInfo[i].alarmTime >> 16; // 闹钟存储小时位需要右移16位
+
+ uint8_t refreshMin = data.eventAlarmInfo[i].alarmTime & 0x00FF; // 得出闹钟时间的分钟位需要将左置位16位清零
- cJSON_AddNumberToObject(itemJSON,"hour",refreshHour);
+ cJSON_AddNumberToObject(itemJSON,"hour",refreshHour);
- cJSON_AddNumberToObject(itemJSON,"minute",refreshMin);
+ cJSON_AddNumberToObject(itemJSON,"minute",refreshMin);
- cJSON_AddItemReferenceToArray(data_arryJSON,itemJSON);
+ cJSON_AddItemReferenceToArray(data_arryJSON,itemJSON);
+ }
+
//cJSON_AddNumberToObject(itemJSON,"src",data->src);
}
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmTime);
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.repeatPeriod);
- // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmClockEnable);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmTime);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.repeatPeriod);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"闹钟数据:%d\r\n",data.alarmClockEnable);
// i++;
}
else