#ifndef __TeleWrapper_H__ #define __TeleWrapper_H__ #include #include #include #include #include #include #define PORT "/dev/ttyS4" #define BAUD 2400 typedef struct TeleTask { enum Tel { CALL, HANGUP }; Tel command; std::string param; // string param; }TeleTask; class TeleWrapper { public: TeleWrapper() {} ~TeleWrapper() {} bool start(); void stop(); // void pause(); void pushTask(TeleTask task); void popTask(); void call(std::string phone); void hang(); pthread_t tel_thid; bool running; std::queue telQueue; //不安全 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