liuguijing 3 months ago
commit 49b614b7b9

@ -5,7 +5,7 @@ plugins {
// 10,00,000 major-minor-build // 10,00,000 major-minor-build
def AppMajorVersion = 1 def AppMajorVersion = 1
def AppMinorVersion = 3 def AppMinorVersion = 3
def AppBuildNumber = 98 def AppBuildNumber = 101
def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber
def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber

@ -2509,8 +2509,8 @@ void DngCreator::writeInputStream(std::vector<uint8_t>& outStream,
uint64_t uOffset = static_cast<uint32_t>(offset); uint64_t uOffset = static_cast<uint32_t>(offset);
ALOGV("%s: nativeWriteInputStream called with: width=%u, height=%u, " ALOGV("%s: nativeWriteInputStream called with: width=%u, height=%u, "
"rowStride=%d, pixStride=%d, offset=%" PRId64, __FUNCTION__, uWidth, "rowStride=%d, pixStride=%d, offset=%lld", __FUNCTION__, uWidth,
uHeight, rowStride, pixStride, offset); uHeight, rowStride, pixStride, (int64_t)offset);
ByteVectorOutput out(outStream); ByteVectorOutput out(outStream);
// std::vector<uint8_t>& out = outStream; // std::vector<uint8_t>& out = outStream;
@ -2578,8 +2578,8 @@ void DngCreator::writeInputBuffer(std::vector<uint8_t>& outStream,
uint64_t uOffset = static_cast<uint32_t>(offset); uint64_t uOffset = static_cast<uint32_t>(offset);
ALOGV("%s: nativeWriteInputStream called with: width=%u, height=%u, " ALOGV("%s: nativeWriteInputStream called with: width=%u, height=%u, "
"rowStride=%d, pixStride=%d, offset=%" PRId64, __FUNCTION__, uWidth, "rowStride=%d, pixStride=%d, offset=%lld", __FUNCTION__, uWidth,
uHeight, rowStride, pixStride, offset); uHeight, rowStride, pixStride, (int64_t)offset);
ByteVectorOutput out(outStream); ByteVectorOutput out(outStream);
// std::vector<uint8_t>& out = outStream; // std::vector<uint8_t>& out = outStream;

@ -171,11 +171,27 @@ void Runner::RequestCapture(CTerminal* pTerminal, unsigned int channel, unsigned
pTerminal->RequestCapture(channel, preset, type, scheduleTime); pTerminal->RequestCapture(channel, preset, type, scheduleTime);
} }
#include <signal.h>
#include <android/log.h>
#if 0
void sighandler(int sig) {
__android_log_print(ANDROID_LOG_ERROR, "NativeCrash", "Caught signal %d", sig);
exit(1);
}
#endif
jint JNI_OnLoad(JavaVM* vm, void* reserved) jint JNI_OnLoad(JavaVM* vm, void* reserved)
{ {
JNIEnv* env = NULL; JNIEnv* env = NULL;
jint result = -1; jint result = -1;
// 在 JNI_OnLoad 或其他初始化函数中注册
#if 0
signal(SIGSEGV, sighandler);
#endif
#if defined(JNI_VERSION_1_6) #if defined(JNI_VERSION_1_6)
if (result==-1 && vm->GetEnv((void**)&env, JNI_VERSION_1_6) == JNI_OK) if (result==-1 && vm->GetEnv((void**)&env, JNI_VERSION_1_6) == JNI_OK)
{ {
@ -298,12 +314,10 @@ Java_com_xypower_mpapp_MainActivity_takePhoto(
unsigned char id = (unsigned char)channel - 1; unsigned char id = (unsigned char)channel - 1;
Camera2Reader *camera = new Camera2Reader(id); Camera2Reader *camera = new Camera2Reader(id);
const char *pathStr = env->GetStringUTFChars(path, 0); std::string pathStr = jstring2string(env, path);
const char *fileNameStr = env->GetStringUTFChars(fileName, 0); std::string fileNameStr = jstring2string(env, fileName);
camera->Open(pathStr, fileNameStr); camera->Open(pathStr.c_str(), fileNameStr.c_str());
env->ReleaseStringUTFChars(fileName, fileNameStr);
env->ReleaseStringUTFChars(path, pathStr);
camera->start(); camera->start();
@ -335,12 +349,12 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
env->SetObjectField(pThis, fieldId, modelName); env->SetObjectField(pThis, fieldId, modelName);
bool udpOrTcp = (networkProtocol != 0); // 0: tcp bool udpOrTcp = (networkProtocol != 0); // 0: tcp
const char *appPathStr = appPath == NULL ? NULL : env->GetStringUTFChars(appPath, 0); std::string appPathStr = jstring2string(env, appPath);
const char *ipStr = ip == NULL ? NULL : env->GetStringUTFChars(ip, 0); std::string ipStr = jstring2string(env, ip);
const char *cmdidStr = cmdid == NULL ? NULL : env->GetStringUTFChars(cmdid, 0); std::string cmdidStr = jstring2string(env, cmdid);
const char *simcardStr = simcard == NULL ? NULL : env->GetStringUTFChars(simcard, 0); std::string simcardStr = jstring2string(env, simcard);
const char *tfCardPathStr = tfCardPath == NULL ? NULL : env->GetStringUTFChars(tfCardPath, 0); std::string tfCardPathStr = jstring2string(env, tfCardPath);
const char *nativeLibraryDirStr = nativeLibraryDir == NULL ? NULL : env->GetStringUTFChars(nativeLibraryDir, 0); std::string nativeLibraryDirStr = jstring2string(env, nativeLibraryDir);
JavaVM* vm = NULL; JavaVM* vm = NULL;
jint ret = env->GetJavaVM(&vm); jint ret = env->GetJavaVM(&vm);
@ -351,14 +365,14 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
CTerminal* pTerminal = NewTerminal(protocol); CTerminal* pTerminal = NewTerminal(protocol);
CPhoneDevice* device = new CPhoneDevice(vm, pThis, MakeString(appPathStr), (uint64_t)netHandle, versionCode, MakeString(nativeLibraryDirStr)); CPhoneDevice* device = new CPhoneDevice(vm, pThis, appPathStr, (uint64_t)netHandle, versionCode, nativeLibraryDirStr);
device->SetListener(pTerminal); device->SetListener(pTerminal);
device->UpdateSignalLevel(signalLevel); device->UpdateSignalLevel(signalLevel);
device->SetBuildTime(buildTime / 1000); device->SetBuildTime(buildTime / 1000);
device->UpdateSimcard(MakeString(simcardStr)); device->UpdateSimcard(simcardStr);
device->UpdateTfCardPath(MakeString(tfCardPathStr)); device->UpdateTfCardPath(tfCardPathStr);
pTerminal->InitServerInfo(MakeString(appPathStr), MakeString(cmdidStr), MakeString(ipStr), port, udpOrTcp, encryptData); pTerminal->InitServerInfo(appPathStr, cmdidStr, ipStr, port, udpOrTcp, encryptData);
// pTerminal->SetPacketSize(1 * 1024); // 1K // pTerminal->SetPacketSize(1 * 1024); // 1K
#if defined(USING_NRSEC) && !defined(USING_NRSEC_VPN) #if defined(USING_NRSEC) && !defined(USING_NRSEC_VPN)
pTerminal->InitEncryptionInfo(simcardStr, "/dev/spidev0.0", ""); pTerminal->InitEncryptionInfo(simcardStr, "/dev/spidev0.0", "");
@ -370,12 +384,6 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
#ifdef _DEBUG #ifdef _DEBUG
ALOGD("Finish Startup"); ALOGD("Finish Startup");
#endif #endif
if (appPathStr != NULL) env->ReleaseStringUTFChars(appPath, appPathStr);
if (ipStr != NULL) env->ReleaseStringUTFChars(ip, ipStr);
if (cmdidStr != NULL) env->ReleaseStringUTFChars(cmdid, cmdidStr);
if (simcardStr != NULL) env->ReleaseStringUTFChars(simcard, simcardStr);
if (tfCardPathStr != NULL) env->ReleaseStringUTFChars(tfCardPath, tfCardPathStr);
if (nativeLibraryDirStr != NULL) env->ReleaseStringUTFChars(nativeLibraryDir, nativeLibraryDirStr);
if (!res) if (!res)
{ {
@ -476,11 +484,8 @@ Java_com_xypower_mpapp_MicroPhotoService_takePhoto(
osds[2].text = cfg.osd.rightBottom; osds[2].text = cfg.osd.rightBottom;
osds[3].text = cfg.osd.leftBottom; osds[3].text = cfg.osd.leftBottom;
const char* pathStr = env->GetStringUTFChars(path, 0); std::string pathStr = jstring2string(env, path);
device->TakePhoto(photoInfo, osds, pathStr);
device->TakePhoto(photoInfo, osds, MakeString(pathStr));
env->ReleaseStringUTFChars(path, pathStr);
// device->TurnOffCameraPower(NULL); // device->TurnOffCameraPower(NULL);
// if (photoInfo.usbCamera) // if (photoInfo.usbCamera)
@ -714,9 +719,7 @@ Java_com_xypower_mpapp_MicroPhotoService_recoganizePicture(
JNIEnv* env, JNIEnv* env,
jclass cls, jstring paramPath, jstring binPath, jstring blobName8, jstring blobName16, jstring blobName32, jstring picPath) { jclass cls, jstring paramPath, jstring binPath, jstring blobName8, jstring blobName16, jstring blobName32, jstring picPath) {
const char* pParamPathStr = env->GetStringUTFChars(paramPath, 0); std::string paramPathStr = jstring2string(env, paramPath);
std::string paramPathStr = MakeString(pParamPathStr);
env->ReleaseStringUTFChars(paramPath, pParamPathStr);
const char* pBinPathStr = env->GetStringUTFChars(binPath, 0); const char* pBinPathStr = env->GetStringUTFChars(binPath, 0);
std::string binPathStr = MakeString(pBinPathStr); std::string binPathStr = MakeString(pBinPathStr);
@ -983,9 +986,8 @@ Java_com_xypower_mpapp_MicroPhotoService_infoLog(
return; return;
} }
const char *msgStr = env->GetStringUTFChars(msg, 0); std::string str = jstring2string(env, msg);
XYLOG(XYLOG_SEVERITY_INFO, msgStr); XYLOG(XYLOG_SEVERITY_INFO, str.c_str());
env->ReleaseStringUTFChars(msg, msgStr);
} }
extern "C" JNIEXPORT jboolean JNICALL extern "C" JNIEXPORT jboolean JNICALL

@ -627,6 +627,7 @@ void CPhoneDevice::SetRecognizationCfg(const IDevice::CFG_RECOGNIZATION* pRecogn
} }
else else
{ {
#ifndef ISING_N938
XYLOG(XYLOG_SEVERITY_INFO, "AI Enabled and will Init NCNN"); XYLOG(XYLOG_SEVERITY_INFO, "AI Enabled and will Init NCNN");
ncnn_init(); ncnn_init();
mAIInitialized = true; mAIInitialized = true;
@ -639,6 +640,7 @@ void CPhoneDevice::SetRecognizationCfg(const IDevice::CFG_RECOGNIZATION* pRecogn
{ {
XYLOG(XYLOG_SEVERITY_ERROR, "Failed to Init NCNN"); XYLOG(XYLOG_SEVERITY_ERROR, "Failed to Init NCNN");
} }
#endif // #ifndef ISING_N938
} }
} }
else else
@ -1251,11 +1253,11 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging)
XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage"); XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage");
for (idx = 0; idx < timesForAvg; idx++) for (idx = 0; idx < timesForAvg; idx++)
{ {
auto now = std::chrono::system_clock::now(); // auto now = std::chrono::system_clock::now();
val = GpioControl::getChargingBusVoltage(); val = GpioControl::getChargingBusVoltage();
auto now2 = std::chrono::system_clock::now(); // auto now2 = std::chrono::system_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now).count(); // auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now).count();
XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage val=%d, time=%lld", val, static_cast<long long>(duration)); // XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage val=%d, time=%lld", val, static_cast<long long>(duration));
if (val > 1000) if (val > 1000)
{ {
chargingBusVoltage = (float)val / 1000.0; chargingBusVoltage = (float)val / 1000.0;
@ -1272,11 +1274,11 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging)
int matched = 0; int matched = 0;
for (int idx = 0; idx < timesForAvg; idx++) for (int idx = 0; idx < timesForAvg; idx++)
{ {
auto now3 = std::chrono::system_clock::now(); // auto now3 = std::chrono::system_clock::now();
val = GpioControl::getBatteryVoltage(); // // BatVol val = GpioControl::getBatteryVoltage(); // // BatVol
auto now4 = std::chrono::system_clock::now(); // auto now4 = std::chrono::system_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now4 - now3).count(); // auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now4 - now3).count();
XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage val=%d, time=%lld", val, static_cast<long long>(duration)); // XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage val=%d, time=%lld", val, static_cast<long long>(duration));
if (val > 0) if (val > 0)
{ {
totalVals += val > BATTARY_VOLTAGE_MAX ? BATTARY_VOLTAGE_MAX : val; totalVals += val > BATTARY_VOLTAGE_MAX ? BATTARY_VOLTAGE_MAX : val;
@ -1844,7 +1846,7 @@ bool CPhoneDevice::TakeVideoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
{ {
TakePhotoCb(0, localPhotoInfo, "", 0); TakePhotoCb(0, localPhotoInfo, "", 0);
XYLOG(XYLOG_SEVERITY_ERROR, "Failed to TP on NET Camera CH=%u PR=%X PHOTOID=%u URL=%s", (uint32_t)localPhotoInfo.channel, (uint32_t)localPhotoInfo.preset, XYLOG(XYLOG_SEVERITY_ERROR, "Failed to TP on NET Camera CH=%u PR=%X PHOTOID=%u URL=%s", (uint32_t)localPhotoInfo.channel, (uint32_t)localPhotoInfo.preset,
localPhotoInfo.photoId, ip, streamingUrl.c_str()); localPhotoInfo.photoId, ip.c_str(), streamingUrl.c_str());
} }
// Notify to take next photo // Notify to take next photo
// TakePhotoCb(1, localPhotoInfo, "", takingTime); // TakePhotoCb(1, localPhotoInfo, "", takingTime);

@ -445,7 +445,7 @@ uint8_t getdevtype(int devno)
return devparam[devno].ProtocolIdx; return devparam[devno].ProtocolIdx;
} }
// 初始化所有串口及所接传感器的配置 // 初始化所有串口及所接传感器的配置
void Gm_InitSerialComm(SENSOR_PARAM *sensorParam, char *filedir,const char *log) void Gm_InitSerialComm(SENSOR_PARAM *sensorParam, const char *filedir,const char *log)
{ {
int i; int i;
char szbuf[128]; char szbuf[128];
@ -1124,7 +1124,7 @@ void SerialDataProcess(int devidx, u_char *buf, int len)
} }
} }
void DebugLog(int commid, char *szbuf, char flag) void DebugLog(int commid, const char *szbuf, char flag)
{ {
if (NULL == szbuf) if (NULL == szbuf)
return; return;
@ -1152,7 +1152,7 @@ void DebugLog(int commid, char *szbuf, char flag)
} }
} }
int SaveLogTofile(int commid, char *szbuf) int SaveLogTofile(int commid, const char *szbuf)
{ {
int status; int status;
time_t now; time_t now;

@ -346,11 +346,11 @@ void Gm_OpenSerialPort(int devidx);
// 关闭串口通讯 // 关闭串口通讯
void Gm_CloseSerialPort(); void Gm_CloseSerialPort();
void DebugLog(int commid, char *szbuf, char flag); void DebugLog(int commid, const char *szbuf, char flag);
int SaveLogTofile(int commid, char *szbuf); int SaveLogTofile(int commid, const char *szbuf);
// 功能说明:串口发送数据 返回实际发送的字节数 // 功能说明:串口发送数据 返回实际发送的字节数
int GM_SerialComSend(const unsigned char * cSendBuf, size_t nSendLen, int commid); int GM_SerialComSend(const unsigned char * cSendBuf, size_t nSendLen, int commid);
void Gm_InitSerialComm(SENSOR_PARAM *sensorParam, char *filedir,const char *log); void Gm_InitSerialComm(SENSOR_PARAM *sensorParam, const char *filedir,const char *log);
// 启动串口通讯 // 启动串口通讯
void GM_StartSerialComm(); void GM_StartSerialComm();
// 启动使用串口拍照 // 启动使用串口拍照

@ -182,5 +182,5 @@ bool HangYuCtrl::TakePhoto(std::vector<uint8_t>& img)
bool HangYuCtrl::TakeVideo(uint32_t duration, std::string path) bool HangYuCtrl::TakeVideo(uint32_t duration, std::string path)
{ {
return false;
} }

@ -62,7 +62,7 @@ void YuShiCtrl::EnableOsd(bool enable, uint8_t channel)
std::istringstream s(jsonString); std::istringstream s(jsonString);
if (!Json::parseFromStream(reader, s, &root, &errors)) { if (!Json::parseFromStream(reader, s, &root, &errors)) {
XYLOG(XYLOG_SEVERITY_ERROR,"Failed to parse JSON:%s", errors); XYLOG(XYLOG_SEVERITY_ERROR, "Failed to parse JSON:%s", errors.c_str());
return; return;
} }
@ -158,6 +158,7 @@ bool YuShiCtrl::TakePhoto(std::vector<uint8_t>& img)
bool YuShiCtrl::TakeVideo(uint32_t duration, std::string path) { bool YuShiCtrl::TakeVideo(uint32_t duration, std::string path) {
return false;
} }

Loading…
Cancel
Save