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

Bluetooth Low Energy GATT client. More...

#include <wclBluetooth.h>

Inheritance diagram for CwclGattClient:
CwclBluetoothComponent

Public Member Functions

 CwclGattClient ()
 Creates new TwclGattClient component.
 
virtual ~CwclGattClient ()
 Frees the component.
 
int Connect (CwclBluetoothRadio *const Radio)
 Connects to a remote Bluetooth LE device.
 
int Disconnect ()
 Disconnects from a remote device.
 
int FindCharacteristic (const wclGattService &Service, const wclGattUuid &Uuid, wclGattCharacteristic &Characteristic, const wclGattOperationFlag Flag=goNone)
 The method searches the characteristic in given service with the specified UUID.
 
int FindService (const wclGattUuid &Uuid, wclGattService &Service, const wclGattOperationFlag Flag=goNone)
 The method searches the service with specified UUID.
 
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, unsigned char *&Value, unsigned long &Length, const wclGattProtectionLevel Protection=plNone)
 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, wclGattDescriptorValue &Value, const wclGattProtectionLevel Protection=plNone)
 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 (const wclGattCharacteristic &Characteristic, const unsigned char *const Value, const unsigned long Length, const wclGattProtectionLevel Protection=plNone, const wclGattWriteKind WriteKind=wkAuto)
 The method writes the specified characteristic value to the Bluetooth device.
 
int WriteDescriptorValue (const wclGattDescriptor &Descriptor, const wclGattDescriptorValue &Value, const wclGattProtectionLevel Protection=plNone)
 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=plNone, const wclGattSubscribeKind SubscribeKind=skManual)
 Writes the client configuration descriptor to the device.
 
int Subscribe (const wclGattCharacteristic &Characteristic, wclGattSubscribeKind SubscribeKind=skManual)
 Subscribes for the characteristic changes notifications.
 
int Unsubscribe (const wclGattCharacteristic &Characteristic, const wclGattSubscribeKind SubscribeKind=skManual)
 Unsubscribes from the characteristic changes notifications.
 
int SubscribeForNotifications (const wclGattCharacteristic &Characteristic, const wclGattOperationFlag Flag=goNone, const wclGattProtectionLevel Protection=plNone, const wclGattSubscribeKind SubscribeKind=skManual)
 Subscribes for the characteristic changes notifications and writes the client configuration descriptor to the device.
 
int UnsubscribeFromNotifications (const wclGattCharacteristic &Characteristic, const wclGattOperationFlag Flag=goNone, const wclGattProtectionLevel Protection=plNone, const wclGattSubscribeKind SubscribeKind=skManual)
 Unsubscribes from the characteristic changes notifications and writes the client configuration descriptor to the 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.
 
CwclBluetoothRadioGetRadio () const
 Gets the Radio used for connection.
 
 __declspec (property(get=GetRadio)) CwclBluetoothRadio *Radio
 Gets the Radio used for connection.
 
wclClientState GetState () const
 Gets the client state.
 
 __declspec (property(get=GetState)) wclClientState State
 Gets the client state.
 
__int64 GetAddress () const
 Gets a target Bluetooth device's MAC address.
 
void SetAddress (const __int64 Value)
 Sets a target Bluetooth device's MAC address.
 
 __declspec (property(get=GetAddress, put=SetAddress)) __int64 Address
 Gets and sets a target Bluetooth device's MAC address.
 
bool GetConnectOnRead () const
 Gets connection mode.
 
void SetConnectOnRead (const bool Value)
 Sets connection mode.
 
 __declspec (property(get=GetConnectOnRead, put=SetConnectOnRead)) bool ConnectOnRead
 Gets and sets connection mode.
 
bool GetForceNotifications () const
 Gets the notifications mode.
 
void SetForceNotifications (const bool Value)
 Sets the notifications mode.
 
 __declspec (property(get=GetForceNotifications, put=SetForceNotifications)) bool ForceNotifications
 Gets and sets the notifications mode.
 
__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 OnConnect (void *Sender, const int Error)
 The event fires when a connection to a remote device has been established.
 
__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 OnDisconnect (void *Sender, const int Reason)
 The even fires when a connection to a remote device has been closed.
 
__event void OnMaxPduSizeChanged (void *Sender)
 The event fires when the maximum PDU size changed.
 
- Public Member Functions inherited from CwclBluetoothComponent
 CwclBluetoothComponent ()
 Creates a new component.
 
virtual ~CwclBluetoothComponent ()
 Frees the component.
 

Protected Member Functions

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 OnMaxPduSizeChanged event.
 
virtual void DoConnect (const int Error)
 Fires the OnConnected event.
 
virtual void DoDisconnect (const int Reason)
 Fires then OnDisconnected event.
 
- Protected Member Functions inherited from CwclBluetoothComponent
void SetCopy (CwclCustomConnection *const NewConnection)
 The method sets new copy of the current connection.
 
void Enter () const
 Enters the Bluetooth component protection critical section.
 
void Leave () const
 Leaves the Bluetooth component protection critical section.
 

Detailed Description

Bluetooth Low Energy GATT client.

The TwclGattClient component enables an application to connect to a Bluetooth Low Energy device and work with GATT profiles.

See also
CwclBluetoothComponent