通过配置获取基本信息数据报的部分数据

基本信息数据报中的版本号则取app的版本信息
serial
BlueMatthew 1 year ago
parent 77bd77cc47
commit f6f57d2445

@ -267,7 +267,7 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
JNIEnv* env,
jobject pThis, jstring appPath,
jstring ip, jint port, jstring cmdid, jint protocol,
jint networkProtocol, jlong netHandle, jint signalLevel) {
jint networkProtocol, jlong netHandle, jint signalLevel, jint versionCode) {
/*
google_breakpad::MinidumpDescriptor descriptor(".");
@ -305,7 +305,7 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
CTerminal* pTerminal = NewTerminal(protocol);
CPhoneDevice* device = new CPhoneDevice(vm, pThis, appPathStr, NETID_UNSET);
CPhoneDevice* device = new CPhoneDevice(vm, pThis, appPathStr, NETID_UNSET, versionCode);
device->SetListener(pTerminal);
device->UpdateSignalLevel(signalLevel);

@ -153,7 +153,7 @@ void CPhoneDevice::CPhoneCamera::on_error(const std::string& msg)
}
}
CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPath, unsigned int netId) : mCameraPowerCount(0), mOtgCount(0)
CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPath, unsigned int netId, unsigned int versionCode) : mCameraPowerCount(0), mOtgCount(0), mVersionCode(versionCode)
{
mCamera = NULL;
m_listener = NULL;
@ -336,6 +336,11 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
for (std::map<std::string, std::string>::iterator it = properties.begin(); it != properties.end(); ++it)
{
if (!(it->second.empty()))
{
continue;
}
if (it->first == PROP_EQUIP_NAME)
{
__system_property_get("ro.product.name", value);
@ -351,11 +356,14 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
__system_property_get("ro.product.manufacturer", value);
it->second = value;
}
else if (it->first == PROP_VERSION) {
__system_property_get("ro.build.version.release", value);
else if (it->first == PROP_VERSION)
{
snprintf(value, sizeof(value), "%u.%03u", (mVersionCode / 1000), (mVersionCode % 1000));
// __system_property_get("ro.build.version.release", value);
it->second = value;
}
else if (it->first == PROP_PROD_DATE) {
else if (it->first == PROP_PROD_DATE)
{
__system_property_get("ro.build.date.utc", value);
it->second = value;
}

@ -174,7 +174,7 @@ public:
unsigned long uid;
};
CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPath, unsigned int netId);
CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPath, unsigned int netId, unsigned int versionCode);
virtual ~CPhoneDevice();
virtual void SetListener(IListener* listener);
@ -281,6 +281,7 @@ protected:
IListener* m_listener;
const CFG_RECOGNIZATION* m_pRecognizationCfg;
unsigned int mNetId;
unsigned int mVersionCode;
atomic_ulong m_timerUidFeed;
atomic_ulong m_wakelockIdFeed;

@ -662,7 +662,9 @@ public class MicroPhotoService extends Service {
MicroPhotoService service = MicroPhotoService.this;
service.mNativeHandle = init(appPath, server, port, cmdid, protocol, networkProtocol, 0, service.getSignalLevel());
int versionCode = MicroPhotoContext.getVersionCode(MicroPhotoService.this.getApplicationContext());
service.mNativeHandle = init(appPath, server, port, cmdid, protocol, networkProtocol, 0, service.getSignalLevel(), versionCode);
if (service.mNativeHandle !=0) {
isRunning = true;
@ -1059,7 +1061,7 @@ CellSignalStrengthGsm cellSignalStrengthGsm = cellInfoGsm.getCellSignalStrength(
cellSignalStrengthGsm.getDbm();
*/
protected native long init(String appPath, String ip, int port, String cmdid, int protocol, int networkProtocl, long netHandle, int signalLevel);
protected native long init(String appPath, String ip, int port, String cmdid, int protocol, int networkProtocl, long netHandle, int signalLevel, int versionCode);
protected native long getHeartbeatDuration(long handler);
protected native long[] getPhotoTimeData(long handler, long startTime);
protected native long[] getPhotoTimeData2(long handler);

@ -415,5 +415,16 @@ public class MicroPhotoContext {
return verName;
}
public static int getVersionCode(Context context) {
int versionCode = 0;
try {
versionCode = context.getPackageManager().
getPackageInfo(context.getPackageName(), 0).versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return versionCode;
}
}

Loading…
Cancel
Save