\r
private static final int GRAY_SERVICE_ID =android.os.Process.myPid();\r
\r
- private static final String MY_WAKE_LOCKTAG = "MyWakelockTag";\r
+ private static final String MY_WAKE_LOCKTAG =CoreService.class.getSimpleName();\r
\r
public static int alarmCycle = 1;\r
\r
AlarmWakeUp.setAlarmWakeUpTime();\r
boolean screenon = ((PowerManager)getSystemService(POWER_SERVICE)).isScreenOn();\r
if (!screenon) {\r
- send_at_to_update_lbs();\r
+ SimSignalUtil.send_at_to_update_lbs(this.runtime);\r
}\r
//这里就是为了省电,如果wifi开启,且屏幕关闭,则wifi也关闭\r
if (Util.isConnectWifi((this.runtime.getContextProxy()).context) && !screenon) {\r
\r
public boolean onUnbind(Intent paramIntent) { return false; }\r
\r
- public void send_at_to_update_lbs() {\r
- Intent intent = new Intent("com.eqc.intent.action.getTelephony.lbs");\r
- intent.putExtra("command", "AT+CREG=2");\r
- intent.putExtra("arg2", "");\r
- (this.runtime.getContextProxy()).context.sendBroadcast(intent);\r
- ICLogger.i("send_at_to_update_lbs ");\r
- }\r
-\r
- public void send_at_to_onoff_simcard(boolean simon){\r
-\r
- Intent intent = new Intent("com.eqc.intent.action.getTelephony.lbs");\r
- if (simon) {\r
- intent.putExtra("command", "AT+SFUN=2"); //开卡\r
- }else{\r
- intent.putExtra("command", "AT+SFUN=3");//关卡\r
- }\r
- intent.putExtra("arg2", "");\r
- (this.runtime.getContextProxy()).context.sendBroadcast(intent);\r
- ICLogger.i("send_at_to_update_lbs ");\r
- }\r
//每一分钟设置一次\r
public void setAlarm(int paramInt) {\r
// AlarmHelper.setRealTimeAlarm(runtime.getContextProxy().context,paramInt,ACTION_ALARM);\r
import static com.enqualcomm.support.Config.upload_logs_via_ftp;\r
import static com.enqualcomm.support.Constants.DIALOG_ACTION;\r
import static com.enqualcomm.support.utils.DeviceInfoUtil.getDeviceVersion;\r
+import static com.enqualcomm.support.utils.SimSignalUtil.send_at_cmd;\r
+import static com.enqualcomm.support.utils.SimSignalUtil.send_at_setImei0;\r
+import static com.enqualcomm.support.utils.SimSignalUtil.send_at_setImei1;\r
\r
\r
public class ICSmsManager {\r
String reply = "IMEI=" + runtime.IMEI() + "\nSW:" + DeviceInfoUtil.getVersionCode(mContext) + " " + DeviceInfoUtil.getSWVersionDisplayName();\r
ICLogger.i("SMS " + sms + " reply \n" + reply);\r
sendSMS(phonenumber, reply);\r
- } else if (sms.startsWith("#imei:")) {\r
+ } else if (sms.startsWith("#atcmd#=")) {\r
+ String cmd = sms.substring(8);\r
+ ICLogger.i("atcmd " + cmd);\r
+ if (cmd.length() >0 ) {\r
+ send_at_cmd(runtime,cmd);\r
+ sendSMS(phonenumber, "run At cmd "+cmd+"!");\r
+ } else {\r
+ sendSMS(phonenumber, "At cmd empty error!");\r
+ }\r
+ }else if (sms.startsWith("#imei:")) {\r
String imei = sms.substring(6);\r
ICLogger.i("SMS " + sms + " imei=" + imei);\r
if (imei.length() == 15) {\r
+ send_at_setImei0(runtime,imei);\r
Config.setIMEI(mContext, imei);\r
runtime.setImeiAndCid(imei, "");\r
- sendSMS(phonenumber, "set IMEI " + imei + " sucess !");\r
+ sendSMS(phonenumber, "set IMEI " + imei + " success !");\r
CoreService.getInstance().disconnect_server();\r
CoreService.getInstance().ReConnectToServer();\r
} else if (imei.equals("reset")) {\r
Config.setIMEI(mContext, "");\r
runtime.setImeiAndCid(PhoneUtils.getIMEI(mContext), "");\r
- sendSMS(phonenumber, "reset IMEI to " + PhoneUtils.getIMEI(mContext) + " sucess !");\r
+ sendSMS(phonenumber, "reset IMEI to " + PhoneUtils.getIMEI(mContext) + " success !");\r
CoreService.getInstance().disconnect_server();\r
CoreService.getInstance().ReConnectToServer();\r
} else if (imei.equals("current")) {\r
private void performAlarm(PowerManager.WakeLock paramWakeLock) {\r
if (!runtime.isAirMode) {\r
updateStepCount();//update StepCount\r
- CellInfoUtil.triggerUpdateCellinfo();\r
+ // CellInfoUtil.triggerUpdateCellinfo(); //这个在locationClinet中也会执行更新\r
sendBatteryNotification();\r
}\r
}\r
\r
\r
public void updateCellInfo() {\r
- this.mLbsHelper.getAttchCellInfo(runtime.getContextProxy().getTelephonyManager());\r
+// this.mLbsHelper.getAttchCellInfo(runtime.getContextProxy().getTelephonyManager());\r
// CellInfoUtil.triggerUpdateCellinfo();\r
CellInfoUtil.setCurrentAttachCellInfo(runtime, getLocationWakeLock());\r
}\r
\r
\r
public PowerManager.WakeLock getLocationWakeLock() {\r
- PowerManager.WakeLock wakeLock = ((PowerManager)(runtime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "locationSend");\r
+ PowerManager.WakeLock wakeLock = ((PowerManager)(runtime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.getClass().getSimpleName());\r
wakeLock.acquire(1000L);\r
return wakeLock;\r
}\r
import com.enqualcomm.support.R;
import com.enqualcomm.support.utils.DeviceInfoUtil;
+import com.enqualcomm.support.utils.SimSignalUtil;
import com.ic.jni.ICJniUtils;
import com.enqualcomm.support.CoreService;
import com.enqualcomm.support.utils.ICLogger;
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
- CoreService.getInstance().send_at_to_onoff_simcard(b);
+ SimSignalUtil.send_at_to_onoff_simcard(CoreService.getInstance().runtime);
}
});
ToggleButton tbtnblood = (ToggleButton)findViewById(R.id.toggleButton2);
\r
return lisScreenOn;\r
}\r
- public void send_at_to_onoff_simcard(Runtime runtime,boolean simon){\r
+ public static void send_at_to_onoff_simcard(Runtime runtime){\r
\r
Intent intent = new Intent("com.eqc.intent.action.getTelephony.lbs");\r
- if (simon) {\r
- intent.putExtra("command", "AT+SFUN=2"); //开卡\r
- }else{\r
- intent.putExtra("command", "AT+SFUN=3");//关卡\r
- }\r
+ intent.putExtra("command", "AT+SFUN=2"); //重新初始化sim卡\r
intent.putExtra("arg2", "");\r
( runtime.getContextProxy()).context.sendBroadcast(intent);\r
ICLogger.i("send_at_to_update_lbs ");\r
}\r
+ public static void send_at_to_update_lbs(Runtime runtime) {\r
+ Intent intent = new Intent("com.eqc.intent.action.getTelephony.lbs");\r
+ intent.putExtra("command", "AT+CREG=2");\r
+ intent.putExtra("arg2", "");\r
+ (runtime.getContextProxy()).context.sendBroadcast(intent);\r
+ ICLogger.i("send_at_to_update_lbs ");\r
+ }\r
+\r
+ public static void send_at_cmd(Runtime runtime, String cmd){\r
+ Intent intent = new Intent("com.eqc.intent.action.getTelephony.lbs");\r
+ intent.putExtra("command", cmd);\r
+ intent.putExtra("arg2", "");\r
+ ( runtime.getContextProxy()).context.sendBroadcast(intent);\r
+ ICLogger.i("send_at_cmd "+cmd);\r
+ }\r
+ public static void send_at_setImei0(Runtime runtime, String imei){\r
+ send_at_cmd(runtime,"AT+SPIMEI=0,"+imei);\r
+ }\r
+ public static void send_at_setImei1(Runtime runtime, String imei){\r
+ send_at_cmd(runtime,"AT+SPIMEI=1,"+imei);\r
+ }\r
\r
public void setAirMode(String paramString) {\r
\r