<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes"/>\r
<exclude-output/>\r
<content url="file://$MODULE_DIR$">\r
- <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true"/>\r
- <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true"/>\r
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true"/>\r
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true"/>\r
- <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true"/>\r
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true"/>\r
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true"/>\r
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":638,"versionName":"2009281042","enabled":true,"outputFile":"ICSer_V638_2009281042_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V638_2009281042_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":642,"versionName":"2010121415","enabled":true,"outputFile":"ICSer_V642_2010121415_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V642_2010121415_release.apk","properties":{}}]
\ No newline at end of file
package com.enqualcomm.support;\r
\r
import android.content.Context;\r
-import android.content.SharedPreferences;\r
import android.provider.Settings;\r
import android.text.TextUtils;\r
\r
import com.enqualcomm.support.utils.Util;\r
import com.ic.jni.ICJniUtils;\r
import com.ic.protocols.protocolAPIHelper;\r
-import com.sina.util.dnscache.log.FileUtil;\r
\r
import org.json.JSONException;\r
import org.json.JSONStringer;\r
\r
-import java.io.File;\r
-import java.util.ArrayList;\r
import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.concurrent.TimeUnit;\r
\r
-import static com.enqualcomm.support.utils.Util.connectWifiByReflectMethod;\r
import static com.enqualcomm.support.utils.Util.getSystemProperties;\r
\r
public class Config {\r
public static int sw_release_no = -1;\r
public static int bleScanTimeout=10;\r
public static boolean forceMoveCheck=true;\r
- public static String work_mode = "2@1";\r
+ public static boolean forceWearCheck=true;\r
\r
- public static final String JiAiHost="watch.jiai.pro";\r
- public static final int JiAiPort=8090;\r
- public static final String BeehomeHost="device.beehome360.com";\r
- public static final int BeehomePort=5111;\r
\r
public static final String DefaultLogFtpServer="icfota.snicker.com.cn";\r
public static final String DefaultLogFtpUser="ftpuser";\r
final static String KeySOSNumbersList="SOSNumbersList";\r
\r
final static String KeyIMEI = "persist.sys.protocol_IMEI";\r
+ public final static String KeyQRURIFILE = "persist.sys.qrUriFile";\r
+\r
final static String KeyPractiseState = "persist.sys.practising";\r
\r
final static String KeyHeartBeatCycle="ServerHeartBeatCycle";\r
\r
public static final String WEATHER_ALARM = "com.ic.alarm.ACTION_WEATHER_ALARM";\r
public static final String WEATHER_ACTION = "com.ic.action.ACTION_GET_WEATHER";\r
+ public static final String ACTION_QUERY_WEATHER = "com.ic.action_query_weather";\r
+ public static final String ACTION_WEATHER_RECEIVED = "com.ic.action_weather_recveived";\r
+ public static final String KEY_Weather = "weather";\r
+\r
\r
public static final int WIFI_SET_RESULT = 217;\r
\r
var3.append("screen on wake is_wifi_network_ok=");\r
var3.append(CoreService.is_wifi_network_ok);\r
ICLogger.i(var3.toString());\r
+ //检测电池电量 并上报低电报警\r
+ batteryUtil.getBatteryLevel(param1Context);\r
if (CoreService.is_in_sleep_mode) {\r
\r
/*屏幕亮起时,如果在sleep模式(夜晚的那个睡眠模式,非系统休眠,暂时没实现,还不会跑到这里),则唤醒各个进程*/\r
// ICLogger.i("");\r
// }\r
}\r
+ //检测电池电量 并上报低电报警\r
+ batteryUtil.getBatteryLevel(this);\r
setHeartAlarm();\r
if (Config.LOG_TOFILE)\r
ICLogger.logToFile("alarmCycle", "HEART_ALARM alarmCycle ");\r
}\r
}\r
\r
-\r
this.invokeHandlerServiceChain.processUserRequest(paramIntent, this.connection, this.runtime);\r
\r
}\r
public class BTHelper {\r
\r
private BluetoothAdapter mBtAdapter;\r
- private ArrayList<String> mPairedDevicesArray=new ArrayList<>();\r
- private ArrayList<String> mNewDevicesArray=new ArrayList<>();\r
+ private static ArrayList<String> mPairedDevicesArray=new ArrayList<>();\r
+ private static ArrayList<String> mNewDevicesArray=new ArrayList<>();\r
private Context mContext=null;\r
private BTScanCallback mCallback=null;\r
private static BTHelper mBThelper=null;\r
public void onLeScan(BluetoothDevice bluetoothDevice, int rssi, byte[] scanRecode) {\r
// ICLogger.i( "BT onLeScan "+bluetoothDevice.getName()+" "+bluetoothDevice.getAddress()+" rssi "+rssi);\r
// ICLogger.logToFile("LBS","BT onLeScan "+bluetoothDevice.getName()+" "+bluetoothDevice.getAddress()+" rssi "+rssi );\r
- if(!mNewDevicesArray.contains(bluetoothDevice.getAddress()))\r
+ boolean found=false;\r
+ for (String dev: mNewDevicesArray){\r
+ if (dev.contains(bluetoothDevice.getAddress())) {\r
+ found = true;\r
+ break;\r
+ }\r
+ }\r
+ if(!found)\r
mNewDevicesArray.add(bluetoothDevice.getAddress()+","+rssi);\r
}\r
};\r
new Handler().postDelayed(new Runnable() {\r
@Override\r
public void run() {\r
- mBtAdapter.stopLeScan(lecallback);\r
ICLogger.i("BT stopLeScan");\r
+ mBtAdapter.stopLeScan(lecallback);\r
\r
//开始扫描前是关闭的,就关闭它\r
- if(!enabledBeforScan)\r
+// if(!enabledBeforScan)\r
disableBT();\r
\r
if (mCallback!=null)\r
ICLogger.i("checkSrvResponse 成功,停止检测!");\r
stopResponseCheckTimer();\r
}else{\r
+ //心跳发送失败,则认为已经和服务器断开\r
+ mRuntime.setServerProtocolConnected(false);\r
//如果重试次数大于等于 最大重试次数,则停止重试,等下次心跳时间再行尝试。\r
if (hearBeatResendCount >= MaxHeartbeatResendTime){\r
ICLogger.i("checkSrvResponse "+hearBeatResendCount+"次 >= "+MaxHeartbeatResendTime+" , 则停止重试,等下次心跳时间再行尝试!");\r
\r
\r
if (Config.LOG_TOFILE) ICLogger.logToFile("Battery","BatteryLow less than 15%!");\r
- //没有充电,上次电池level > 15% , 上次电池并且不是 低电状态,则报警\r
- if (mRuntime.isPowerConnected()==false && mRuntime.getBatterylevel()<15 && mRuntime.getBatteryLow()==false) {\r
- send_batterylow_event_broadcast(param1Context, 1);\r
- play_waning_notify(param1Context);\r
- mRuntime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
- //trigger AP10 报警定位\r
- Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(mRuntime));\r
- }\r
+ checkAndSendBatteryEvent(param1Context,mRuntime);\r
mRuntime.setBattery(String.format("%03d",batLevel));\r
mRuntime.setBattery(batLevel);\r
mRuntime.setHaveBatteryChange(true);\r
} else {\r
\r
if (Config.LOG_TOFILE) ICLogger.logToFile("Battery","BatteryLow less than 5% !");\r
- //没有充电,上次电池level > 15% , 上次电池并且不是 电池低电状态,则报警\r
- if (mRuntime.isPowerConnected()==false && mRuntime.getBatterylevel()< 5 ) {\r
- send_batterylow_event_broadcast(param1Context, 1);\r
-\r
- play_waning_notify(param1Context);\r
- mRuntime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
- //trigger AP10 报警定位\r
- Deliver.sendLocationMSG( protocolAPIHelper.getWarningMSG(mRuntime));\r
-\r
- }\r
+ checkAndSendBatteryEvent(param1Context,mRuntime);\r
mRuntime.setBattery(String.format("%03d",batLevel));\r
mRuntime.setBattery(batLevel);\r
mRuntime.setHaveBatteryChange(true);\r
private Handler mHandler=null;\r
PowerManager.WakeLock mWakeLock = null;\r
\r
- private void play_waning_notify(Context context){\r
+ private static void play_waning_notify(Context context){\r
AudioService.getInstance().play(context.getAssets(), "warning.mp3");\r
}\r
+\r
+ public static void checkAndSendBatteryEvent(Context context, Runtime runtime){\r
+\r
+ //没有充电,上次电池level > 15% , 上次电池并且不是 低电状态,则报警\r
+ if (runtime.isPowerConnected()==false && runtime.getBatterylevel()<15 && runtime.getBatteryLow()==false) {\r
+ Intent intent=new Intent();\r
+ intent.setAction(ACTION_BATTERYLOW);\r
+ intent.putExtra(KEY_BATTERY_EVENT,1);\r
+ context.sendBroadcast(intent);\r
+ play_waning_notify(context);\r
+ runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
+ //trigger AP10 报警定位\r
+ Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
+ }else if (runtime.isPowerConnected()==false && runtime.getBatterylevel()< 5 ) {\r
+ //没有充电,上次电池level > 15% , 上次电池并且不是 电池低电状态,则报警\r
+ Intent intent=new Intent();\r
+ intent.setAction(ACTION_BATTERYLOW);\r
+ intent.putExtra(KEY_BATTERY_EVENT,1);\r
+ context.sendBroadcast(intent);\r
+ play_waning_notify(context);\r
+ runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
+ //trigger AP10 报警定位\r
+ Deliver.sendLocationMSG( protocolAPIHelper.getWarningMSG(runtime));\r
+ }\r
+ }\r
private void send_batterylow_event_broadcast(Context context,int batlow){\r
mHandler.post(new Runnable() {\r
@Override\r
(this.mRuntime.getContextProxy()).context.registerReceiver(this.batteryChangedReceiver, intentFilter);\r
}\r
\r
- public int getBatteryLevel(Context context){\r
+ public int getBatteryLevel(Context context) {\r
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\r
// BatteryManager batteryManager = (BatteryManager)context.getSystemService(BATTERY_SERVICE);\r
// return batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);\r
// } else {\r
- Intent intent = new ContextWrapper(context.getApplicationContext()).registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));\r
- return (intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) * 100) /\r
- intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);\r
-// }\r
+ Intent intent = new ContextWrapper(context.getApplicationContext()).registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));\r
+ int batLevel = (intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) * 100) /\r
+ intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);\r
+\r
+ if( batLevel>=15) {\r
+\r
+\r
+ }else if (batLevel<15 && batLevel >= 5) {\r
+ if (Config.LOG_TOFILE) ICLogger.logToFile("Battery","BatteryLow less than 15%!");\r
+ checkAndSendBatteryEvent(context,mRuntime);\r
+ mRuntime.setBattery(String.format("%03d",batLevel));\r
+ mRuntime.setBattery(batLevel);\r
+ mRuntime.setHaveBatteryChange(true);\r
+ mRuntime.setBatteryLow(true);\r
+ } else {\r
+ if (Config.LOG_TOFILE) ICLogger.logToFile("Battery","BatteryLow less than 5% !");\r
+ checkAndSendBatteryEvent(context,mRuntime);\r
+ mRuntime.setBattery(String.format("%03d",batLevel));\r
+ mRuntime.setBattery(batLevel);\r
+ mRuntime.setHaveBatteryChange(true);\r
+ mRuntime.setBatteryLow(true);\r
+ }\r
+ return batLevel;\r
}\r
\r
\r
Intent intent = new Intent();\r
intent.setAction(ACTION_ISCONNECTED);\r
intent.putExtra("isConnected", paramBoolean);\r
+ Util.setSystemProperties("persist.sys.server_connected",paramBoolean?"true":"false");\r
this.context.sendBroadcast(intent);\r
}\r
\r
\r
SimSignalUtil sim=SimSignalUtil.getInstance(runtime.getContextProxy().context);\r
double wrist_temp;\r
- wrist_temp=TemperatureUtil.get_temp_value_adjusted();\r
+// wrist_temp=TemperatureUtil.get_temp_value_adjusted();\r
return new StringBuilder()\r
.append(TimeUtil.getLocalTime2()).append(" ").append(DeviceInfoUtil.getSWVersionDisplayName()).append("\n")\r
.append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))\r
.append(runtime.IMEI())\r
.append("\n Srv [P").append(Config.protocol_no).append(" ").append(runtime.getHost()).append(":").append(runtime.getPort()).append("]").append(KeepAlive.isConnected).append(" , HBcycle ").append(runtime.getHeartBeatCycle())\r
.append("\n ServerConnected is ").append(runtime.isServerProtocolConnected())\r
- .append(",Temp ").append(String.format("%1$.2f",wrist_temp)).append(",Body ").append(String.format("%1$.2f",TemperatureUtil.getBodyTemp(wrist_temp,26.0f)))\r
+// .append(",Temp ").append(String.format("%1$.2f",wrist_temp)).append(",Body ").append(String.format("%1$.2f",TemperatureUtil.getBodyTemp(wrist_temp,26.0f)))\r
.append(" \n Bat ").append(runtime.getBattery()).append(",").append(runtime.getBatteryVotage())\r
.append(" charged ").append(runtime.isPowerConnected())\r
.append(" StepCount ").append(runtime.getTotalStepCount())\r
public static String getShortDeviceInfo(Runtime runtime){\r
\r
SimSignalUtil sim=SimSignalUtil.getInstance(runtime.getContextProxy().context);\r
- double wrist_temp=TemperatureUtil.get_temp_value_adjusted();\r
+// double wrist_temp=TemperatureUtil.get_temp_value_adjusted();\r
return new StringBuilder("Firmware ")\r
.append(DeviceInfoUtil.getSWVersionDisplayName()).append("\nProtocol ")\r
.append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))\r
.append(",T").append(runtime.getLocationInstance().getLocationType())\r
.append(",").append(runtime.getLocationInstance().getLocationTime())\r
.append("]\nPPG[C").append(runtime.getPpgTestCycle())\r
- .append(",P").append(runtime.getHRS().getPPG())\r
- .append(",H").append(runtime.getHRS().getBPH())\r
- .append(",L").append(runtime.getHRS().getBPL())\r
- .append(",T").append(String.format("%1$.2f",wrist_temp))\r
- .append(",TA").append(String.format("%1$.2f",TemperatureUtil.getBodyTemp(wrist_temp,26.0f)))\r
- .append(",").append(runtime.getHRS().getTestTime()).append("]")\r
+// .append(",P").append(runtime.getHRS().getPPG())\r
+// .append(",H").append(runtime.getHRS().getBPH())\r
+// .append(",L").append(runtime.getHRS().getBPL())\r
+// .append(",T").append(String.format("%1$.2f",wrist_temp))\r
+// .append(",TA").append(String.format("%1$.2f",TemperatureUtil.getBodyTemp(wrist_temp,26.0f)))\r
+// .append(",").append(runtime.getHRS().getTestTime()).append("]")\r
.toString();\r
}\r
\r
},500);\r
}\r
\r
+ public static final String ACTION_TEMP_RESULT = "com.ic.action.temp_result";\r
+ public static final String KEY_TEMP_BODY = "body"; // double 体温\r
+ public static final String KEY_TEMP_WRIST = "wrist"; // double 腕温\r
+ private static void sendTempBroadcast(double value, double animal) {\r
+ Intent pedIntent = new Intent();\r
+ pedIntent.setAction(ACTION_TEMP_RESULT);\r
+ pedIntent.putExtra(KEY_TEMP_WRIST, value);\r
+ pedIntent.putExtra(KEY_TEMP_BODY, animal);\r
+ if(CoreService.getInstance()!=null)\r
+ CoreService.getInstance().sendBroadcast(pedIntent);\r
+ }\r
public static void DoTempTest(){\r
if (ICJniUtils.isTemperatureDevAvailable() >ICJniUtils.TempSensorType.TEMPSENSOR_TYPE_NONE.ordinal()) {\r
\r
\r
Runtime runtime = CoreService.getInstance().getRuntime();\r
runtime.tempInfo.setTemp(body_temp, wrist_temp);\r
+\r
+ //发送消息给launcher显示\r
+ sendTempBroadcast(wrist_temp,body_temp);\r
+\r
ICJniUtils.disableTemperature();\r
\r
//体温异常报警检测开启的会进行异常报警\r
mqtt_client.setSubscriptTopicHeader(topic_header);\r
mqtt_client.attemptSubscribeToTopic(topic_header+"+");\r
isServerconnected=true;\r
- mRuntime.setServerProtocolConnected(true);\r
+// mRuntime.setServerProtocolConnected(true);\r
if (listener!=null)\r
listener.onConnectionOpen();\r
\r
import android.os.Handler;\r
\r
import com.enqualcomm.support.Config;\r
+import com.enqualcomm.support.Constants;\r
import com.enqualcomm.support.CoreService;\r
import com.enqualcomm.support.R;\r
import com.enqualcomm.support.bean.Alarm;\r
import com.enqualcomm.support.utils.WakeLockUtil;\r
\r
import java.io.File;\r
+import java.io.FileOutputStream;\r
import java.util.ArrayList;\r
import java.util.Date;\r
import java.util.HashMap;\r
+import java.util.Locale;\r
\r
import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;\r
import static com.enqualcomm.support.Constants.ACTION_REMOTE_CAMERA;\r
BP85,//设置闹钟\r
AP86,\r
BP86,//绑定解绑\r
+ AP87,\r
+ BP87,//二维码更新\r
AP88,\r
BP88,//查找手表\r
AP89,\r
BPDH,\r
AP99,//监听电话\r
BP99,\r
+ APTQ,//天气\r
+ BPTQ,\r
UNKNOWN_CMD,\r
}\r
\r
cmdMap.put(CMD_TYPE.BP85, "BP85");\r
cmdMap.put(CMD_TYPE.AP86, "AP86");\r
cmdMap.put(CMD_TYPE.BP86, "BP86");\r
+ cmdMap.put(CMD_TYPE.AP87, "AP87");\r
+ cmdMap.put(CMD_TYPE.BP87, "BP87");\r
cmdMap.put(CMD_TYPE.AP88, "AP88");\r
cmdMap.put(CMD_TYPE.BP88, "BP88");\r
cmdMap.put(CMD_TYPE.AP89, "AP89");\r
cmdMap.put(CMD_TYPE.BPDH, "BPDH");\r
cmdMap.put(CMD_TYPE.AP99, "AP99");\r
cmdMap.put(CMD_TYPE.BP99, "BP99");\r
+ cmdMap.put(CMD_TYPE.APTQ, "APTQ");\r
+ cmdMap.put(CMD_TYPE.BPTQ, "BPTQ");\r
\r
}\r
\r
\r
try {\r
Config.setLocationMode(runtime.getContextProxy().context, ICLocation.CUSTOM_MOD8_GPS);\r
- Config.setLocationCycle(runtime.getContextProxy().context, Integer.parseInt(time) * 60);\r
+ Config.setLocationCycle(runtime.getContextProxy().context, Integer.parseInt(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
}\r
\r
}\r
+\r
+\r
+\r
//17.设置心率/血压测量周期(下行协议号:BP86,响应:AP86)\r
public static StringMessage AP86(String index){\r
\r
ICLogger.i("BP86 format error!");\r
}\r
\r
+ }\r
+\r
+ //IWBP87,http://cn.map20000.com/physicalReport.html?lang=zh-CN&imeis=866671044898063#\r
+ public static StringMessage AP87(){\r
+\r
+ //设备响应: IWAP86, 080835#\r
+ //080835:指令流水号\r
+ return genStringMessage("AP87",new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP87))\r
+ .append(CMDEND).toString());\r
+ }\r
+\r
+ public void handleBP87(String cmd,Connection connection,Runtime runtime){\r
+\r
+ //IWBP87,http://cn.map20000.com/physicalReport.html?lang=zh-CN&imeis=866671044898063#\r
+\r
+ String[] list=cmd.split(CMDSPLIT);\r
+\r
+ if (list.length==2){\r
+ String furl=list[1];//.replace("#","");\r
+ ICLogger.i("收到服务器指令 BP87:Qrcode url "+furl);\r
+// connection.send(AP87());\r
+ try {\r
+ String qrfilepath=Util.getLogfilePath(runtime,TimeUtil.getSystemDateYYMMDD());\r
+ Util.setSystemProperties(Config.KeyQRURIFILE,qrfilepath);\r
+ FileOutputStream fos=new FileOutputStream(new File(qrfilepath));\r
+ fos.write(furl.getBytes());\r
+ fos.close();\r
+ }catch (Exception e){\r
+ ICLogger.e(e.getMessage(),e);\r
+ }\r
+ }else{\r
+ ICLogger.i("BP87 format error!");\r
+ }\r
+\r
}\r
public static StringMessage AP88(String index){\r
//设备响应: IWAP88, 080835#\r
}\r
}\r
\r
+ public static StringMessage APTQ(Runtime runtime)\r
+ {\r
+ /**\r
+ * IWAPTQ,460,0,9520,3671,0#\r
+ * APTQ : 命令字符\r
+ * 460,0,9520,3671基站信息\r
+ * 0:语言标志位 0 默认为中文,1为英文\r
+ */\r
+ //或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题\r
+ Locale locale = Locale.getDefault();\r
+ String lang = locale.getLanguage() + "-" + locale.getCountry();\r
+ int language=0;\r
+ if(!lang.contains("zh"))\r
+ {\r
+ language=1;\r
+ }\r
+ return genStringMessage("APTQ",new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APTQ))\r
+ .append(CMDSPLIT).append(runtime.getLocationInstance().getMCC())\r
+ .append(CMDSPLIT).append(runtime.getLocationInstance().getMNC())\r
+ .append(CMDSPLIT).append(runtime.getLocationInstance().getLAC())\r
+ .append(CMDSPLIT).append(runtime.getLocationInstance().getGSMStationCID())\r
+ .append(CMDSPLIT).append(language)\r
+ .append(CMDEND).toString());\r
+ }\r
+\r
+\r
+ public void handleBPTQ( Connection connection,Runtime runtime,String cmd) {\r
+ /***\r
+ *\r
+ * IWBPTQ,20-10-11,19:32:02,6674,32,27,22,30,20-10-12,19:32:02,6674,32,27,22,30,20-10-13,19:32:02,6674,32,27,22,30,53575C71533A\r
+ * IWBPTQ, 16-09-24,11:00:00,b6e0d4c6,2,-5,-12,22,16-09-25,11:00:00,b6e0d4c6,2,-5,-12,22,16-09-26,11:00:00,b6e0d4c6,2,-5,-12,22,316df15733#\r
+ * 年-月-日,时:分:秒,天气描述,天气编号,当前温度,最低温,最高温,年-月-日,时:分:秒,天气描述,天气编号,当前温度,最低温,最高温,年-月-日,时:分:秒,天气描述,天气编号,当前温度,最低温,最高温,城市名\r
+ * 注:天气描述用Unicode编码,城市名使用Unicode编码, 第一组为当天,后2组依次为后续2天天气\r
+ * 如天气编号及描述对应如下(天气描述不需要发送括号内的白天晚上)\r
+ * 0:龙卷风\r
+ * 1:热带风暴\r
+ * 2:飓风\r
+ * 3:严重的雷暴\r
+ * 4:雷暴\r
+ * 5:混合雨雪\r
+ * 6:混合降雨和冰雹\r
+ * 7:混合雪和雨夹雪\r
+ * 8:冻结小雨\r
+ * 9:小雨\r
+ * 10:冻雨\r
+ * 11:阵雨\r
+ * 12:阵雨\r
+ * 13:雪飘雪\r
+ * 14:小雪阵雨\r
+ * 15:吹雪\r
+ * 16:雪\r
+ * 17:冰雹\r
+ * 18:雨夹雪\r
+ * 19:尘埃\r
+ * 20:雾\r
+ * 21:霾\r
+ * 22:黑烟\r
+ * 23:大风\r
+ * 24:风\r
+ * 25:低温\r
+ * 26:多云\r
+ * 27:多云(晚上)\r
+ * 28:多云(白天)\r
+ * 29:局部多云(晚上)\r
+ * 30:局部多云(天)\r
+ * 31:清爽(晚)\r
+ * 32:晴天\r
+ * 33:晴朗(晚)\r
+ * 34:晴朗(天)\r
+ * 35:混合雨和冰雹\r
+ * 36:热\r
+ * 37:局部地区性雷暴\r
+ * 38:零星雷暴\r
+ * 39:零星雷暴\r
+ * 40:零星阵雨\r
+ * 41:大雪\r
+ * 42:零星阵雪\r
+ * 43:大雪\r
+ * 44:多云\r
+ * 45:雷阵雨\r
+ * 46:阵雪\r
+ * 47:局部雷阵雨\r
+ */\r
+\r
+ log("BPTQ "+cmd);\r
+ String[] cmdlist=cmd.split(CMDSPLIT);\r
+ if (cmdlist.length==23){\r
+\r
+ StringBuilder sb=new StringBuilder();\r
+ StringBuilder msg=new StringBuilder();\r
+ for(int i=0;i<3;i++) {\r
+ String DayTime = cmdlist[1+i*7] + " " + cmdlist[2+i*7];\r
+ String date= "20"+cmdlist[1+i*7].trim();\r
+ String weather_name = Util.decodeUnicode2Utf8(cmdlist[3+i*7].trim());\r
+ String weather_id = cmdlist[4+i*7];\r
+ String temp_current = cmdlist[5+i*7];\r
+ String temp_high = cmdlist[6+i*7];\r
+ String temp_low = cmdlist[7+i*7];\r
+\r
+ sb.append(" "+DayTime);\r
+ sb.append(",天气:"+weather_name);\r
+ sb.append(",ID "+weather_id);\r
+ sb.append(",当前温度 "+temp_current);\r
+ sb.append(",最高温度 "+temp_high);\r
+ sb.append(",最低温度 "+temp_low);\r
+ sb.append("\n");\r
+\r
+ msg.append(date);\r
+ msg.append(","+weather_name);\r
+ msg.append(","+weather_id);\r
+ msg.append(","+temp_current);\r
+ msg.append(","+temp_high);\r
+ msg.append(","+temp_low);\r
+ msg.append(";");\r
+ }\r
+ String City=Util.decodeUnicode2Utf8(cmdlist[22]);\r
+\r
+ ICLogger.i(City+" \n"+sb.toString());\r
+\r
+ msg.insert(0,City+";");\r
+ String weatherstr=msg.toString();\r
+ if (weatherstr.endsWith(";"))\r
+ {\r
+ weatherstr=weatherstr.substring(0,weatherstr.lastIndexOf(";"));\r
+ }\r
+ Intent intent=new Intent(Constants.ACTION_WEATHER_RECEIVED);\r
+ intent.putExtra(Constants.KEY_Weather,weatherstr);\r
+ ICLogger.i("send Broadcast "+ Constants.ACTION_WEATHER_RECEIVED +"\n"+weatherstr+"\n");\r
+ CoreService.getInstance().sendBroadcast(intent);\r
+\r
+ }else{\r
+ ICLogger.i(" BPTQ Format error!");\r
+ }\r
+ }\r
\r
\r
\r
ICLogger.i("收到服务器设置闹钟命令BP85");\r
mConnection.DeliverCMDMessageToSystem("AP85",cmd);//通知下面线程状态变化\r
break;\r
+\r
+ case BP87:\r
+ handleBP87(cmd,mConnection,mRuntime);\r
+ ICLogger.i("收到服务器 QRCode uri BP87");\r
+ break;\r
case BP33:\r
//设置工作模式\r
handleBP33(mConnection,mRuntime,cmd);\r
ICLogger.i("聆听");\r
handleBPDH(mConnection,mRuntime,cmd);\r
break;\r
+\r
+ case BPTQ:\r
+ handleBPTQ(mConnection,mRuntime,cmd);\r
+ break;\r
}\r
\r
return ret;\r
*/\r
\r
if(runtime.bleInfo.ble_area_id.isEmpty()){\r
+ ICLogger.i("not Bind, skip send Location!");\r
return null;\r
}\r
StringBuilder sb = new StringBuilder();\r
-#Mon Sep 28 10:42:38 CST 2020\r
-VERSION_CODE=638\r
+#Mon Oct 12 14:15:33 CST 2020\r
+VERSION_CODE=642\r