如果当前没有设定cmdid,使用设备序列号

serial
BlueMatthew 1 year ago
parent 2648762c29
commit 9341b8659d

@ -646,3 +646,13 @@ Java_com_xypower_mpapp_MicroPhotoService_setCam3V3Enable(
GpioControl::setCam3V3Enable(enabled != JNI_FALSE);
}
extern "C" JNIEXPORT jstring JNICALL
Java_com_xypower_mpapp_MicroPhotoService_getSerialNumber(
JNIEnv* env,
jclass cls) {
char value[PROP_VALUE_MAX] = { 0 };
__system_property_get("ro.serialno", value);
return env->NewStringUTF(value);
}

@ -184,7 +184,11 @@ public class MainActivity extends AppCompatActivity {
Log.d(TAG, "MainActivity: reboot=" + rebootFlag + " noDelay=" + noDelay);
MicroPhotoContext.AppConfig appConfig = getAppConfig();
binding.cmdid.setText(appConfig.cmdid);
if (TextUtils.isEmpty(appConfig.cmdid)) {
binding.cmdid.setText(MicroPhotoService.getSerialNumber());
} else {
binding.cmdid.setText(appConfig.cmdid);
}
binding.server.setText(appConfig.server);
binding.port.setText(appConfig.port != 0 ? Integer.toString(appConfig.port) : "");
String protocolStr = appConfig.protocol + "-";

@ -1034,6 +1034,7 @@ cellSignalStrengthGsm.getDbm();
protected native void recordingFinished(long handler, boolean result, String path, long videoId);
public static native void setOtgState(boolean enabled);
public static native void setCam3V3Enable(boolean enabled);
public static native String getSerialNumber();
////////////////////////GPS////////////////////
private static final String GPS_LOCATION_NAME = android.location.LocationManager.GPS_PROVIDER;

Loading…
Cancel
Save