static void * s_hengai_sleep_gsensor_timer_id = NULL;
static gsensor_data_t s_hengai_sleep_gsensor_data[HENGAI_SLEEP_GSENSOR_DATA_MAX] = {0};
static uint8_t s_hengai_sleep_gsensor_counter = 0;
+static uint8_t s_hengai_sleep_data_counter = 0;
static void mmi_hengai_gsensor_data_get(uint32_t para);
request_validation(fact, strlen(fact), imei, strlen(imei), req_code, &req_code_len);
+ printf("[@CHENG_DEBUG][%s][%d]: req_code=%s\n", __FUNCTION__, __LINE__, req_code);
+
_lv_memcpy(s_hengai_sleep_activation.req_code, req_code, req_code_len);
mmi_protocol_fzd_action_hengai_activation(req_code);
int result = 0;
result = get_sleep_time(s_hengai_sleep_gsensor_data, HENGAI_SLEEP_GSENSOR_DATA_MAX, curtime, &sdata);
+ printf("[@CHENG_DEBUG][%s][%d]: result=%d\n", __FUNCTION__, __LINE__, result);
if(1 == result)
{
mmi_hengai_sleep_data_save_to_file(&sdata, sizeof(sdata));
}
+ s_hengai_sleep_data_counter++;
+ if(60 <= s_hengai_sleep_data_counter) // 60mins
+ {
+ s_hengai_sleep_data_counter = 0;
+ mmi_hengai_sleep_data_send();
+ lv_fs_remove(HENGAI_SLEEP_DATA_FILE);
+ }
_lv_memset_00(s_hengai_sleep_gsensor_data, sizeof(s_hengai_sleep_gsensor_data));
mmi_hengai_gsensor_data_get(0);
else
uos_timer_create(&s_hengai_sleep_gsensor_timer_id);
+ s_hengai_sleep_gsensor_counter = 0;
+ s_hengai_sleep_data_counter = 0;
+
//mmi_hengai_gsensor_data_get(0);
uos_timer_start(s_hengai_sleep_gsensor_timer_id, MS_TO_TICKS(500), 0, mmi_hengai_gsensor_data_get, NULL);
}
uos_timer_delete(s_hengai_sleep_gsensor_timer_id);
}
+ s_hengai_sleep_gsensor_counter = 0;
+ s_hengai_sleep_data_counter = 0;
+
mmi_hengai_sleep_data_send();
lv_fs_remove(HENGAI_SLEEP_DATA_FILE);
{"SETREBOOT", 9, mmi_protocol_sms_parse_set_reboot},
{"GETIMEI", 7, mmi_protocol_sms_parse_get_imei},
{"UNBIND", 6, mmi_protocol_sms_parse_unbind},
+ {"SETAPN:", 7, mmi_protocol_sms_parse_set_apn},
/*******add before this line*******/
}
+//SETAPN:mcc,mnc,name,apn
+static MMI_Modem_Apn_Info_t s_ApnInfo = {0};
+static void mmi_protocol_sms_set_apn_cb(watch_app_adp_sms_send_result_type_t result)
+{
+ SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, result);
+
+ if(APP_SMS_SEND_SUCCESS == result)
+ {
+ watch_modem_set_apn_info(&s_ApnInfo);
+ watch_modem_config_apn(s_ApnInfo.apn, 0);
+ }
+ else if(APP_SMS_SEND_FAIL == result)
+ {
+ //
+ }
+}
+
+bool mmi_protocol_sms_parse_set_apn(char * fixed_str, char * data, char * number)
+{
+ SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: num=%s\n", __FUNCTION__, __LINE__, number);
+ SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, data);
+
+ if(0 == strlen(data))
+ {
+ SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ return false;
+ }
+
+ //{460, 11, "CTCC", "ctnet", , "0", "NONE", "any", "any", "IPV4V6"}
+ //{mcc, mnc£¬"ÔËÓªÉÌÃû¡±,"½ÓÈëµãÃû³Æ¡±,mtu,"ÍøÂçÀàÐÍ","¼øÈ¨ÀàÐÍ","Óû§Ãû¡±,"ÃÜÂ롱,"IPÀàÐÍ¡±}
+ char * temp_ptr = NULL;
+ uint8_t t_offset = 0;
+ char * t_mcc = NULL;
+ char * t_mnc = NULL;
+ char * t_name = NULL;
+ char * t_apn = NULL;
+ char * t_mtu = NULL;
+ char * t_net_type = NULL;
+ char * t_authentication_type = NULL;
+ char * t_user_name = NULL;
+ char * t_user_password = NULL;
+ char * t_ip_type = NULL;
+
+ t_mcc = km_strtok_r(NULL, ",", &data);
+ t_mnc = km_strtok_r(NULL, ",", &data);
+ t_name = km_strtok_r(NULL, ",", &data);
+ t_apn = km_strtok_r(NULL, ",", &data);
+
+ if(NULL == t_mcc || NULL == t_mnc || NULL == t_name || NULL == t_apn)
+ {
+ SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+ return false;
+ }
+
+ t_mtu = km_strtok_r(NULL, ",", &data);
+ t_net_type = km_strtok_r(NULL, ",", &data);
+ t_authentication_type = km_strtok_r(NULL, ",", &data);
+ t_user_name = km_strtok_r(NULL, ",", &data);
+ t_user_password = km_strtok_r(NULL, ",", &data);
+ t_ip_type = km_strtok_r(NULL, ",", &data);
+
+ _lv_memset_00(&s_ApnInfo, sizeof(s_ApnInfo));
+ s_ApnInfo.apnflg = 1;
+ s_ApnInfo.iptype = 0;
+
+ temp_ptr = s_ApnInfo.apn;
+ t_offset = 0;
+
+ sprintf(temp_ptr, "%s,%s,\"%s\",\"%s\"", t_mcc, t_mnc, t_name, t_apn);
+ t_offset = strlen(temp_ptr);
+ temp_ptr += t_offset;
+
+ if(NULL != t_mtu)
+ {
+ sprintf(temp_ptr, ",\"%s\"", t_mtu);
+ t_offset = strlen(temp_ptr);
+ temp_ptr += t_offset;
+ }
+
+ if(NULL != t_net_type)
+ {
+ sprintf(temp_ptr, ",\"%s\"", t_net_type);
+ t_offset = strlen(temp_ptr);
+ temp_ptr += t_offset;
+ }
+
+ if(NULL != t_authentication_type)
+ {
+ sprintf(temp_ptr, ",\"%s\"", t_authentication_type);
+ t_offset = strlen(temp_ptr);
+ temp_ptr += t_offset;
+ }
+
+ if(NULL != t_user_name)
+ {
+ sprintf(temp_ptr, ",\"%s\"", t_user_name);
+ t_offset = strlen(temp_ptr);
+ temp_ptr += t_offset;
+ }
+
+ if(NULL != t_user_password)
+ {
+ sprintf(temp_ptr, ",\"%s\"", t_user_password);
+ t_offset = strlen(temp_ptr);
+ temp_ptr += t_offset;
+ }
+
+ if(NULL != t_ip_type)
+ {
+ sprintf(temp_ptr, ",\"%s\"", t_ip_type);
+ t_offset = strlen(temp_ptr);
+ temp_ptr += t_offset;
+ }
+
+ mmi_protocol_sms_parse_sms_reply(NULL, fixed_str, number, mmi_protocol_sms_set_apn_cb);
+
+ return true;
+}
+
#endif