liuguijing 3 months ago
commit 49b614b7b9

@ -5,7 +5,7 @@ plugins {
// 10,00,000 major-minor-build
def AppMajorVersion = 1
def AppMinorVersion = 3
def AppBuildNumber = 98
def AppBuildNumber = 101
def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + 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);
ALOGV("%s: nativeWriteInputStream called with: width=%u, height=%u, "
"rowStride=%d, pixStride=%d, offset=%" PRId64, __FUNCTION__, uWidth,
uHeight, rowStride, pixStride, offset);
"rowStride=%d, pixStride=%d, offset=%lld", __FUNCTION__, uWidth,
uHeight, rowStride, pixStride, (int64_t)offset);
ByteVectorOutput 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);
ALOGV("%s: nativeWriteInputStream called with: width=%u, height=%u, "
"rowStride=%d, pixStride=%d, offset=%" PRId64, __FUNCTION__, uWidth,
uHeight, rowStride, pixStride, offset);
"rowStride=%d, pixStride=%d, offset=%lld", __FUNCTION__, uWidth,
uHeight, rowStride, pixStride, (int64_t)offset);
ByteVectorOutput 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);
}
#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)
{
JNIEnv* env = NULL;
jint result = -1;
// 在 JNI_OnLoad 或其他初始化函数中注册
#if 0
signal(SIGSEGV, sighandler);
#endif
#if defined(JNI_VERSION_1_6)
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;
Camera2Reader *camera = new Camera2Reader(id);
const char *pathStr = env->GetStringUTFChars(path, 0);
const char *fileNameStr = env->GetStringUTFChars(fileName, 0);
std::string pathStr = jstring2string(env, path);
std::string fileNameStr = jstring2string(env, fileName);
camera->Open(pathStr, fileNameStr);
env->ReleaseStringUTFChars(fileName, fileNameStr);
env->ReleaseStringUTFChars(path, pathStr);
camera->Open(pathStr.c_str(), fileNameStr.c_str());
camera->start();
@ -335,12 +349,12 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
env->SetObjectField(pThis, fieldId, modelName);
bool udpOrTcp = (networkProtocol != 0); // 0: tcp
const char *appPathStr = appPath == NULL ? NULL : env->GetStringUTFChars(appPath, 0);
const char *ipStr = ip == NULL ? NULL : env->GetStringUTFChars(ip, 0);
const char *cmdidStr = cmdid == NULL ? NULL : env->GetStringUTFChars(cmdid, 0);
const char *simcardStr = simcard == NULL ? NULL : env->GetStringUTFChars(simcard, 0);
const char *tfCardPathStr = tfCardPath == NULL ? NULL : env->GetStringUTFChars(tfCardPath, 0);
const char *nativeLibraryDirStr = nativeLibraryDir == NULL ? NULL : env->GetStringUTFChars(nativeLibraryDir, 0);
std::string appPathStr = jstring2string(env, appPath);
std::string ipStr = jstring2string(env, ip);
std::string cmdidStr = jstring2string(env, cmdid);
std::string simcardStr = jstring2string(env, simcard);
std::string tfCardPathStr = jstring2string(env, tfCardPath);
std::string nativeLibraryDirStr = jstring2string(env, nativeLibraryDir);
JavaVM* vm = NULL;
jint ret = env->GetJavaVM(&vm);
@ -351,14 +365,14 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
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->UpdateSignalLevel(signalLevel);
device->SetBuildTime(buildTime / 1000);
device->UpdateSimcard(MakeString(simcardStr));
device->UpdateTfCardPath(MakeString(tfCardPathStr));
device->UpdateSimcard(simcardStr);
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
#if defined(USING_NRSEC) && !defined(USING_NRSEC_VPN)
pTerminal->InitEncryptionInfo(simcardStr, "/dev/spidev0.0", "");
@ -370,12 +384,6 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
#ifdef _DEBUG
ALOGD("Finish Startup");
#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)
{
@ -476,11 +484,8 @@ Java_com_xypower_mpapp_MicroPhotoService_takePhoto(
osds[2].text = cfg.osd.rightBottom;
osds[3].text = cfg.osd.leftBottom;
const char* pathStr = env->GetStringUTFChars(path, 0);
device->TakePhoto(photoInfo, osds, MakeString(pathStr));
env->ReleaseStringUTFChars(path, pathStr);
std::string pathStr = jstring2string(env, path);
device->TakePhoto(photoInfo, osds, pathStr);
// device->TurnOffCameraPower(NULL);
// if (photoInfo.usbCamera)
@ -714,9 +719,7 @@ Java_com_xypower_mpapp_MicroPhotoService_recoganizePicture(
JNIEnv* env,
jclass cls, jstring paramPath, jstring binPath, jstring blobName8, jstring blobName16, jstring blobName32, jstring picPath) {
const char* pParamPathStr = env->GetStringUTFChars(paramPath, 0);
std::string paramPathStr = MakeString(pParamPathStr);
env->ReleaseStringUTFChars(paramPath, pParamPathStr);
std::string paramPathStr = jstring2string(env, paramPath);
const char* pBinPathStr = env->GetStringUTFChars(binPath, 0);
std::string binPathStr = MakeString(pBinPathStr);
@ -983,9 +986,8 @@ Java_com_xypower_mpapp_MicroPhotoService_infoLog(
return;
}
const char *msgStr = env->GetStringUTFChars(msg, 0);
XYLOG(XYLOG_SEVERITY_INFO, msgStr);
env->ReleaseStringUTFChars(msg, msgStr);
std::string str = jstring2string(env, msg);
XYLOG(XYLOG_SEVERITY_INFO, str.c_str());
}
extern "C" JNIEXPORT jboolean JNICALL

@ -627,6 +627,7 @@ void CPhoneDevice::SetRecognizationCfg(const IDevice::CFG_RECOGNIZATION* pRecogn
}
else
{
#ifndef ISING_N938
XYLOG(XYLOG_SEVERITY_INFO, "AI Enabled and will Init NCNN");
ncnn_init();
mAIInitialized = true;
@ -639,6 +640,7 @@ void CPhoneDevice::SetRecognizationCfg(const IDevice::CFG_RECOGNIZATION* pRecogn
{
XYLOG(XYLOG_SEVERITY_ERROR, "Failed to Init NCNN");
}
#endif // #ifndef ISING_N938
}
}
else
@ -1251,11 +1253,11 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging)
XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage");
for (idx = 0; idx < timesForAvg; idx++)
{
auto now = std::chrono::system_clock::now();
// auto now = std::chrono::system_clock::now();
val = GpioControl::getChargingBusVoltage();
auto now2 = std::chrono::system_clock::now();
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));
// auto now2 = std::chrono::system_clock::now();
// 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));
if (val > 1000)
{
chargingBusVoltage = (float)val / 1000.0;
@ -1272,11 +1274,11 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging)
int matched = 0;
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
auto now4 = std::chrono::system_clock::now();
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));
// auto now4 = std::chrono::system_clock::now();
// 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));
if (val > 0)
{
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);
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
// TakePhotoCb(1, localPhotoInfo, "", takingTime);

@ -445,7 +445,7 @@ uint8_t getdevtype(int devno)
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;
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)
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;
time_t now;

@ -346,11 +346,11 @@ void Gm_OpenSerialPort(int devidx);
// 关闭串口通讯
void Gm_CloseSerialPort();
void DebugLog(int commid, char *szbuf, char flag);
int SaveLogTofile(int commid, char *szbuf);
void DebugLog(int commid, const char *szbuf, char flag);
int SaveLogTofile(int commid, const char *szbuf);
// 功能说明:串口发送数据 返回实际发送的字节数
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();
// 启动使用串口拍照

@ -182,5 +182,5 @@ bool HangYuCtrl::TakePhoto(std::vector<uint8_t>& img)
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);
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;
}
@ -158,6 +158,7 @@ bool YuShiCtrl::TakePhoto(std::vector<uint8_t>& img)
bool YuShiCtrl::TakeVideo(uint32_t duration, std::string path) {
return false;
}

Loading…
Cancel
Save