From 514795c44cbad68fe213c5f00c902d370464c022 Mon Sep 17 00:00:00 2001 From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674> Date: 星期一, 24 七月 2017 20:18:21 +0800 Subject: [PATCH] add panshen TeleWrapper --- VisitFace/RtspNativeCodec/app/src/main/cpp/TeleWrapper.h | 79 +++++++++++++++++++-------------------- 1 files changed, 38 insertions(+), 41 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/TeleWrapper.h b/VisitFace/RtspNativeCodec/app/src/main/cpp/TeleWrapper.h index c9bc047..32309d3 100644 --- a/VisitFace/RtspNativeCodec/app/src/main/cpp/TeleWrapper.h +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/TeleWrapper.h @@ -1,12 +1,13 @@ #ifndef __TeleWrapper_H__ #define __TeleWrapper_H__ +#include <thread> #include <queue> #include <pthread.h> -#include <unistd.h> -#include <stdlib.h> -#include "serial.h" - +#include <unistd.h> +#include <stdlib.h> +#include <string> + #define PORT "/dev/ttyS4" #define BAUD 2400 @@ -14,53 +15,49 @@ typedef struct TeleTask { - enum Tel - { - CALL, - HANGUP - }; - Tel command; - std::string param; + enum Tel + { + CALL, + HANGUP + }; + Tel command; + std::string param; + // string param; }TeleTask; class TeleWrapper { public: - TeleWrapper() {} - ~TeleWrapper() {} + TeleWrapper() {} + ~TeleWrapper() {} - bool start(); - void stop(); - void pushTask(TeleTask task); - void popTask(); - - - void call(std::string phone); - void hang(); + bool start(); + void stop(); + // void pause(); + void pushTask(TeleTask task); + void popTask(); - pthread_t tel_thid; - bool running; + + void call(std::string phone); + void hang(); + + pthread_t tel_thid; + bool running; + + std::queue<TeleTask> telQueue; + + //涓嶅畨鍏� + pthread_mutex_t mutex; + pthread_cond_t cond; private: + int fd =-1; + //static + static void *tel_thd(void *arg) ; - int fd =-1; - - std::queue<TeleTask> telQueue; - void *tel_thd(void *arg) ; - - bool pthread_pause = false; - - pthread_cond_t cond_pause = PTHREAD_COND_INITIALIZER; - pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - - void thread_pause(); - void thread_resume(); - - - void callNum( char phone); + void callNum(char phone); + void callNum(const std::string phone); }; - - -#endif +#endif -- Gitblit v1.8.0