diff --git a/app/build.gradle b/app/build.gradle index 7c8b3064..b240214a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ plugins { // 10,00,000 major-minor-build def AppMajorVersion = 1 def AppMinorVersion = 3 -def AppBuildNumber = 9 +def AppBuildNumber = 15 def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 76cf8a5c..bfa69e76 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -479,7 +479,7 @@ int32_t CPhoneDevice::CJpegCamera::getOutputFormat() const } CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPath, unsigned int netId, unsigned int versionCode, const std::string& nativeLibDir) - : mVersionCode(versionCode), m_nativeLibraryDir(nativeLibDir), m_network(NULL), m_netHandle(NETWORK_UNSPECIFIED) + : mVersionCode(versionCode), m_nativeLibraryDir(nativeLibDir), m_network(NULL), m_ethnetHandle(NETWORK_UNSPECIFIED) { mCamera = NULL; m_listener = NULL; @@ -1125,7 +1125,7 @@ bool CPhoneDevice::InstallAPP(const std::string& path, unsigned int delayedTime) return true; } -bool CPhoneDevice::Reboot(int resetType, bool manually, const std::string& reason) +bool CPhoneDevice::Reboot(int resetType, bool manually, const std::string& reason, uint32_t timeout/* = 1000*/) { if (resetType == REBOOT_TYPE_DEVICE) { @@ -1500,7 +1500,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c SetStaticIp(); std::this_thread::sleep_for(std::chrono::milliseconds(256)); - net_handle_t netHandle = GetNetHandle(); + net_handle_t netHandle = GetEthnetHandle(); if (netHandle == 0) { @@ -1508,7 +1508,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c for (int idx = 0; idx < 84; idx++) { std::this_thread::sleep_for(std::chrono::milliseconds(128)); - netHandle = GetNetHandle(); + netHandle = GetEthnetHandle(); if (netHandle != 0) { @@ -1584,7 +1584,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c bool netCaptureResult = false; for (int idx = 0; idx < 3; idx++) { - netHandle = GetNetHandle(); + netHandle = GetEthnetHandle(); netPhotoInfo.netHandle = netHandle; XYLOG(XYLOG_SEVERITY_INFO, "NetCapture %d NetHandle=%lld PHOTOID=%u", idx, netHandle, localPhotoInfo.photoId); @@ -1923,7 +1923,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< { XYLOG(XYLOG_SEVERITY_INFO,"Recv CameraCtrl Command, action= MOVE_PRESETNO, preset = %u", localPhotoInfo.preset); CameraPhotoCmd(time(NULL), localPhotoInfo.channel, MOVE_PRESETNO, 0, localPhotoInfo.preset, param.serfile, param.baud, param.addr); - std::this_thread::sleep_for(std::chrono::seconds(5)); + std::this_thread::sleep_for(std::chrono::seconds(10)); } pThis->TakePhotoWithNetCamera(localPhotoInfo, path, osds, powerCtrlPtr); @@ -3748,17 +3748,17 @@ void CPhoneDevice::UpdateSimcard(const std::string& simcard) void CPhoneDevice::UpdateEthernet(net_handle_t nethandle, bool available) { m_devLocker.lock(); - m_netHandle = available ? nethandle : NETWORK_UNSPECIFIED; + m_ethnetHandle = available ? nethandle : NETWORK_UNSPECIFIED; m_devLocker.unlock(); XYLOG(XYLOG_SEVERITY_WARNING, "NET Handle: %lld", available ? (uint64_t)nethandle : 0); } -net_handle_t CPhoneDevice::GetNetHandle() const +net_handle_t CPhoneDevice::GetEthnetHandle() const { net_handle_t nethandle = NETWORK_UNSPECIFIED; m_devLocker.lock(); - nethandle = m_netHandle; + nethandle = m_ethnetHandle; m_devLocker.unlock(); return nethandle; diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index 077cda68..fa9e9fed 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -219,7 +219,7 @@ public: virtual bool UpdateSchedules(); virtual bool QuerySystemProperties(map& properties); virtual bool InstallAPP(const std::string& path, unsigned int delayedTime); - virtual bool Reboot(int resetType, bool manually, const std::string& reason); + virtual bool Reboot(int resetType, bool manually, const std::string& reason, uint32_t timeout = 1000); virtual bool EnableGPS(bool enabled); virtual float QueryBattaryVoltage(int timesForAvg, bool* isCharging); virtual bool RequestPosition(); @@ -262,7 +262,7 @@ public: void UpdateSimcard(const std::string& simcard); void UpdateEthernet(net_handle_t nethandle, bool available); - net_handle_t GetNetHandle() const; + net_handle_t GetEthnetHandle() const; protected: @@ -354,7 +354,7 @@ protected: std::string m_nativeLibraryDir; NETWORK* m_network; - net_handle_t m_netHandle; + net_handle_t m_ethnetHandle; jmethodID mRegisterHeartbeatMid; jmethodID mUpdateCaptureScheduleMid; diff --git a/app/src/main/cpp/camera2/ndkcamera.cpp b/app/src/main/cpp/camera2/ndkcamera.cpp index c7ac545e..9d33c632 100644 --- a/app/src/main/cpp/camera2/ndkcamera.cpp +++ b/app/src/main/cpp/camera2/ndkcamera.cpp @@ -1880,9 +1880,11 @@ void NdkCamera::CopyPreviewRequest(ACaptureRequest* request, const ACameraMetada void NdkCamera::onCaptureFailed(ACameraCaptureSession* session, ACaptureRequest* request, ACameraCaptureFailure* failure) { - XYLOG(XYLOG_SEVERITY_WARNING, "onCaptureFailed session=%p request=%p reason=%d PhotoTaken=%d", session, request, failure->reason, m_photoTaken ? 1 : 0); + bool isPreview = (request == mCaptureRequests[PREVIEW_REQUEST_IDX]->request); - if (failure->sequenceId == mCaptureRequests[PREVIEW_REQUEST_IDX]->sessionSequenceId) + XYLOG(XYLOG_SEVERITY_WARNING, "onCaptureFailed session=%p request=%p reason=%d PhotoTaken=%d Preview=%d", session, request, failure->reason, m_photoTaken ? 1 : 0, isPreview ? 1 : 0); + + if (isPreview) { return; } diff --git a/app/src/main/java/com/xypower/mpapp/MainActivity.java b/app/src/main/java/com/xypower/mpapp/MainActivity.java index 99ea14fc..153548ab 100644 --- a/app/src/main/java/com/xypower/mpapp/MainActivity.java +++ b/app/src/main/java/com/xypower/mpapp/MainActivity.java @@ -403,8 +403,6 @@ public class MainActivity extends AppCompatActivity { binding.btnCameraInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - MicroPhotoService.setOtgState(true); - MicroPhotoService.setCam3V3Enable(true); Runnable runnable = new Runnable() { @@ -415,7 +413,6 @@ public class MainActivity extends AppCompatActivity { Log.d(TAG, cameraInfo); MicroPhotoService.setCam3V3Enable(false); - MicroPhotoService.setOtgState(false); MicroPhotoService.infoLog(cameraInfo); Toast.makeText(view.getContext(), cameraInfo, Toast.LENGTH_LONG).show(); diff --git a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java index 188f85ec..8c1801eb 100644 --- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java +++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java @@ -1181,7 +1181,7 @@ public class MicroPhotoService extends Service { } notificationBuilder .setContent(remoteViews) - .setSmallIcon(R.mipmap.ic_launcher) + .setSmallIcon(R.drawable.ic_notification_mp) .setCategory(NotificationCompat.CATEGORY_SERVICE) .setOnlyAlertOnce(true) .setOngoing(true) @@ -1567,8 +1567,8 @@ public class MicroPhotoService extends Service { if (!TextUtils.isEmpty(gateway)) { intent.putExtra("gateway", gateway); } - // intent.putExtra("dns1", "8.8.8.8"); - // intent.putExtra("dns2", "192.168.19.1"); + intent.putExtra("dns1", "0.0.0.0"); + intent.putExtra("dns2", "0.0.0.0"); sendBroadcast(getApplicationContext(), intent); } } diff --git a/app/src/main/res/drawable/ic_notification_mp.xml b/app/src/main/res/drawable/ic_notification_mp.xml new file mode 100644 index 00000000..0fd18e06 --- /dev/null +++ b/app/src/main/res/drawable/ic_notification_mp.xml @@ -0,0 +1,5 @@ + + + diff --git a/mpmaster/build.gradle b/mpmaster/build.gradle index 2819700b..8883e0b8 100644 --- a/mpmaster/build.gradle +++ b/mpmaster/build.gradle @@ -4,7 +4,7 @@ plugins { def AppMajorVersion = 1 def AppMinorVersion = 0 -def AppBuildNumber = 94 +def AppBuildNumber = 95 def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java index 9586f8c8..0cd0e49b 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java @@ -945,7 +945,7 @@ public class MpMasterService extends Service { } notificationBuilder .setContent(remoteViews) - .setSmallIcon(R.mipmap.ic_launcher) + .setSmallIcon(R.drawable.ic_notification_mst) .setCategory(NotificationCompat.CATEGORY_SERVICE) .setOnlyAlertOnce(true) .setOngoing(true) @@ -1239,7 +1239,7 @@ public class MpMasterService extends Service { if (destPathFile.exists()) { File dataPath = new File(destPathFile, "data"); if (dataPath.exists()) { - File file = new File(destPathFile, "App.json"); + File file = new File(dataPath, "App.json"); if (file.exists()) { return false; } else { @@ -1247,6 +1247,7 @@ public class MpMasterService extends Service { } } else { existed = false; + try { dataPath.mkdirs(); } catch (Exception ex) { diff --git a/mpmaster/src/main/res/drawable/ic_notification_mst.xml b/mpmaster/src/main/res/drawable/ic_notification_mst.xml new file mode 100644 index 00000000..52f9ab1a --- /dev/null +++ b/mpmaster/src/main/res/drawable/ic_notification_mst.xml @@ -0,0 +1,5 @@ + + +