<protected-broadcast android:name="com.eqc.heartrate.action.SILENT_START"/>
<protected-broadcast android:name="com.enqualcomm.support.ACTION_ISCONNECTED"/>
<protected-broadcast android:name="com.eqc.deskclock.YUN_ALARM_CHANGE"/>
+ <protected-broadcast android:name="com.enqualcomm.support.sos"/>
<application
<action android:name="com.enqualcomm.support.CloseUnreadMsg"/>
<action android:name="android.intent.action.BATTERY_LOW"/>
<action android:name="com.enqualcomm.support.ACTION_MISSED_CALL_GET"/>
-<!-- <action android:name="com.eqc.heartrate.action.SILENT_START" />-->
+
+ <!-- <action android:name="com.eqc.heartrate.action.SILENT_START" />-->
</intent-filter>
</receiver>
public static final String ACTION_SCANPAIRMESSAGE = "com.enqualcomm.imessage.scanPairMessage";\r
\r
public static final String ACTION_SEDN_VIDOE_CALL_REQ = "com.enqualcomm.imessage.sendVideoCall";\r
- \r
+\r
+ public static final String ACTION_SEND_SOS_MSG = "com.enqualcomm.support.action_send_sos";\r
+\r
+ public static final String ACTION_SEND_EMEGENCY_LOCATION_START = "action.emegency.location.start";\r
+ public static final String ACTION_SEND_EMEGENCY_LOCATION_STOP = "action.emegency.location.stop";\r
+ public static final String ACTION_LOCAL_SOS_ACTION = "com.enqualcomm.support.local_sos";\r
+\r
public static final String ACTION_SEND_SOS_VIDEO_FILE = "com.enqualcomm.support.action_send_sos_video_file";\r
\r
public static final String ACTION_SEND_VIDEO_FILES = "com.enqualcomm.support.ACTION_SEND_VIDEO_FILES";\r
import android.util.Log;\r
import android.widget.Toast;\r
\r
+import com.enqualcomm.support.bean.ICLocation;\r
+import com.enqualcomm.support.utils.ServiceUtil;\r
import com.ic.jni.ICJniUtils;\r
import com.enqualcomm.support.Constants;\r
import com.enqualcomm.support.GSensorListener;\r
\r
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;\r
import static com.enqualcomm.support.Constants.ACTION_ALARM_ADD_DATAPOINTS;\r
+import static com.enqualcomm.support.Constants.ACTION_BATTERY_LOW_MSG;\r
import static com.enqualcomm.support.Constants.ACTION_EQC_ALARM;\r
import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;\r
+import static com.enqualcomm.support.Constants.ACTION_LOCAL_SOS_ACTION;\r
import static com.enqualcomm.support.Constants.ACTION_LOCATION_ALARM;\r
+import static com.enqualcomm.support.Constants.ACTION_SEND_EMEGENCY_LOCATION_START;\r
+import static com.enqualcomm.support.Constants.ACTION_SEND_EMEGENCY_LOCATION_STOP;\r
+import static com.enqualcomm.support.Constants.ACTION_SEND_SOS_MSG;\r
import static com.enqualcomm.support.Constants.HEART_ALARM;\r
import static com.enqualcomm.support.Constants.KEY_SAVE_STEP_COUNT;\r
import static com.enqualcomm.support.Constants.KEY_STEP_COUNT;\r
.append(TimeUtil.getSystemTime3())\r
.append(SimSignalUtil.hasSimCard(this)?" SIM ":" NoSIM ")\r
.append(sim.getNetworkType()==SimSignalUtil.IS_2G?"2G":(sim.getNetworkType()==SimSignalUtil.IS_3G)?"3G":(sim.getNetworkType()==SimSignalUtil.IS_4G?"4G":"unknown"))\r
- .append(" ").append(runtime.getSignalStrength())\r
+ .append(" [").append(runtime.getSignalStrength()+100).append(",Mini:").append(SimSignalUtil.getMinSignalStrength(sim.getNetworkType())).append("]")\r
.append("\n Connecttion ").append(this.connection.isServerConnected())\r
.append(" KeepAlive ").append(KeepAlive.isConnected)\r
.append("\n ServerConnected is ").append(runtime.isServerProtocolConnected())\r
AlarmWakeUp.isNeedWakeUpAlarm(CoreService.this.runtime);\r
}\r
};\r
+ private BroadcastReceiver broadcastSOSReceiver = new BroadcastReceiver() {\r
+ public void onReceive(Context param1Context, Intent param1Intent) {\r
+\r
+ StringBuilder stringBuilder2 = new StringBuilder();\r
+ stringBuilder2.append("broadcastReceiver action==");\r
+ stringBuilder2.append(param1Intent.getAction());\r
+ Logger.i(stringBuilder2.toString());\r
+\r
+ if (ACTION_SEND_EMEGENCY_LOCATION_START.equals(param1Intent.getAction())){\r
+ runtime.getLocationInstance().setWorkingMod(CUSTOM_MOD);\r
+ runtime.getLocationInstance().setLocation_cycle(1);\r
+ runtime.setPpgTestCycle(1);\r
+ setLocationAlarm(CUSTOM_MOD);\r
+ setHeartRateDetectAlarm(runtime.getPpgTestCycle());\r
+ setEmegencyLocationSTOPAlarm(5);\r
+ }else if (ACTION_LOCAL_SOS_ACTION.endsWith(param1Intent.getAction())){\r
+\r
+// if( param1Intent.getIntExtra("type", 1) == 1) {\r
+ setHeartRateDetectAlarm(runtime.getPpgTestCycle());\r
+ HeartRateManager.triggerPPGtest();\r
+\r
+ runtime.setAlarmType(false,runtime.getBatteryLow(),true,false);\r
+ //trigger AP10 报警定位\r
+ CoreService.this.locationClient.triggerSOSLocationProcess();\r
+ //开启紧急定位模式,GPS 优先1分钟一次定位,持续5分钟\r
+ runtime.getLocationInstance().setWorkingMod(CUSTOM_MOD);\r
+ runtime.getLocationInstance().setLocation_cycle(1);\r
+ setLocationAlarm(CUSTOM_MOD);\r
+ //SOS模式,心率测试1分钟一次,持续5分钟\r
+ runtime.setPpgTestCycle(1);\r
+ setHeartRateDetectAlarm(runtime.getPpgTestCycle());\r
+\r
+ //设置5分钟后结束紧急定位模式\r
+ setEmegencyLocationSTOPAlarm(5);\r
+\r
+ trigger_SOS_Call();\r
+\r
+ }\r
+ }\r
+ };\r
\r
+ private void trigger_SOS_Call(){\r
+ try {\r
+ Intent intent = new Intent("com.eqc.shutdown_sos");\r
+ intent.putExtra("type",1);\r
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r
+ this.startActivity(intent);\r
+ }catch (Exception e){\r
+ e.printStackTrace();\r
+ }\r
+ }\r
private static class ServerHandler implements ConnectionListener {\r
private final WeakReference<CoreService> mReference;\r
\r
return sendChatMessage;\r
}\r
\r
-\r
private void loadSettings(){\r
this.runtime.setPpgTestCycle(Config.getPPGTestCycle(this));\r
this.runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(this));\r
intentFilter.addAction("com.eqc.intent.action.callback.at");\r
registerReceiver(this.AtCallbackBroadcastReceiver, intentFilter);\r
\r
+ //添加SOSMSG 接收\r
+ intentFilter = new IntentFilter();\r
+ intentFilter.addAction(ACTION_SEND_EMEGENCY_LOCATION_START);\r
+ intentFilter.addAction(ACTION_LOCAL_SOS_ACTION);\r
+ registerReceiver(broadcastSOSReceiver,intentFilter);\r
+\r
+\r
//初始化Sim信号\r
this.mSignalUtil = SimSignalUtil.getInstance(this);\r
\r
//此处消息从timer来\r
setHeartRateDetectAlarm(runtime.getPpgTestCycle());\r
\r
+ }else if(ACTION_SEND_EMEGENCY_LOCATION_STOP.equals(paramIntent.getAction())){\r
+ //stop Emegency location Stop\r
+ loadSettings(); //回复之前的 工作模式即可\r
+ }else if (ACTION_BATTERY_LOW_MSG.equals(paramIntent.getAction())){\r
+\r
+ runtime.setAlarmType(false,runtime.getBatteryLow(),false,false);\r
+ //trigger AP10 报警定位\r
+ CoreService.this.locationClient.triggerSOSLocationProcess();\r
+\r
+ return Service.START_STICKY;\r
}\r
this.invokeHandlerServiceChain.processUserRequest(paramIntent, this.connection, this.runtime);\r
}\r
public void setHeartRateDetectAlarm(int heartRateDetectAlarmCycle){\r
AlarmHelper.setRealTimeAlarm(runtime.getContextProxy().context,heartRateDetectAlarmCycle,ACTION_HEATR_RATE_START);\r
}\r
+\r
+\r
+ public void setEmegencyLocationSTOPAlarm(int delayTimeInMinutes){\r
+ StringBuilder sb=new StringBuilder();\r
+ AlarmHelper.setRealTimeAlarm(runtime.getContextProxy().context,delayTimeInMinutes, ACTION_SEND_EMEGENCY_LOCATION_STOP);\r
+ sb.append(" tEmegencyLocationSTOPAlarm "+ACTION_SEND_EMEGENCY_LOCATION_STOP);\r
+ Logger.i(sb.toString());\r
+ if (Config.LOG_TOFILE) FileOutputUtil.fileOutput(runtime.getCacheDir(),"LocationAlarm",sb.toString());\r
+ }\r
public void setLocationAlarm(int mod) {\r
// int mod=runtime.getLocationInstance().getWorkingMod();\r
StringBuilder sb=new StringBuilder();\r
private SimSignalUtil mSignalUtil;\r
\r
private NMEAListener nmeaListener;\r
- \r
+\r
+ private boolean startSOSLocation=false;\r
private int preLbsCid;\r
\r
int preNetworkTypeNomber;\r
public void triggerLocationProcess(){\r
mhandler.sendEmptyMessage(0);\r
}\r
- \r
+\r
+ public void triggerSOSLocationProcess(){\r
+ mhandler.sendEmptyMessage(2);\r
+ }\r
\r
private static int checktimes=0;\r
private static boolean timeout=false;\r
});\r
}else if (msg.what == 0){\r
startLocationProcess(runtime.getLocationInstance().getWorkingMod());\r
+ }else if (msg.what == 2){\r
+ startSOSLocation=true;//启动SOS定位,为了快速响应,只要wifi定位即可。\r
+ forceLocation=1;\r
+ startLocationProcess(ICLocation.NORMAL_MOD);\r
}\r
\r
\r
switch(mode){\r
case ICLocation.EMERGNECY_MOD:\r
case ICLocation.REALTIME_MOD:\r
+ case ICLocation.CUSTOM_MOD:\r
\r
- //GPS 优先的话多给些时间(10秒)\r
+ //GPS 优先的话多给些时间(10秒)\r
if (checktimes> 50) timeout=true;\r
\r
- if ((lbs_ok && timeout==true) ||(lbs_ok && gps_ok && wifi_ok )||(lbs_ok&&gps_nosignal&&wifi_ok)){\r
+ if ((lbs_ok && timeout==true) ||(lbs_ok && ( gps_ok || startSOSLocation==true ) && wifi_ok )||(lbs_ok&&gps_nosignal&&wifi_ok)){\r
+\r
\r
- String AP01_CMD=protocolAPIHelper.AP01(runtime);\r
+ if (startSOSLocation==true){\r
\r
- Deliver.sendLocationMSG(AP01_CMD);\r
+ String AP10_CMD = protocolAPIHelper.AP10(runtime);\r
+ Deliver.sendLocationMSG(AP10_CMD);\r
+ startSOSLocation=false;\r
\r
+ }else {\r
+ String AP01_CMD = protocolAPIHelper.AP01(runtime);\r
+ Deliver.sendLocationMSG(AP01_CMD);\r
+ }\r
\r
\r
if (mTimer!=null){\r
\r
if ((lbs_ok && timeout==true) ||(lbs_ok && wifi_ok )){\r
\r
- String AP01_CMD=protocolAPIHelper.AP01(runtime);\r
- Deliver.sendLocationMSG(AP01_CMD);\r
+ String locationtype="LBS";\r
+ if (wifi_ok){\r
+ locationtype="WiFi";\r
+ }\r
+ runtime.getLocationInstance().setLocationType(locationtype);\r
+ runtime.getLocationInstance().setLocationTime(TimeUtil.getSystemTime3());\r
+\r
+ if (startSOSLocation==true){\r
+ String AP10_CMD = protocolAPIHelper.AP10(runtime);\r
+ Deliver.sendLocationMSG(AP10_CMD);\r
+ startSOSLocation=false;\r
+\r
+ }else {\r
+ String AP01_CMD = protocolAPIHelper.AP01(runtime);\r
+ Deliver.sendLocationMSG(AP01_CMD);\r
+ }\r
\r
if (mTimer!=null){\r
mTimer.cancel();\r
}\r
isLocating = false;\r
\r
- String locationtype="LBS";\r
- if (wifi_ok){\r
- locationtype="WiFi";\r
- }\r
- runtime.getLocationInstance().setLocationType(locationtype);\r
- runtime.getLocationInstance().setLocationTime(TimeUtil.getSystemTime3());\r
+\r
\r
}else if (timeout==true){\r
Logger.i("timeout no location ");\r
}\r
\r
// 不强制定位 且 WorkingMod 不是紧急模式,且 没有移动过\r
- if ( !(( forceLocation == 1 ) || ( mod == 4 )) && ( runtime.getLastStepCount() == runtime.getTotalStepCount()) ){\r
+ if ( !(( forceLocation == 1 ) || ( mod == ICLocation.REALTIME_MOD ) || (mod == ICLocation.CUSTOM_MOD)) && ( runtime.getLastStepCount() == runtime.getTotalStepCount()) ){\r
Logger.i("No Move ,skip location!");\r
return ;\r
}\r
switch(mod){\r
case ICLocation.EMERGNECY_MOD:\r
case ICLocation.REALTIME_MOD:\r
+ case ICLocation.CUSTOM_MOD:\r
startGpsLocate();\r
break;\r
}\r
import com.enqualcomm.support.bean.Runtime;\r
import com.enqualcomm.support.utils.FileOutputUtil;\r
import com.enqualcomm.support.utils.Logger;\r
+import com.enqualcomm.support.utils.SimSignalUtil;\r
\r
import java.util.Collections;\r
import java.util.Comparator;\r
}\r
}\r
\r
+\r
+\r
public interface OnWiFiInfoListener {\r
void getWifiInfoCallBack(String var1);\r
}\r
.append(ds.getLBSData()).append(CMDSPLIT)\r
.append(ds.getAlarmType()).append(CMDSPLIT)\r
.append(ds.getLanguage()).append(CMDSPLIT)\r
- .append(0).append(CMDSPLIT) //不回复地址\r
+ .append("00").append(CMDSPLIT) //不回复地址\r
.append(ds.getWifiInfo()).append(CMDEND).toString();\r
\r
}\r
Config.setLocationCycle(runtime.getContextProxy().context,Integer.valueOf(time));\r
runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(runtime.getContextProxy().context));\r
runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(runtime.getContextProxy().context));\r
+ //set AlarmCycle and trigger Location\r
CoreService.getInstance().setLocationAlarm(runtime.getLocationInstance().getWorkingMod());\r
-\r
-\r
}else{\r
Logger.i("BP15 format error");\r
}\r
\r
import static android.telephony.TelephonyManager.CALL_STATE_OFFHOOK;\r
import static android.telephony.TelephonyManager.CALL_STATE_RINGING;\r
+import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;\r
\r
public class SilentManager extends AbstractInvokeHandlerService {\r
private static final long ONE_WEEK = 604800000L;\r
switch(var1) {\r
case 0:\r
SilentManager.this.isCalling = false;\r
- if (SilentManager.this.haveHandSilence) {\r
- SilentManager.this.handSilence(SilentManager.this.mContext, SilentManager.this.mValue_isSilence);\r
- }\r
+// if (SilentManager.this.haveHandSilence) {\r
+// SilentManager.this.handSilence(SilentManager.this.mContext, SilentManager.this.mValue_isSilence);\r
+// }\r
break;\r
case 1:\r
SilentManager.this.isCalling = true;\r
- Intent var3 = new Intent();\r
- var3.setAction("com.enqualcomm.support.CloseUnreadMsg");\r
- SilentManager.this.mContext.sendBroadcast(var3);\r
+// Intent var3 = new Intent();\r
+// var3.setAction("com.enqualcomm.support.CloseUnreadMsg");\r
+// SilentManager.this.mContext.sendBroadcast(var3);\r
break;\r
case 2:\r
SilentManager.this.isCalling = true;\r
\r
this.mInterval = var5.interval;\r
if (!var1) {\r
- AlarmHelper.setRealTimeAlarm(this.mContext, Integer.parseInt(this.mInterval), "com.eqc.heartrate.action.SILENT_START");\r
- this.mRuntime.getContextProxy().sendStheartRateBroadcast("com.eqc.heartrate.action.SILENT_START", 0);\r
+// AlarmHelper.setRealTimeAlarm(this.mContext, Integer.parseInt(this.mInterval), ACTION_HEATR_RATE_START);\r
+// this.mRuntime.getContextProxy().sendStheartRateBroadcast(ACTION_HEATR_RATE_START, 0);\r
}\r
\r
var1 = true;\r
import android.os.Build;\r
\r
import com.enqualcomm.support.Config;\r
+import com.enqualcomm.support.CoreService;\r
import com.enqualcomm.support.bean.Runtime;\r
\r
import static android.content.Context.BATTERY_SERVICE;\r
+import static com.enqualcomm.support.Constants.ACTION_BATTERY_LOW_MSG;\r
\r
public class BatteryUtil {\r
private BroadcastReceiver batteryChangedReceiver = new BroadcastReceiver() {\r
if ("android.intent.action.BATTERY_LOW".equals(param1Intent.getAction())) {\r
BatteryUtil.this.mRuntime.setBatteryLow(true);\r
Logger.i("lowbattery finish video_end_call");\r
+\r
+\r
ComponentName componentName = new ComponentName("com.enqualcomm.support", "com.enqualcomm.support.CoreService");\r
- Intent intent = (new Intent("com.enqualcomm.support.lowbatteryMsg")).setComponent(componentName);\r
+ Intent intent = (new Intent(ACTION_BATTERY_LOW_MSG)).setComponent(componentName);\r
(mRuntime.getContextProxy()).context.startService(intent);\r
}\r
}\r
import android.view.WindowManager;\r
\r
\r
+import com.enqualcomm.support.CoreService;\r
+import com.enqualcomm.support.LocationClient;\r
import com.enqualcomm.support.R;\r
import com.enqualcomm.support.bean.NotificationParam;\r
import com.ic.jni.ICJniUtils;\r
import static android.os.PowerManager.SCREEN_DIM_WAKE_LOCK;\r
import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;\r
import static com.enqualcomm.support.Constants.ACTION_REMOTE_CAMERA;\r
+import static com.enqualcomm.support.Constants.ACTION_SEND_EMEGENCY_LOCATION_START;\r
+import static com.enqualcomm.support.Constants.ACTION_SEND_SOS_MSG;\r
import static com.enqualcomm.support.Constants.RESUME_ACTION;\r
import static com.enqualcomm.support.Constants.SOS_ACTION;\r
import static com.enqualcomm.support.Constants.STEP_COUNT_ALARM_ACTION;\r
ICJniUtils.resetStepCount();\r
AlarmHelper.setCleanStepCountAlarm(paramContext, 23, 59, STEP_COUNT_ALARM_ACTION);\r
return;\r
- }\r
- if (RESUME_ACTION.equals(str)) {\r
+ }else if (RESUME_ACTION.equals(str)) {\r
SharPreferenceUtil.setPrefBoolean(paramContext, "key_is_resume", paramIntent.getBooleanExtra("is_resume", false));\r
return;\r
- }\r
- if (SOS_ACTION.equals(str)) {\r
- if (paramIntent.getIntExtra("sos_end", 0) == 0) {\r
- sendStheartRateBroadcast(paramContext, ACTION_HEATR_RATE_START, 3);\r
- return;\r
- }\r
- } else {\r
- String str1;\r
- if (ACTION_REMOTE_CAMERA.equals(str)) {\r
+ }else if (ACTION_REMOTE_CAMERA.equals(str)) {\r
+ String str1;\r
str1 = paramIntent.getStringExtra("key_remote_number");\r
(new CameraUtil(paramContext)).getPictur(str1);\r
return;\r
- }\r
+\r
}\r
\r
\r
\r
this.screenOn(paramContext);\r
}\r
- } else if ("com.enqualcomm.imessage.SOS_ACTION".equals(str)) {\r
- if (paramIntent.getIntExtra("sos_end", 0) == 0) {\r
-// EqcAlgorithmNative.native_EqcAlgorithmMethod3(8);\r
- this.sendStheartRateBroadcast(paramContext, "com.eqc.heartrate.action.SILENT_START", 3);\r
- //trigger AP10 报警定位\r
- }\r
- } else if ("com.enqualcomm.support.ACTION_REMOTE_CAMERA".equals(paramIntent.getAction())) {\r
- String var7 = paramIntent.getStringExtra("key_remote_number");\r
- (new CameraUtil(paramContext)).getPictur(var7);\r
} else if (!"com.enqualcomm.support.CloseUnreadMsg".equals(paramIntent.getAction()) && !"android.intent.action.BATTERY_LOW".equals(paramIntent.getAction())) {\r
if ("com.enqualcomm.support.ACTION_MISSED_CALL_GET".equals(str)) {\r
Contact var8 = (Contact)paramIntent.getParcelableExtra("contact");\r
intent.putExtra("stheartRateType", paramInt);\r
paramContext.sendBroadcast(intent);\r
}\r
-\r
+ public void sendSOSBroadcast(Context paramContext, String actionStr) {\r
+ Intent intent = new Intent();\r
+ intent.setAction(actionStr);\r
+ paramContext.sendBroadcast(intent);\r
+ }\r
\r
\r
}\r
stringBuilder.append(paramInt2);\r
Logger.i(stringBuilder.toString());\r
}\r
-\r
+ public static int getMinSignalStrength(int NetworkType) {\r
+ byte b2 = -105;\r
+ switch (NetworkType) {\r
+ case SimSignalUtil.IS_2G:\r
+ case SimSignalUtil.IS_3G:\r
+ break;\r
+ case SimSignalUtil.IS_4G:\r
+ b2 = -100;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ return b2;\r
+ }\r
public static boolean hasSimCard(Context context) {\r
\r
TelephonyManager telMgr = (TelephonyManager)\r
result = false;\r
break;\r
}\r
- Logger.i( result ? "有SIM卡" : "无SIM卡");\r
+// Logger.i( result ? "有SIM卡" : "无SIM卡");\r
return result;\r
}\r
\r