BluetoothServer.h

Go to the documentation of this file.
00001 #ifndef _OASYS_BT_SERVER_H_
00002 #define _OASYS_BT_SERVER_H_
00003 
00004 #include <config.h> 
00005 #ifdef OASYS_BLUETOOTH_ENABLED
00006 
00007 #include "BluetoothSocket.h"
00008 #include "../thread/Thread.h"
00009 
00010 namespace oasys {
00011 
00017 class BluetoothServer : public BluetoothSocket {
00018 public:
00019     BluetoothServer(int socktype, BluetoothSocket::proto_t proto,
00020              char* logbase = "/btserver");
00021 
00023 
00024     int listen();
00025     int accept(int *fd, bdaddr_t *addr, u_int8_t *channel);
00027 
00034     int timeout_accept(int *fd, bdaddr_t *addr, u_int8_t *channel,
00035                        int timeout_ms);
00036 };
00037 
00045 class BluetoothServerThread : public BluetoothServer, public Thread {
00046 public:
00047     BluetoothServerThread(int socktype, BluetoothSocket::proto_t proto,
00048                           const char* name,
00049                           char* logbase = "/btserver", int flags = 0,
00050                           int accept_timeout = -1)
00051         : BluetoothServer(socktype,proto,logbase), Thread(name,flags),
00052           accept_timeout_(accept_timeout)
00053     {
00054     }
00055     
00060     virtual void accepted(int fd, bdaddr_t addr, u_int8_t channel) = 0;
00061 
00071     void run();
00072 
00083     int bind_listen_start(bdaddr_t local_addr, u_int8_t local_channel);
00084 protected:
00089     int accept_timeout_;
00090 };
00091 
00092 } // namespace oasys
00093                         
00094 #endif /* OASYS_BLUETOOTH_ENABLED */
00095 #endif /* _OASYS_BT_SERVER_H_ */

Generated on Fri Dec 22 14:47:57 2006 for DTN Reference Implementation by  doxygen 1.5.1