|
|
@ -98,14 +98,14 @@ public class MpMasterService extends Service {
|
|
|
|
private boolean mUsingAbsHbTime = false;
|
|
|
|
private boolean mUsingAbsHbTime = false;
|
|
|
|
private String mCmdid = "";
|
|
|
|
private String mCmdid = "";
|
|
|
|
private NotificationManager mNotificationManager;
|
|
|
|
private NotificationManager mNotificationManager;
|
|
|
|
private int mQuickHeartbeatDuration = 60; // 1m = 60 s
|
|
|
|
private int mQuickHeartbeatDuration = 60; // Unit: second
|
|
|
|
private int mHeartbeatDuration = 600; // 10m = 10 * 60s
|
|
|
|
private int mHeartbeatDuration = 600; // 10m = 10 * 60s
|
|
|
|
|
|
|
|
|
|
|
|
private AlarmReceiver mAlarmReceiver = null;
|
|
|
|
private AlarmReceiver mAlarmReceiver = null;
|
|
|
|
private ScreenActionReceiver mScreenaAtionReceiver = null;
|
|
|
|
private ScreenActionReceiver mScreenaAtionReceiver = null;
|
|
|
|
private UpdateReceiver mUpdateReceiver = null;
|
|
|
|
private UpdateReceiver mUpdateReceiver = null;
|
|
|
|
|
|
|
|
|
|
|
|
private ServiceHandler mHander = null;
|
|
|
|
private Handler mHander = null;
|
|
|
|
|
|
|
|
|
|
|
|
private String mModelName = null;
|
|
|
|
private String mModelName = null;
|
|
|
|
|
|
|
|
|
|
|
@ -202,7 +202,7 @@ public class MpMasterService extends Service {
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("MpMaster started version=" + mMpMasterVersion);
|
|
|
|
logger.info("MpMaster started version=" + mMpMasterVersion);
|
|
|
|
|
|
|
|
|
|
|
|
mHander = new ServiceHandler();
|
|
|
|
mHander = new Handler();
|
|
|
|
|
|
|
|
|
|
|
|
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
|
|
|
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
|
|
|
mStateService = STATE_SERVICE.NOT_CONNECTED;
|
|
|
|
mStateService = STATE_SERVICE.NOT_CONNECTED;
|
|
|
@ -213,9 +213,6 @@ public class MpMasterService extends Service {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mAlarmReceiver = new AlarmReceiver(this);
|
|
|
|
mAlarmReceiver = new AlarmReceiver(this);
|
|
|
|
IntentFilter intentFilter = new IntentFilter(ACTION_HEARTBEAT);
|
|
|
|
IntentFilter intentFilter = new IntentFilter(ACTION_HEARTBEAT);
|
|
|
|
// intentFilter.addAction(ACTION_TAKE_PHOTO);
|
|
|
|
|
|
|
|
// intentFilter.addAction(ACTION_TIMEOUT);
|
|
|
|
|
|
|
|
// intentFilter.addAction(ACTION_TAKE_PHOTO_MANUALLY);
|
|
|
|
|
|
|
|
intentFilter.addAction(ACTION_MSG_BROADCAST);
|
|
|
|
intentFilter.addAction(ACTION_MSG_BROADCAST);
|
|
|
|
intentFilter.addAction(ACTION_UPDATE_CONFIGS);
|
|
|
|
intentFilter.addAction(ACTION_UPDATE_CONFIGS);
|
|
|
|
intentFilter.addAction(ACTION_UPD_OTA);
|
|
|
|
intentFilter.addAction(ACTION_UPD_OTA);
|
|
|
@ -236,7 +233,7 @@ public class MpMasterService extends Service {
|
|
|
|
registerReceiver(mUpdateReceiver, intentFilter);
|
|
|
|
registerReceiver(mUpdateReceiver, intentFilter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//自定义发送短信广播接收器
|
|
|
|
// SMS broadcast receiver
|
|
|
|
mSmsSnedReceiver = new SmsSendReceiver();
|
|
|
|
mSmsSnedReceiver = new SmsSendReceiver();
|
|
|
|
IntentFilter intentFilter;
|
|
|
|
IntentFilter intentFilter;
|
|
|
|
intentFilter = new IntentFilter(SimUtil.SMS_SEND_ACTION);
|
|
|
|
intentFilter = new IntentFilter(SimUtil.SMS_SEND_ACTION);
|
|
|
@ -273,27 +270,13 @@ public class MpMasterService extends Service {
|
|
|
|
super.onDestroy();
|
|
|
|
super.onDestroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class ServiceHandler extends Handler {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void dispatchMessage(Message msg) {
|
|
|
|
|
|
|
|
super.dispatchMessage(msg);
|
|
|
|
|
|
|
|
// Log.i("life", "MyHandler----dispatchMessage");
|
|
|
|
|
|
|
|
// Log.i("life", Thread.currentThread().getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void handleMessage(Message msg) {
|
|
|
|
|
|
|
|
super.handleMessage(msg);
|
|
|
|
|
|
|
|
// Log.i("life", "MyHandler----handleMessage");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void loadConfig() {
|
|
|
|
protected void loadConfig() {
|
|
|
|
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(getApplicationContext());
|
|
|
|
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(getApplicationContext());
|
|
|
|
mMntnMode = masterConfig.mntnMode != 0;
|
|
|
|
mMntnMode = masterConfig.mntnMode != 0;
|
|
|
|
mQuickHbMode = masterConfig.quickHbMode != 0;
|
|
|
|
mQuickHbMode = masterConfig.quickHbMode != 0;
|
|
|
|
mUsingAbsHbTime = masterConfig.usingAbsHbTime != 0;
|
|
|
|
mUsingAbsHbTime = masterConfig.usingAbsHbTime != 0;
|
|
|
|
mHeartbeatDuration = masterConfig.heartbeat * 60; // minute to second
|
|
|
|
mHeartbeatDuration = masterConfig.heartbeat * 60; // minute to second
|
|
|
|
|
|
|
|
mQuickHeartbeatDuration = masterConfig.quickHeartbeat;
|
|
|
|
mAbsHeartbeatTimes = masterConfig.absHeartbeats;
|
|
|
|
mAbsHeartbeatTimes = masterConfig.absHeartbeats;
|
|
|
|
if (mAbsHeartbeatTimes != null && mAbsHeartbeatTimes.length > 0) {
|
|
|
|
if (mAbsHeartbeatTimes != null && mAbsHeartbeatTimes.length > 0) {
|
|
|
|
Arrays.sort(mAbsHeartbeatTimes);
|
|
|
|
Arrays.sort(mAbsHeartbeatTimes);
|
|
|
|