pans
2017-08-18 7572cd33f27b512691b6acf39cd0d78d35017a46
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