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
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef BluetoothServerSocketH
00033 #define BluetoothServerSocketH
00034
00035 #include <zeusbase/Net/AbstractSocket.h>
00036 #include <zeusbase/Net/Bluetooth/BTDefines.hpp>
00037
00038 BEGIN_NAMESPACE_Zeus
00039
00040 class TBluetoothSocket;
00041
00042
00045
00046 zeusbase_class TBluetoothServerSocket : public TAbstractSocket
00047 {
00048 public:
00049 TBluetoothServerSocket();
00050
00051 bool hasAuthentication() const;
00052 bool hasEncryption() const;
00053 void setAuthentication(bool bMode);
00054 void setEncryption(bool bMode);
00055
00056
00057 virtual Retval accept(TBluetoothSocket*& rpClient);
00058 virtual Retval acceptTO(TBluetoothSocket*& rpClient, Float fTimeOut);
00059 virtual Retval connect() { return RET_REQUEST_FAILED; }
00060 virtual Retval bind();
00061 bool isBound() const;
00062
00063
00064
00065
00066 protected:
00067 virtual ~TBluetoothServerSocket();
00068
00069 private:
00070 Retval acceptInternal(TBluetoothSocket*& rpClient, Float fTimeOut);
00071 };
00072
00073
00074
00077
00078 inline bool TBluetoothServerSocket::hasAuthentication() const
00079 {
00080 #if defined(ENABLE_WIN32_BLUETOOTH)
00081 return TAbstractSocket::getBoolSocketOption(m_iSocketFD, SO_BTH_AUTHENTICATE, SOL_RFCOMM);
00082 #else
00083 return false;
00084 #endif
00085 }
00086
00087
00090
00091 inline bool TBluetoothServerSocket::hasEncryption() const
00092 {
00093 #if defined(ENABLE_WIN32_BLUETOOTH)
00094 return TAbstractSocket::getBoolSocketOption(m_iSocketFD, SO_BTH_ENCRYPT, SOL_RFCOMM);
00095 #else
00096 return false;
00097 #endif
00098 }
00099
00100
00103
00104 inline void TBluetoothServerSocket::setAuthentication(bool bMode)
00105 {
00106 #if defined(ENABLE_WIN32_BLUETOOTH)
00107 TAbstractSocket::setBoolSocketOption(m_iSocketFD, SO_BTH_AUTHENTICATE, SOL_RFCOMM, bMode);
00108 #endif
00109 }
00110
00111
00114
00115 inline void TBluetoothServerSocket::setEncryption(bool bMode)
00116 {
00117 #if defined(ENABLE_WIN32_BLUETOOTH)
00118 TAbstractSocket::setBoolSocketOption(m_iSocketFD, SO_BTH_ENCRYPT, SOL_RFCOMM, bMode);
00119 #endif
00120 }
00121
00122
00127
00128 inline bool TBluetoothServerSocket::isBound() const
00129 {
00130 return isConnected();
00131 }
00132
00133
00144
00145 inline Retval TBluetoothServerSocket::accept(TBluetoothSocket*& rpClient)
00146 {
00147 return acceptInternal(rpClient, 0.001);
00148 }
00149
00150
00159
00160 inline Retval TBluetoothServerSocket::acceptTO(TBluetoothSocket*& rpClient, Float fTimeOut)
00161 {
00162 return acceptInternal(rpClient, fTimeOut);
00163 }
00164
00165
00166 END_NAMESPACE_Zeus
00167
00168 #endif