修复运维cmdid可能为空的问题

nx2024TEMP
XI.CHEN 5 months ago
parent e5f519b42d
commit 8a799998a2

@ -79,6 +79,15 @@ int setGpioInt(int cmd, int val)
} }
return -1; return -1;
} }
extern "C" JNIEXPORT jstring JNICALL
Java_com_xypower_mpmaster_MpMasterService_getSerialNumber(
JNIEnv* env,
jclass cls) {
char value[PROP_VALUE_MAX] = { 0 };
__system_property_get("ro.serialno", value);
return env->NewStringUTF(value);
}
extern "C" JNIEXPORT jint JNICALL extern "C" JNIEXPORT jint JNICALL
Java_com_xypower_mpmaster_MpMasterService_setInt(JNIEnv* env, jclass cls, jint cmd, jint val) { Java_com_xypower_mpmaster_MpMasterService_setInt(JNIEnv* env, jclass cls, jint cmd, jint val) {

@ -567,6 +567,10 @@ public class MpMasterService extends Service {
if (appConfig.heartbeat > 0) { if (appConfig.heartbeat > 0) {
mMpHeartbeatDuration = appConfig.heartbeat * 60000; mMpHeartbeatDuration = appConfig.heartbeat * 60000;
} }
if(TextUtils.isEmpty(appConfig.cmdid))
{
appConfig.cmdid = MpMasterService.getSerialNumber();
}
logger.warning("Start Mntn report: " + masterUrl + " MntnMode=" + (mMntnMode ? "1" : "0") + " QuickHB=" + (mQuickHbMode ? "1" : "0")); logger.warning("Start Mntn report: " + masterUrl + " MntnMode=" + (mMntnMode ? "1" : "0") + " QuickHB=" + (mQuickHbMode ? "1" : "0"));
@ -1347,6 +1351,7 @@ public class MpMasterService extends Service {
public native static int getInt(int cmd); public native static int getInt(int cmd);
public native static int setInt(int cmd, int val); public native static int setInt(int cmd, int val);
public static native String getSerialNumber();
public native static int[] getStats(long ts); public native static int[] getStats(long ts);
public native static String getSystemProperty(String key); public native static String getSystemProperty(String key);
public native static void rebootDevice(); public native static void rebootDevice();

Loading…
Cancel
Save