Bluetooth Framework C++ Edition
|
The class represents a Bluetooth LE GATT client connection. More...
#include <wclBluetooth.h>
Public Member Functions | |
CwclGattClientConnection (CwclBluetoothRadio *const Radio) | |
Creates a new GATT client connection object. | |
int | ReadCharacteristics (const wclGattService &Service, const wclGattOperationFlag Flag, wclGattCharacteristics &Characteristics) |
The method reads all the characteristics available for the specified service. | |
int | ReadCharacteristicValue (const wclGattCharacteristic &Characteristic, const wclGattOperationFlag Flag, const wclGattProtectionLevel Protection, unsigned char *&Value, unsigned long &Length) |
The method reads the value of the specified characteristic. | |
int | ReadDescriptors (const wclGattCharacteristic &Characteristic, const wclGattOperationFlag Flag, wclGattDescriptors &Descriptors) |
The method reads all the descriptors available for the specified characteristic. | |
int | ReadDescriptorValue (const wclGattDescriptor &Descriptor, const wclGattOperationFlag Flag, const wclGattProtectionLevel Protection, wclGattDescriptorValue &Value) |
The method reads the value of the specified descriptor. | |
int | ReadIncludedServices (const wclGattService &Service, const wclGattOperationFlag Flag, wclGattServices &Services) |
The method reads all the included services available for a given service. | |
int | ReadServices (const wclGattOperationFlag Flag, wclGattServices &Services) |
Reads available services from a remote Bluetooth LE device. | |
int | WriteCharacteristicValue (wclGattCharacteristic Characteristic, const wclGattProtectionLevel Protection, const unsigned char *const Value, const unsigned long Length, const wclGattWriteKind WriteKind) |
The method writes the specified characteristic value to the Bluetooth device. | |
int | WriteDescriptorValue (const wclGattDescriptor &Descriptor, const wclGattProtectionLevel Protection, const wclGattDescriptorValue &Value) |
The method writes the specified descriptor value to the Bluetooth device. | |
int | WriteClientConfiguration (const wclGattCharacteristic &Characteristic, const bool Subscribe, const wclGattOperationFlag Flag, const wclGattProtectionLevel Protection) |
Writes the client configuration descriptor to the device. | |
int | Subscribe (const wclGattCharacteristic &Characteristic) |
Subscribes for the characteristic changes notifications. | |
int | Unsubscribe (const wclGattCharacteristic &Characteristic) |
Unsubscribes from the characteristic changes notifications. | |
int | Connect (const __int64 Address, const bool ConnectOnRead, const bool ForceNotifications) |
Connects to a remote device. | |
int | GetConnectionParams (wclBluetoothLeConnectionParameters &Params) |
Gets the current connection parameters. | |
int | SetConnectionParams (const wclBluetoothLeConnectionParametersType Params) |
Request the connection parameters change to the specified preferred connection parameters. | |
int | SetConnectionParams (const wclBluetoothLeConnectionParametersValue &Params) |
Request the connection parameters change to the specified preferred connection parameters. | |
int | GetMaxPduSize (unsigned short &Size) |
Reads the maximum PDU size for the current connection. | |
int | GetConnectionPhyInfo (wclBluetoothLeConnectionPhy &Info) |
Reads the Bluetooth LE physical layer (PHY) information. | |
__int64 | GetAddress () const |
Gets a remote device MAC address. | |
__declspec (property(get=GetAddress)) __int64 Address | |
Gets a remote device MAC address. | |
bool | GetConnectOnRead () const |
Gets connection mode. | |
__declspec (property(get=GetConnectOnRead)) bool ConnectOnRead | |
Gets connection mode. | |
bool | GetForceNotifications () const |
Gets the notifications mode. | |
__declspec (property(get=GetForceNotifications)) bool ForceNotifications | |
Gets the notifications mode. | |
CwclBluetoothRadio * | GetRadio () const |
Gets the connection owner. | |
__declspec (property(get=GetRadio)) CwclBluetoothRadio *Radio | |
Gets the connection owner. | |
__event void | OnCharacteristicChanged (void *Sender, const unsigned short Handle, const unsigned char *const Value, unsigned long const Length) |
The event fires when a subscribed characteristic value has been changed. | |
__event void | OnConnectionParamsChanged (void *Sender) |
The event fires when the connection parameters changed. | |
__event void | OnConnectionPhyChanged (void *Sender) |
The event fires when the connection PHY changed. | |
__event void | OnMaxPduSizeChanged (void *Sender) |
The event fires when the maximum PDU size changed. | |
Public Member Functions inherited from CwclClientConnection | |
CwclClientConnection () | |
Creates a new client connection. | |
virtual | ~CwclClientConnection () |
Frees the connection. | |
int | Connect (const unsigned long Timeout=10000) |
Connects to a remote device. | |
int | Disconnect () |
Disconnects from the connected remote device. | |
wclClientState | GetState () const |
Gets the connection state. | |
__declspec (property(get=GetState)) wclClientState State | |
Gets the connection state. | |
unsigned long | GetTimeout () const |
Gets the connect timeout value. | |
__declspec (property(get=GetTimeout)) unsigned long Timeout | |
Gets the connect timeout value. | |
__event void | OnConnect (void *Sender, const int Error) |
The event fires when a connection to a remote device has been completed (with or without success). | |
__event void | OnDisconnect (void *Sender, const int Reason) |
The event fires when the remote connected device has been disconnected. | |
Public Member Functions inherited from CwclCustomConnection | |
CwclCustomConnection () | |
Creates a new connection. | |
virtual | ~CwclCustomConnection () |
Frees the connection. | |
CwclMessageReceiver * | GetReceiver () 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 int | PrepareForConnection () |
The method called internally before connection. | |
virtual void | MessageReceived (const CwclMessage *const Message) override |
The method called when a new notification message received. | |
virtual int | HalConnect (const HANDLE Event) override |
Implements a hardware-dependent code that connects to a remote device. | |
virtual int | HalDisconnect () override |
Implements a hardware-dependent code that disconnects from the connected remote device. | |
virtual void | DoCharacteristicChanged (const unsigned short Handle, const unsigned char *const Value, const unsigned long Length) |
Fires the OnCharacteristicChanged event. | |
virtual void | DoConnectionParamsChanged () |
Fires the OnConnectionParamsChanged event. | |
virtual void | DoConnectionPhyChanged () |
Fires the OnConnectionPhyChanged event. | |
virtual void | DoMaxPduSizeChanged () |
Fires the OnPduMaxSizeChanged event. | |
virtual int | HalReadCharacteristics (const wclGattService &Service, const wclGattOperationFlag Flag, wclGattCharacteristics &Characteristics)=0 |
Implements a hardware-dependent code for reading the characteristics available for the specified service. | |
virtual int | HalReadCharacteristicValue (const wclGattCharacteristic &Characteristic, const wclGattOperationFlag Flag, const wclGattProtectionLevel Protection, unsigned char *&Value, unsigned long &Length)=0 |
Implements a hardware-dependent code for reading the value of the specified characteristic. | |
virtual int | HalReadDescriptors (const wclGattCharacteristic &Characteristic, const wclGattOperationFlag Flag, wclGattDescriptors &Descriptors)=0 |
The method reads all the descriptors available for the specified characteristic. | |
virtual int | HalReadDescriptorValue (const wclGattDescriptor &Descriptor, const wclGattOperationFlag Flag, const wclGattProtectionLevel Protection, wclGattDescriptorValue &Value)=0 |
Implements a hardware-dependent code for reading the value of the specified descriptor. | |
virtual int | HalReadIncludedServices (const wclGattService &Service, const wclGattOperationFlag Flag, wclGattServices &Services)=0 |
Implements a hardware-dependent code for reading the included services available for a given service. | |
virtual int | HalReadServices (const wclGattOperationFlag Flag, wclGattServices &Services)=0 |
Implements a hardware-dependent code for reading available services from a remote Bluetooth LE device. | |
virtual int | HalWriteCharacteristicValue (const wclGattCharacteristic &Characteristic, const wclGattProtectionLevel Protection, const unsigned char *const Value, const unsigned long Length)=0 |
Implements a hardware-dependent code to write the specified characteristic value to the Bluetooth device. | |
virtual int | HalWriteDescriptorValue (const wclGattDescriptor &Descriptor, const wclGattProtectionLevel Protection, const wclGattDescriptorValue &Value)=0 |
Implements a hardware-dependent code to write the specified descriptor value to the Bluetooth device. | |
virtual int | HalSubscribe (const wclGattCharacteristic &Characteristic, HANDLE &Hdl)=0 |
Implements a hardware-dependent code to subscribes for the characteristic changes notifications. | |
virtual int | HalUnsubscribe (const HANDLE Hdl)=0 |
Implements a hardware-dependent code to unsubscribes from the characteristic changes notifications. | |
virtual int | HalGetConnectionParams (wclBluetoothLeConnectionParameters &Params)=0 |
Implements a hardware-dependent code to get the current connection parameters. | |
virtual int | HalSetConnectionParams (const wclBluetoothLeConnectionParametersType Params)=0 |
Implements a hardware-dependent code to request the connection parameters change to the specified preferred connection parameters. | |
virtual int | HalSetConnectionParams (const wclBluetoothLeConnectionParametersValue &Params)=0 |
Implements a hardware-dependent code to request the connection parameters change to the specified preferred connection parameters. | |
virtual int | HalGetMaxPduSize (unsigned short &Size)=0 |
Implements a hardware-dependent code to reads the maximum PDU size for the current connection. | |
virtual int | HalGetConnectionPhyInfo (wclBluetoothLeConnectionPhy &Info)=0 |
Implements a hardware-dependent code to reads the Bluetooth LE physical layer (PHY) information. | |
Protected Member Functions inherited from CwclClientConnection | |
void | InternalDisconnect (const int Reason) |
The internal disconnect method. Disconnects from a connected remote device. | |
void | NotifyClosed (const int Reason) |
Send a Disconnect notification message. | |
virtual void | MessageReceived (const CwclMessage *const Message) override |
The message receiver calls this method when a new notification message has been received. | |
virtual void | DoConnect (const int Error) |
Fires the OnConnect event. | |
virtual void | DoDisconnect (const int Reason) |
Fires the OnDisconnect event. | |
virtual int | HalCommunicate (const HANDLE Event) |
Implements a hardware-dependent code that communicate with the connected remote device. | |
virtual int | HalConnect (const HANDLE Event)=0 |
Implements a hardware-dependent code that connects to a remote device. | |
virtual int | HalDisconnect ()=0 |
Implements a hardware-dependent code that disconnects from the connected remote device. | |
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. | |
The class represents a Bluetooth LE GATT client connection.
An application must never create instances of this class directly. Instead of that an application must use related methods from the CwclBluetoothRadio object.