Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BARRY_M_SERIAL_H__
00023 #define __BARRY_M_SERIAL_H__
00024
00025 #include "dll.h"
00026 #include "modem.h"
00027 #include "socket.h"
00028 #include "data.h"
00029 #include "pppfilter.h"
00030
00031 namespace Barry {
00032
00033
00034 class Controller;
00035
00036 namespace Mode {
00037
00038 class BXEXPORT Serial : public Modem
00039 {
00040 public:
00041 typedef void (*DeviceDataCallback)(void *context, const unsigned char *data, int len);
00042
00043 private:
00044 Controller &m_con;
00045
00046 SocketHandle m_data;
00047 SocketHandle m_ctrl;
00048
00049 uint16_t m_ModeSocket;
00050
00051 uint16_t m_CtrlSocket;
00052
00053
00054 PppFilter m_filter;
00055
00056
00057
00058
00059
00060 DeviceDataCallback m_callback;
00061 void *m_callback_context;
00062
00063 protected:
00064 static void DataCallback(Serial &context, Data *data);
00065 static void CtrlCallback(Serial &context, Data *data);
00066
00067 public:
00068 Serial(Controller &con, DeviceDataCallback callback, void *callback_context);
00069 ~Serial();
00070
00071
00072
00073 void Open(const char *password = 0);
00074
00075
00076 void Close();
00077 void RetryPassword(const char *password);
00078
00079
00080
00081
00082
00083 void Write(const Data &data, int timeout = -1);
00084 };
00085
00086 }}
00087
00088 #endif
00089