|
|
|
@ -332,7 +332,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
String action = intent.getAction();
|
|
|
|
|
if (TextUtils.equals(ACTION_HEARTBEAT, action)) {
|
|
|
|
|
Log.i(TAG, "HB Timer Fired ACTION=" + action);
|
|
|
|
|
mService.sendHeartbeat(mService.mNativeHandle);
|
|
|
|
|
mService.sendHeartbeat(mService.mNativeHandle, mService.getSignalLevel());
|
|
|
|
|
mService.registerHeartbeatTimer();
|
|
|
|
|
|
|
|
|
|
} else if (TextUtils.equals(ACTION_TAKE_PHOTO, action)) {
|
|
|
|
@ -357,7 +357,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
mService.updateCaptureSchedule(startTime);
|
|
|
|
|
} else if (TextUtils.equals(ACTION_HEARTBEAT_MANUALLY, action)) {
|
|
|
|
|
Log.i(TAG, "HB Timer Fired ACTION=" + action);
|
|
|
|
|
mService.sendHeartbeat(mService.mNativeHandle);
|
|
|
|
|
mService.sendHeartbeat(mService.mNativeHandle, mService.getSignalLevel());
|
|
|
|
|
} else if (TextUtils.equals(ACTION_TAKE_PHOTO_MANUALLY, action)) {
|
|
|
|
|
int channel = intent.getIntExtra(EXTRA_PARAM_CHANNEL, 0);
|
|
|
|
|
int preset = intent.getIntExtra(EXTRA_PARAM_PRESET, 0);
|
|
|
|
@ -373,7 +373,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
int data = intent.getIntExtra("data", 0);
|
|
|
|
|
|
|
|
|
|
if (what == MSG_WHAT_SENDING_HB) {
|
|
|
|
|
mService.sendHeartbeat(mService.mNativeHandle);
|
|
|
|
|
mService.sendHeartbeat(mService.mNativeHandle, mService.getSignalLevel());
|
|
|
|
|
}
|
|
|
|
|
} else if (TextUtils.equals(ACTION_VIDEO_FINISHED, action)) {
|
|
|
|
|
boolean result = intent.getBooleanExtra("result", false);
|
|
|
|
@ -654,7 +654,7 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
|
|
|
|
|
MicroPhotoService service = MicroPhotoService.this;
|
|
|
|
|
|
|
|
|
|
service.mNativeHandle = init(appPath, server, port, cmdid, protocol, networkProtocol, 0);
|
|
|
|
|
service.mNativeHandle = init(appPath, server, port, cmdid, protocol, networkProtocol, 0, service.getSignalLevel());
|
|
|
|
|
|
|
|
|
|
if (service.mNativeHandle !=0) {
|
|
|
|
|
isRunning = true;
|
|
|
|
@ -898,6 +898,18 @@ public class MicroPhotoService extends Service {
|
|
|
|
|
th.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected int getSignalLevel() {
|
|
|
|
|
try {
|
|
|
|
|
final TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
|
|
|
|
|
SignalStrength ss = telephonyManager.getSignalStrength();
|
|
|
|
|
if (ss != null) {
|
|
|
|
|
return ss.getLevel();
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getSystemInfo() {
|
|
|
|
|
|
|
|
|
|
boolean isXyPlatform = mModelName.startsWith("tb8788");
|
|
|
|
@ -1022,13 +1034,13 @@ CellSignalStrengthGsm cellSignalStrengthGsm = cellInfoGsm.getCellSignalStrength(
|
|
|
|
|
cellSignalStrengthGsm.getDbm();
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
protected native long init(String appPath, String ip, int port, String cmdid, int protocol, int networkProtocl, long netHandle);
|
|
|
|
|
protected native long init(String appPath, String ip, int port, String cmdid, int protocol, int networkProtocl, long netHandle, int signalLevel);
|
|
|
|
|
protected native long getHeartbeatDuration(long handler);
|
|
|
|
|
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 sendHeartbeat(long handler);
|
|
|
|
|
protected native boolean sendHeartbeat(long handler, int signalLevel);
|
|
|
|
|
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);
|
|
|
|
|