Bluetooth Framework C++ Edition
Public Member Functions | Protected Member Functions | List of all members
CwclRfCommServerConnection Class Reference

The base class for all WCL Bluetooth RFCOMM based server connections. More...

#include <wclBluetooth.h>

Inheritance diagram for CwclRfCommServerConnection:
CwclServerDataConnection CwclServerConnection CwclCustomConnection

Public Member Functions

 CwclRfCommServerConnection (CwclBluetoothRadio *const Radio)
 Create new Classic Bluetooth server connection.
 
int Listen (const GUID &Service, const tstring &ServiceName=_T(""), const unsigned char Channel=0, const bool Authentication=true, const bool Encryption=false)
 The method starts listening for client connections.
 
bool GetAuthentication () const
 Gets the authentication value.
 
 __declspec (property(get=GetAuthentication)) bool Authentication
 Gets the authentication value.
 
unsigned char GetAssignedChannel () const
 Gets the assigned RFCOMM channel number.
 
 __declspec (property(get=GetAssignedChannel)) unsigned char AssignedChannel
 Gets the assigned RFCOMM channel number.
 
unsigned char GetChannel () const
 Gets the service RFCOMM channel number. 0 to auto detection.
 
 __declspec (property(get=GetChannel)) unsigned char Channel
 Gets the service RFCOMM channel number. 0 to auto detection.
 
bool GetEncryption () const
 Gets the encryption state of the connection.
 
 __declspec (property(get=GetEncryption)) bool Encryption
 Gets the encryption state of the connection.
 
CwclBluetoothRadioGetRadio () const
 Gets the connection owner.
 
 __declspec (property(get=GetRadio)) CwclBluetoothRadio *Radio
 Gets the connection owner.
 
GUID GetService () const
 Gets the Bluetooth service UUID used for connection.
 
 __declspec (property(get=GetService)) GUID Service
 Gets the Bluetooth service UUID used for connection.
 
tstring GetServiceName () const
 Gets the service name.
 
 __declspec (property(get=GetServiceName)) tstring ServiceName
 Gets the service name.
 
__event void GetSdpAttributes (void *Sender, wclBluetoothSdpProtocols &Protocols, wclBluetoothSdpProfiles &Profiles, wclBluetoothSdpFormats &Formats, unsigned long &Cod)
 The event fires when the server builds SDP record for the service it runs. If an application needs to provide additional attributes it should handle the event. By default no additional attributes is added for the SDP record.
 
- Public Member Functions inherited from CwclServerDataConnection
 CwclServerDataConnection ()
 Creates a new client data connection.
 
__event void OnData (void *Sender, CwclServerClientDataConnection *const Client, const void *const Data, const unsigned long Size)
 The event fires when new data is received from the connected remote device.
 
- Public Member Functions inherited from CwclServerConnection
 CwclServerConnection ()
 Creates a new server connection.
 
virtual ~CwclServerConnection ()
 Frees the server connection.
 
int Close ()
 The method disconnects all connected clients and closes the server.
 
int Listen ()
 The method starts listening for client connections.
 
CwclServerClientConnectionGetClients (const size_t Index) const
 Gets a connected client by its index.
 
 __declspec (property(get=GetClients)) CwclServerClientConnection *Clients[]
 Gets a connected client by its index.
 
size_t GetClientsCount () const
 Gets the number of connected clients.
 
 __declspec (property(get=GetClientsCount)) size_t ClientsCount
 Gets the number of connected clients.
 
wclServerState GetState () const
 Gets the connection state.
 
 __declspec (property(get=GetState)) wclServerState State
 Gets the connection state.
 
__event void OnClosed (void *Sender, const int Reason)
 The event fires when the server is closed.
 
__event void OnConnect (void *Sender, CwclServerClientConnection *const Client, const int Error)
 The event fires when a remote client is connected to the server.
 
__event void OnDisconnect (void *Sender, CwclServerClientConnection *const Client, const int Reason)
 The event fires when a remote client has disconnected from the server.
 
__event void OnListen (void *Sender)
 The event fires when the server is ready to accept incoming connections (is in listening state).
 
- Public Member Functions inherited from CwclCustomConnection
 CwclCustomConnection ()
 Creates a new connection.
 
virtual ~CwclCustomConnection ()
 Frees the connection.
 
CwclMessageReceiverGetReceiver () const
 Gets the connection message receiver object.
 
 __declspec (property(get=GetReceiver)) CwclMessageReceiver *Receiver
 Gets the connection message receiver object.
 
DWORD GetThreadId () const
 Gets the connection's thread ID.
 
 __declspec (property(get=GetThreadId)) DWORD ThreadId
 Gets the connection's thread ID.
 

Protected Member Functions

virtual void MessageReceived (const CwclMessage *const Message) override
 The method called when a new notification message received.
 
void SetAssignedChannel (const unsigned char Channel)
 Sets the assigned RFCOMM channel number.
 
virtual void DoGetSdpAttributes (wclBluetoothSdpProtocols &Protocols, wclBluetoothSdpProfiles &Profiles, wclBluetoothSdpFormats &Formats, unsigned long &Cod)
 Fires the GetSdpAttributes event.
 
- Protected Member Functions inherited from CwclServerDataConnection
virtual void UnhookDeletedClientEvents (CwclServerClientConnection *const Client) override
 Unhooks events from the client that should be deleted.
 
virtual void SetClientEvents (CwclServerClientConnection *const Client) override
 The method sets the client's event handlers.
 
virtual void DoData (CwclServerClientDataConnection *const Client, const void *const Data, const unsigned long Size)
 Fires the OnData event.
 
- Protected Member Functions inherited from CwclServerConnection
virtual void UnhookDeletedClientEvents (CwclServerClientConnection *const Client)
 Unhooks events from the client that should be deleted.
 
void InternalClose (const int Reason)
 Closes the server.
 
int CreateNewClientConnection (const void *const Params, const unsigned long ParamsSize)
 Sends a notification to the main thread to create and init new client connection.
 
virtual void MessageReceived (const CwclMessage *const Message) override
 The message receiver calls this method when a new notification message has been received.
 
virtual void DoClosed (const int Reason)
 Fires the OnClosed event.
 
virtual void DoConnect (CwclServerClientConnection *const Client, const int Error)
 Fires the OnConnect event.
 
virtual void DoDisconnect (CwclServerClientConnection *const Client, const int Reason)
 Fires the OnDisconnect event.
 
virtual void DoListen ()
 Fires the OnListen event.
 
virtual void SetClientEvents (CwclServerClientConnection *const Client)
 The method sets the client's event handlers.
 
virtual int HalListen (const HANDLE Event)=0
 Implements a hardware-dependent method for listening the client connections.
 
virtual int HalClose ()=0
 Implements a hardware-dependent method to stop listening.
 
virtual CwclServerClientConnectionHalCreateClient ()=0
 The method creates a hardware and transport-dependent client connection.
 
virtual int HalPrepare ()=0
 Implements a hardware-dependent code that prepares for listening.
 
- Protected Member Functions inherited from CwclCustomConnection
virtual void MessageReceived (const CwclMessage *const Message)
 The message receiver calls this method when a new notification message has been received.
 
void Enter ()
 Enters the connection's critical section.
 
void Leave ()
 Exists *leaves) the connection's critical section.
 

Detailed Description

The base class for all WCL Bluetooth RFCOMM based server connections.

An application must never create instances of this class directly. Instead of that an application must use related methods from the CwclBluetoothRadio object.

See also
CwclBluetoothRadio, CwclServerDataConnection