|
|
|
@ -434,16 +434,18 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
{
|
|
|
|
|
result.clear();
|
|
|
|
|
|
|
|
|
|
const char* ITEM_SEP = "\t"; //
|
|
|
|
|
unsigned int numberOfChannels = 0;
|
|
|
|
|
|
|
|
|
|
result += "设备自检 版本:" + GetVersion() + NEW_LINE_TAG;
|
|
|
|
|
result += "设备自检 版本:" + GetVersion() + ITEM_SEP;
|
|
|
|
|
|
|
|
|
|
Json::Value appConfig = Json::objectValue;
|
|
|
|
|
std::vector<unsigned char> content;
|
|
|
|
|
std::string filePath = m_appPath + (APP_DATA_DIR DIR_SEP_STR APP_FILE_NAME_APP_CONF);
|
|
|
|
|
if (!readFile(filePath, content))
|
|
|
|
|
{
|
|
|
|
|
result += ("读取系统配置文件App.json失败" NEW_LINE_TAG);
|
|
|
|
|
result += "读取系统配置文件App.json失败";
|
|
|
|
|
result += ITEM_SEP;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -457,16 +459,16 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
if (GetJSONUInt32Value(appConfig, "channels", val) && (val > 0 && val <= 255))
|
|
|
|
|
{
|
|
|
|
|
numberOfChannels = val;
|
|
|
|
|
result += "通道数:" + std::to_string(numberOfChannels) + NEW_LINE_TAG;
|
|
|
|
|
result += "通道数:" + std::to_string(numberOfChannels) + ITEM_SEP;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result += "通道数未定义或者无效" NEW_LINE_TAG;
|
|
|
|
|
result += "通道数未定义或者无效" + std::string(ITEM_SEP);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result += "解析系统配置文件App.json失败" NEW_LINE_TAG;
|
|
|
|
|
result += "解析系统配置文件App.json失败" + std::string(ITEM_SEP);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -481,7 +483,7 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
filePath = m_appPath + (APP_DATA_DIR DIR_SEP_STR APP_FILE_NAME_APP_CONF);
|
|
|
|
|
if (!readFile(filePath, content))
|
|
|
|
|
{
|
|
|
|
|
result += "读取通道" + std::to_string(channel) + "配置文件失败" NEW_LINE_TAG;
|
|
|
|
|
result += "读取通道" + std::to_string(channel) + "配置文件失败" + std::string(ITEM_SEP);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -494,17 +496,17 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
GetJSONUInt8Value(channelCfg, "usbCamera", usbCamera);
|
|
|
|
|
if (GetJSONUInt8Value(channelCfg, "cameraId", cameraId))
|
|
|
|
|
{
|
|
|
|
|
result += "通道" + std::to_string(channel) + " Camera ID为 " + std::to_string(cameraId) + NEW_LINE_TAG;
|
|
|
|
|
result += "通道" + std::to_string(channel) + " Camera ID为 " + std::to_string(cameraId) + ITEM_SEP;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cameraId = channel - 1;
|
|
|
|
|
result += "通道" + std::to_string(channel) + "未定义Camera ID, 使用默认值 " + std::to_string(cameraId) + NEW_LINE_TAG;
|
|
|
|
|
result += "通道" + std::to_string(channel) + "未定义Camera ID, 使用默认值 " + std::to_string(cameraId) + ITEM_SEP;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result += "解析通道" + std::to_string(channel) + "配置文件App.json失败" NEW_LINE_TAG;
|
|
|
|
|
result += "解析通道" + std::to_string(channel) + "配置文件App.json失败" + std::string(ITEM_SEP);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -526,11 +528,11 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
}
|
|
|
|
|
if (res == 0)
|
|
|
|
|
{
|
|
|
|
|
result += "通道" + std::to_string(channel) + "正常:最大分辨率:" + std::to_string(width) + "x" + std::to_string(height) + NEW_LINE_TAG;
|
|
|
|
|
result += "通道" + std::to_string(channel) + "正常:最大分辨率:" + std::to_string(width) + "x" + std::to_string(height) + ITEM_SEP;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result += "通道" + std::to_string(channel) + " 异常 err=" + std::to_string(res) + NEW_LINE_TAG;
|
|
|
|
|
result += "通道" + std::to_string(channel) + " 异常 err=" + std::to_string(res) + ITEM_SEP;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -538,19 +540,19 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
if (bv > 0)
|
|
|
|
|
{
|
|
|
|
|
bv -= bv % 100;
|
|
|
|
|
result += std::string("电池电压:") + std::to_string(bv / 1000) + std::string(".") + std::to_string((bv % 1000) / 100) + NEW_LINE_TAG;
|
|
|
|
|
result += std::string("电池电压:") + std::to_string(bv / 1000) + std::string(".") + std::to_string((bv % 1000) / 100) + ITEM_SEP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fs::space_info si = fs::space("/data");
|
|
|
|
|
double fr = ((double)si.available * 100.0f) / ((double)si.capacity);
|
|
|
|
|
result += "可用存储:";
|
|
|
|
|
result += std::to_string((int)fr);
|
|
|
|
|
result += "%%" NEW_LINE_TAG;
|
|
|
|
|
result += "%%" + std::string(ITEM_SEP);
|
|
|
|
|
|
|
|
|
|
long fm = android_os_Process_getFreeMemory();
|
|
|
|
|
long tm = android_os_Process_getTotalMemory();
|
|
|
|
|
double fmp = ((double)fm * 100.0f) / ((double)tm);
|
|
|
|
|
result += std::string("可用内存:") + std::to_string((int)fmp) + std::string("%%" NEW_LINE_TAG);
|
|
|
|
|
result += std::string("可用内存:") + std::to_string((int)fmp) + std::string("%%") + ITEM_SEP;
|
|
|
|
|
|
|
|
|
|
if (!m_tfCardPath.empty())
|
|
|
|
|
{
|
|
|
|
@ -558,12 +560,12 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
double fr2 = ((double)si2.available * 100.0f) / ((double)si2.capacity);
|
|
|
|
|
result += "TF卡可用空间:";
|
|
|
|
|
result += std::to_string((int)fr2);
|
|
|
|
|
result += "%%" NEW_LINE_TAG;
|
|
|
|
|
result += "%%" + std::string(ITEM_SEP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result += "4G信号强度:";
|
|
|
|
|
result += std::to_string(m_signalLevel);
|
|
|
|
|
result += NEW_LINE_TAG;
|
|
|
|
|
result += ITEM_SEP;
|
|
|
|
|
|
|
|
|
|
result += "网络接口:";
|
|
|
|
|
std::vector<std::string> devices;
|
|
|
|
@ -573,7 +575,7 @@ bool CPhoneDevice::SelfTest(std::string& result)
|
|
|
|
|
result += (*it);
|
|
|
|
|
result += " ";
|
|
|
|
|
}
|
|
|
|
|
// result += NEW_LINE_TAG;
|
|
|
|
|
// result += ITEM_SEP;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|