houxiao
2017-07-24 514795c44cbad68fe213c5f00c902d370464c022
VisitFace/RtspNativeCodec/app/src/main/cpp/TeleWrapper.h
@@ -1,11 +1,12 @@
#ifndef __TeleWrapper_H__
#define __TeleWrapper_H__
#include <thread>
#include <queue>
#include <pthread.h>
#include <unistd.h>  
#include <stdlib.h> 
#include "serial.h"
#include <string>
 
#define PORT  "/dev/ttyS4"
@@ -21,6 +22,7 @@
   };
   Tel command;
   std::string param;
    //  string param;
}TeleTask;
class TeleWrapper
@@ -31,6 +33,7 @@
   bool start();
   void stop();
  //  void pause();
   void pushTask(TeleTask task);
   void popTask();
   
@@ -40,27 +43,21 @@
   pthread_t tel_thid;
  bool running;
private:
  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();
    //不安全
    pthread_mutex_t mutex;
    pthread_cond_t cond;
private:
    int  fd =-1;
    //static
    static void *tel_thd(void *arg) ;
  
 void callNum(  char phone);
    void callNum(const std::string phone);
};
#endif