m_ipmodem.h
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
00023 #ifndef __BARRY_M_IPMODEM_H__
00024 #define __BARRY_M_IPMODEM_H__
00025
00026 #include "dll.h"
00027 #include "modem.h"
00028 #include "usbwrap.h"
00029 #include "data.h"
00030 #include "pppfilter.h"
00031 #include <pthread.h>
00032
00033 namespace Barry {
00034
00035
00036 class Controller;
00037
00038 namespace Mode {
00039
00040 class BXEXPORT IpModem : public Modem
00041 {
00042 public:
00043 typedef void (*DeviceDataCallback)(void *context, const unsigned char *data, int len);
00044
00045 private:
00046 Controller &m_con;
00047 Usb::Device &m_dev;
00048
00049 PppFilter m_filter;
00050
00051
00052 volatile bool m_continue_reading;
00053 pthread_t m_modem_read_thread;
00054
00055
00056 DeviceDataCallback m_callback;
00057 void *m_callback_context;
00058
00059 unsigned char m_session_key[8];
00060
00061 private:
00062 BXLOCAL bool SendPassword(const char *password = 0);
00063
00064 protected:
00065 static void *DataReadThread(void *userptr);
00066
00067 public:
00068 IpModem(Controller &con, DeviceDataCallback callback, void *callback_context);
00069 ~IpModem();
00070
00071
00072
00073 void Open(const char *password = 0);
00074 void Close();
00075
00076
00077
00078
00079
00080 void Write(const Data &data, int timeout = -1);
00081 };
00082
00083 }}
00084
00085 #endif
00086