From 6825cf07a31845dc6b3d2c7dcc8e1377b75517ca Mon Sep 17 00:00:00 2001
From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期一, 17 七月 2017 15:20:38 +0800
Subject: [PATCH]
---
VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp | 77 ++++++++++----------------------------
1 files changed, 21 insertions(+), 56 deletions(-)
diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp
index d25de07..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,50 +735,14 @@
}
-static void callNum(int fd, 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("/dev/ttyS4", 2400);
- serialWriteString(fd, "AA");
- sleep(1);
-
- std::string _phone;
+
+ std::string _phone;
{
const char *utfFunc = env->GetStringUTFChars(phone, NULL);
_phone = utfFunc;
@@ -787,22 +750,24 @@
}
const char *phoneNum = _phone.c_str();
-
- while (*phoneNum)
- {
- sleep(1);
- callNum(fd, *(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)
{
- int fd = serialOpen("/dev/ttyS4", 2400);
- serialWriteString(fd, "BA");
+ 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