|
|
|
@ -98,8 +98,10 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
public static final String ACTION_MAIN = "com.xypower.mpapp.ACT_MAIN";
|
|
|
|
|
private static final String ACTION_HEARTBEAT = "com.xypower.mpapp.ACT_HB";
|
|
|
|
|
private static final String ACTION_TAKE_PHOTO = "com.xypower.mpapp.ACT_TP";
|
|
|
|
|
|
|
|
|
|
private static final String ACTION_TAKE_PHOTO_MANUALLY = "com.xypower.mpapp.ACT_TP_M";
|
|
|
|
|
private static final String ACTION_HEARTBEAT_MANUALLY = "com.xypower.mpapp.ACT_HB_M";
|
|
|
|
|
private static final String ACTION_UPDATE_CONFIGS = "com.xypower.mpapp.ACT_UPD_CFG";
|
|
|
|
|
public static final String ACTION_VIDEO_FINISHED = "com.xypower.mpapp.ACT_V_FINISHED";
|
|
|
|
|
private static final String EXTRA_PARAM_CHANNEL = "Channel";
|
|
|
|
|
private static final String EXTRA_PARAM_PRESET = "Preset";
|
|
|
|
@ -191,6 +193,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
intentFilter.addAction(ACTION_MSG_BROADCAST);
|
|
|
|
|
intentFilter.addAction(ACTION_VIDEO_FINISHED);
|
|
|
|
|
intentFilter.addAction(ACTION_STOP);
|
|
|
|
|
intentFilter.addAction(ACTION_UPDATE_CONFIGS);
|
|
|
|
|
|
|
|
|
|
LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver (mLocalMsgReceiver, intentFilter);
|
|
|
|
|
}
|
|
|
|
@ -394,6 +397,11 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
if (what == MSG_WHAT_SENDING_HB) {
|
|
|
|
|
mService.sendHeartbeat(mService.mNativeHandle, mService.getSignalLevel());
|
|
|
|
|
}
|
|
|
|
|
} else if (TextUtils.equals(ACTION_UPDATE_CONFIGS, action)) {
|
|
|
|
|
Log.i(TAG, "UPD CFG Fired ACTION=" + action);
|
|
|
|
|
if (mService.mNativeHandle != 0) {
|
|
|
|
|
mService.updateConfigs(mService.mNativeHandle);
|
|
|
|
|
}
|
|
|
|
|
} else if (TextUtils.equals(ACTION_VIDEO_FINISHED, action)) {
|
|
|
|
|
boolean result = intent.getBooleanExtra("result", false);
|
|
|
|
|
String path = intent.getStringExtra("path");
|
|
|
|
@ -539,6 +547,14 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
localBroadcastManager.sendBroadcast(intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void updateConfigs(Context context) {
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
|
intent.setAction(ACTION_UPDATE_CONFIGS);
|
|
|
|
|
// PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
|
|
|
|
|
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
|
|
|
|
|
localBroadcastManager.sendBroadcast(intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
|
|
|
|
|
|
|
@ -1068,6 +1084,7 @@ cellSignalStrengthGsm.getDbm();
|
|
|
|
|
// protected native long[] getNextScheduleItem(long handler);
|
|
|
|
|
protected native boolean notifyToTakePhoto(long handler, int channel, int preset, long scheduleTime, boolean photoOrVideo);
|
|
|
|
|
protected native boolean sendHeartbeat(long handler, int signalLevel);
|
|
|
|
|
protected native boolean updateConfigs(long handler);
|
|
|
|
|
protected native void updatePosition(long handler, double lon, double lat, long ts);
|
|
|
|
|
protected native boolean uninit(long handler);
|
|
|
|
|
protected native void recordingFinished(long handler, boolean result, String path, long videoId);
|
|
|
|
|