#ifndef __TeleWrapper_H__
|
#define __TeleWrapper_H__
|
|
#include <queue>
|
#include <pthread.h>
|
#include <unistd.h>
|
#include <stdlib.h>
|
#include "serial.h"
|
|
|
#define PORT "/dev/ttyS4"
|
#define BAUD 2400
|
|
|
typedef struct TeleTask
|
{
|
enum Tel
|
{
|
CALL,
|
HANGUP
|
};
|
Tel command;
|
std::string param;
|
}TeleTask;
|
|
class TeleWrapper
|
{
|
public:
|
TeleWrapper() {}
|
~TeleWrapper() {}
|
|
bool start();
|
void stop();
|
void pushTask(TeleTask task);
|
void popTask();
|
|
|
void call(std::string phone);
|
void hang();
|
|
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();
|
|
|
|
void callNum( char phone);
|
|
};
|
|
|
|
#endif
|