Merge remote-tracking branch 'origin/master'
| | |
| | | } |
| | | } |
| | | |
| | | void GetUpgrade(int province, int city) |
| | | { |
| | | JNIEnv *env; |
| | | bool ready_in_java_env = false; |
| | | |
| | | if (sg_jvm->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) { |
| | | // Attach主线程 |
| | | if (sg_jvm->AttachCurrentThread(&env, NULL) != JNI_OK) { |
| | | LOGE("%s: AttachCurrentThread() failed", __FUNCTION__); |
| | | return; |
| | | } |
| | | } else { |
| | | ready_in_java_env = true; |
| | | } |
| | | |
| | | jclass cls = env->GetObjectClass(sg_obj); |
| | | jmethodID fun = env->GetMethodID(cls, "GetUpgrade", "(II)V"); |
| | | |
| | | env->CallVoidMethod(sg_obj, fun, province, city); |
| | | |
| | | env->DeleteLocalRef(cls); |
| | | |
| | | if (!ready_in_java_env) { |
| | | //Detach主线程 |
| | | if (sg_jvm->DetachCurrentThread() != JNI_OK) { |
| | | LOGE("%s: DetachCurrentThread() failed", __FUNCTION__); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | void SendToBluetooth(const uint8_t *data, int length) |
| | | { |
| | | JNIEnv *env; |
| | |
| | | int PlayTTS(const char *string, void (*callback)(int)); |
| | | int PlayTTS(std::string &tts, void (*callback)(int)); |
| | | void PlayRing(void); |
| | | void GetUpgrade(int province, int city); |
| | | void SendToBluetooth(const uint8_t *data, int length); |
| | | void ConnectToBluetooth(const char *addr, const char *pin); |
| | | void DisconnectBluetooth(void); |
| | |
| | | eventQueue = NULL; |
| | | |
| | | memset(&platformStatus, 0, sizeof(platformStatus)); |
| | | memset(&deviceInfo, 0, sizeof(deviceInfo)); |
| | | |
| | | sem_init(&sem_status_changed, 0, 0); |
| | | |
| | |
| | | |
| | | void ConfigPlatform(const rtk_platform_cfg_t *p) |
| | | { |
| | | DEBUG("配置RTK平台资讯 sn %s device_model %s, imei %s, phone %02X%02X%02X%02X%02X%02X%02X%02X", p->device_sn, p->device_model, p->imei, p->phone[0], |
| | | DEBUG("配置RTK平台资讯 sn %s device_model %s, imei %s, phone %02X%02X%02X%02X%02X%02X%02X%02X, province %d city %d", |
| | | p->device_sn, p->device_model, p->imei, p->phone[0], |
| | | p->phone[1], |
| | | p->phone[2], |
| | | p->phone[3], |
| | | p->phone[4], |
| | | p->phone[5], |
| | | p->phone[6], |
| | | p->phone[7]); |
| | | p->phone[7], |
| | | p->province, |
| | | p->city); |
| | | |
| | | AppTimer_delete(ReqRtkPlatformConfigTimeout); |
| | | |
| | | strcpy(exceptSocket.domain_name, p->domain_name); |
| | | exceptSocket.port = p->port; |
| | | |
| | | if (deviceInfo.province != p->province || deviceInfo.city != p->city) { |
| | | GetUpgrade(p->province, p->city); |
| | | } |
| | | |
| | | deviceInfo.province = p->province; |
| | | deviceInfo.city = p->city; |
| | | strcpy((char *)deviceInfo.device_model, p->device_model); |
| | |
| | | // new Thread(new AutoUpdateMcuThread(this)).start(); |
| | | |
| | | upgrade = Upgrade.getInstance(getApplicationContext()); |
| | | upgrade.CheckUpgrade(); |
| | | |
| | | ringUri = GetRingIndex(this, "Antimony"); |
| | | // PlayRing(this, ringUri); |
| | |
| | | } |
| | | } |
| | | |
| | | public void GetUpgrade(int province, int city) { |
| | | if (upgrade != null) { |
| | | upgrade.CheckUpgrade(province, city); |
| | | } |
| | | } |
| | | |
| | | public void ConnectBluetooth(String name, String pin) { |
| | | if (mBluetooth != null && mChatService != null) { |
| | | Log.d(TAG, "执行蓝牙连接请求 " + name); |
| | |
| | | private static final String newProgramIndUrl = "http://upgrade.safeluck.com/ftp/aykj4/aks3.json"; |
| | | private static Upgrade instance = null; |
| | | private Context context; |
| | | private int province; |
| | | private int city; |
| | | |
| | | private DownloadManagerUtil downloadManagerUtil = null; |
| | | private InstallUtil installUtil = null; |
| | | private static final String SAVE_FILE_NAME = "aks3.apk"; |
| | |
| | | String result = CheckNewVersion(newProgramIndUrl); |
| | | |
| | | if (result != null) { |
| | | DfuFileInfo dfuFileInfo = parseJson(result, 53, 100); |
| | | DfuFileInfo dfuFileInfo = parseJson(result, province, city); |
| | | if (dfuFileInfo != null && dfuFileInfo.getValid()) { |
| | | if (dfuFileInfo.getAppVerCode() > 0 && dfuFileInfo.getAppUrl() != null) { |
| | | if (installUtil.getVerCode() < dfuFileInfo.getAppVerCode()) { |
| | |
| | | } |
| | | }; |
| | | |
| | | public void CheckUpgrade() { |
| | | public void CheckUpgrade(int province, int city) { |
| | | this.province = province; |
| | | this.city = city; |
| | | handlerCheckNewVersion.removeCallbacks(runnableCheckNewVersion); |
| | | handlerCheckNewVersion.postDelayed(runnableCheckNewVersion, 100); |
| | | } |