From e0a8ae3449f90a6d88ad8d597af8fd27be7cfe6c Mon Sep 17 00:00:00 2001 From: qvyuanxin <qvyuanxin@454eff88-639b-444f-9e54-f578c98de674> Date: 星期四, 13 七月 2017 18:08:08 +0800 Subject: [PATCH] --- VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp | 79 +++++++++------------------------------ 1 files changed, 19 insertions(+), 60 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp index 797c337..db1440e 100644 --- a/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp @@ -17,12 +17,8 @@ #include <stdlib.h> #include "DebugNetwork.h" +#include "TeleWrapper.h" - -extern "C" -{ -#include "serial.h" -} //#include <mediastreamer2/include/mediastreamer2/msjava.h> @@ -34,6 +30,8 @@ static std::string g_stface_license_str; CameraWrapper g_CameraWrappers[CAMERA_COUNT]; + +TeleWrapper g_TeleWrapper; CaptureCamera g_CaptureCamera; @@ -57,6 +55,7 @@ g_CameraWrappers[i].pipeLineRender = new PipeLine; //PipeLine& pipeLine(*(g_CameraWrappers[i].pipeLineDecoderDetector)); } + g_TeleWrapper.start(); } void @@ -736,55 +735,14 @@ } -int fd =-1; -#define PORT "/dev/ttyS4" -#define BAUD 2400 -static void callNum( char phone) -{ - switch (phone) - { - case '1': - serialWriteString(fd, "DA");//1 - break; - case '2': - serialWriteString(fd, "DB");//2 - break; - case '3': - serialWriteString(fd, "DC");//3 - break; - case '4': - serialWriteString(fd, "DD");//4 - break; - case '5': - serialWriteString(fd, "DE");//5 - break; - case '6': - serialWriteString(fd, "DF");//6 - break; - case '7': - serialWriteString(fd, "DG");//7 - break; - case '8': - serialWriteString(fd, "DH");//8 - break; - case '9': - serialWriteString(fd, "DI");//9 - break; - case '0': - serialWriteString(fd, "DJ");//0 - break; - } -} + bool Java_cn_com_basic_face_util_RtspFaceNative_telCall(JNIEnv *env, jclass clazz, jstring phone) { - int fd = serialOpen(PORT, BAUD); - serialWriteString(fd, "AA"); - sleep(1); - - std::string _phone; + + std::string _phone; { const char *utfFunc = env->GetStringUTFChars(phone, NULL); _phone = utfFunc; @@ -792,23 +750,24 @@ } const char *phoneNum = _phone.c_str(); - - while (*phoneNum) - { - sleep(1); - callNum(*(phoneNum++)); - } - - return false; + TeleTask task; + task.command= TeleTask::CALL; + task.param = phoneNum; + g_TeleWrapper.push(task); } void Java_cn_com_basic_face_util_RtspFaceNative_Hang(JNIEnv *env, jclass clazz) { - - serialWriteString(fd, "BA"); - serialClose(fd); + TeleTask task; + task.command =TeleTask::HANGUP; + g_TeleWrapper.push(task); } +void Java_cn_com_basic_face_util_RtspFaceNative_TelShutdown(JNIEnv *env, jclass clazz) +{ + LOG_DEBUG << "@@@ Java_cn_com_basic_face_util_RtspFaceNative_telShutdown" << LOG_ENDL; + g_TeleWrapper.stop(); +} void Java_cn_com_basic_face_util_RtspFaceNative_setFaceLabel(JNIEnv *env, jclass clazz, jint cameraIdx, jint stTrackId, jstring phoneNumber) { LOG_DEBUG << "@@@ Java_cn_com_basic_face_util_RtspFaceNative_setFaceLabel" << LOG_ENDL; -- Gitblit v1.8.0