|
|
|
@ -98,10 +98,17 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
|
|
|
|
|
public static final int MSG_WHAT_LOG = 10;
|
|
|
|
|
|
|
|
|
|
public final static int MSG_WHAT_SENDING_HB = 40;
|
|
|
|
|
|
|
|
|
|
public final static int MSG_WHAT_MAX = 1000;
|
|
|
|
|
|
|
|
|
|
public final static int MEDIA_TYPE_PHOTO = 0;
|
|
|
|
|
public final static int MEDIA_TYPE_VIDEO = 1;
|
|
|
|
|
|
|
|
|
|
public final static int MEDIA_TYPE_LOG = 2;
|
|
|
|
|
|
|
|
|
|
public final static int MEDIA_TYPE_STREAMING = 0x10;
|
|
|
|
|
public final static int MEDIA_TYPE_STREAMING_OFF = 0x11;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public final static int BROADCAST_REQUEST_CODE_HEARTBEAT = 1;
|
|
|
|
|
public final static int BROADCAST_REQUEST_CODE_TAKING_PHOTO = 2;
|
|
|
|
|
public final static int BROADCAST_REQUEST_CODE_GPS = 3;
|
|
|
|
@ -127,14 +134,15 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
private static final String EXTRA_PARAM_CHANNEL = "Channel";
|
|
|
|
|
private static final String EXTRA_PARAM_PRESET = "Preset";
|
|
|
|
|
private static final String EXTRA_PARAM_PHOTO_OR_VIDEO = "PhotoOrVideo";
|
|
|
|
|
|
|
|
|
|
private static final String EXTRA_PARAM_MEDIA_TYPE = "mediaType";
|
|
|
|
|
|
|
|
|
|
private static final String EXTRA_PARAM_URL = "url";
|
|
|
|
|
private static final String EXTRA_PARAM_SCHEDULES = "Schedules";
|
|
|
|
|
private static final String EXTRA_PARAM_SCHEDULE = "Schedule_";
|
|
|
|
|
private static final String EXTRA_PARAM_TAKING_TIME = "TakingTime";
|
|
|
|
|
private static final String EXTRA_PARAM_TIME = "Time";
|
|
|
|
|
// private static final String EXTRA_PARAM_TIMER_UID = "TimerUid";
|
|
|
|
|
// private static final String EXTRA_PARAM_TIMEOUT = "Timeout";
|
|
|
|
|
// private static final String EXTRA_PARAM_TIMES = "Times";
|
|
|
|
|
// private static final String EXTRA_PARAM_ELASPED_TIMES = "ElapsedTimes";
|
|
|
|
|
|
|
|
|
|
private static final String FOREGROUND_CHANNEL_ID = "fg_mpapp";
|
|
|
|
|
public static class STATE_SERVICE {
|
|
|
|
|
public static final int CONNECTED = 10;
|
|
|
|
@ -513,7 +521,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
|
|
|
|
|
int channel = (int) ((val & 0xFFFF000L) >> 12);
|
|
|
|
|
int preset = (int) ((val & 0xFF0L) >> 4);
|
|
|
|
|
boolean photoOrVideo = ((val & 0xFL) == 0);
|
|
|
|
|
int mediaType = (int)(val & 0xFL);
|
|
|
|
|
|
|
|
|
|
if (channel >= 256)
|
|
|
|
|
{
|
|
|
|
@ -523,7 +531,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
{
|
|
|
|
|
infoLog("IMG Timer Fired: CH=" + channel + " PR=" + preset);
|
|
|
|
|
}
|
|
|
|
|
mService.notifyToTakePhoto(mService.mNativeHandle, channel, preset, ts, photoOrVideo);
|
|
|
|
|
mService.notifyToTakePhoto(mService.mNativeHandle, channel, preset, ts, null, mediaType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -536,12 +544,20 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
} else if (TextUtils.equals(ACTION_TAKE_PHOTO_MANUALLY, action)) {
|
|
|
|
|
int channel = intent.getIntExtra(EXTRA_PARAM_CHANNEL, 0);
|
|
|
|
|
int preset = intent.getIntExtra(EXTRA_PARAM_PRESET, 0xFF);
|
|
|
|
|
String url = intent.getStringExtra(EXTRA_PARAM_URL);
|
|
|
|
|
// long ts = intent.getLongExtra(EXTRA_PARAM_TIME, 0);
|
|
|
|
|
|
|
|
|
|
int mediaType = 0;
|
|
|
|
|
if (intent.hasExtra(EXTRA_PARAM_MEDIA_TYPE)) {
|
|
|
|
|
mediaType = intent.getIntExtra(EXTRA_PARAM_MEDIA_TYPE, 0);
|
|
|
|
|
} else if (intent.hasExtra(EXTRA_PARAM_PHOTO_OR_VIDEO)) {
|
|
|
|
|
boolean photoOrVideo = intent.getBooleanExtra(EXTRA_PARAM_PHOTO_OR_VIDEO, true);
|
|
|
|
|
mediaType = photoOrVideo ? 0 : 1;
|
|
|
|
|
}
|
|
|
|
|
long ts = System.currentTimeMillis() / 1000;
|
|
|
|
|
|
|
|
|
|
Log.i(TAG, "Take Photo CH=" + channel + " PR=" + preset + " Mannually");
|
|
|
|
|
mService.notifyToTakePhoto(mService.mNativeHandle, channel, preset, 0, photoOrVideo);
|
|
|
|
|
mService.notifyToTakePhoto(mService.mNativeHandle, channel, preset, 0, url, mediaType);
|
|
|
|
|
} else if (TextUtils.equals(ACTION_UPDATE_CONFIGS, action)) {
|
|
|
|
|
int restart = intent.getIntExtra("restart", 0);
|
|
|
|
|
Log.i(TAG, "UPD CFG Fired ACTION=" + action + " restart=" + restart);
|
|
|
|
@ -1605,7 +1621,7 @@ cellSignalStrengthGsm.getDbm();
|
|
|
|
|
protected native long[] getPhotoTimeData(long handler, long startTime);
|
|
|
|
|
protected native long[] getPhotoTimeData2(long handler);
|
|
|
|
|
// protected native long[] getNextScheduleItem(long handler);
|
|
|
|
|
protected native boolean notifyToTakePhoto(long handler, int channel, int preset, long scheduleTime, boolean photoOrVideo);
|
|
|
|
|
protected native boolean notifyToTakePhoto(long handler, int channel, int preset, long scheduleTime, String url, int mediaType);
|
|
|
|
|
|
|
|
|
|
protected native boolean sendHeartbeat(long handler, int signalLevel);
|
|
|
|
|
protected native boolean reloadConfigs(long handler);
|
|
|
|
|