4S Device Communication Module Collection  Version 0.6-SNAPSHOT
Public interfaces of the modules in the 4SDC collection (aimed at users of the 4SDC modules)
PAL::BluetoothModule Class Reference

Bluetooth PAL-layer module wrapper class. More...

#include <bluetooth.h>

+ Inheritance diagram for PAL::BluetoothModule:
+ Collaboration diagram for PAL::BluetoothModule:

Public Member Functions

 BluetoothModule ()
 Launch and initialize the Bluetooth module. More...
 
 ~BluetoothModule ()
 Free resources used by the Bluetooth module.
 
void msgGoingDown ()
 Will stop the module and (relatively gracefully) disconnect any open connections. More...
 
void registerDatatype (uint16_t datatype) noexcept
 A session-layer component has been registered as handler of a datatype. More...
 
void unregisterDatatype (uint16_t datatype) noexcept
 Session-layer components are no longer registered to handle this datatype. More...
 
void sendApduPrimary (std::shared_ptr< PAL::VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu) noexcept
 Send a message to this device on the primary channel. More...
 
void sendApduStreaming (std::shared_ptr< PAL::VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu) noexcept
 Send a message to this device on a streaming channel. More...
 
void disconnect (std::shared_ptr< PAL::VirtualPHD > device) noexcept
 Session-layer component request to disconnect a device. More...
 
- Public Member Functions inherited from FSYS::Module
virtual void msgReady (void)
 
virtual void msgGroupReady (void)
 
virtual void msgSystemReady (void)
 
virtual void msgDestroy (void)
 

Friends

class PrivateBluetoothModule
 

Additional Inherited Members

- Protected Member Functions inherited from PAL::PHDBluetoothConnector
virtual void sendApduStreaming (std::shared_ptr< VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu) noexcept=0
 Send a message to this device on a streaming virtual channel. More...
 
- Protected Member Functions inherited from PAL::PersonalHealthDeviceConnector
virtual void sendApduPrimary (std::shared_ptr< VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu) noexcept=0
 Send a message to this device on the primary virtual channel. More...
 
virtual void disconnect (std::shared_ptr< VirtualPHD > device) noexcept=0
 Disconnect the device. More...
 
- Protected Member Functions inherited from PAL::PersonalHealthDeviceProviderBase
void connectIndication (std::shared_ptr< VirtualPHD > device) noexcept
 Indicates the connection of a new device. More...
 
void disconnectIndication (std::shared_ptr< VirtualPHD > device, errortype error) noexcept
 Indicates a device disconnection along with error details. More...
 
void apduReceived (std::shared_ptr< VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu, bool reliableTransport) noexcept
 Receive a message from this device. More...
 
virtual ~PersonalHealthDeviceProviderBase ()
 Cleanup and make sure all devices are disconnected. More...
 
- Protected Attributes inherited from PAL::PersonalHealthDeviceProviderBase
PrivatePHDProvider * privateParts
 

Detailed Description

This class wraps a module providing connections to classic Bluetooth (Health Device Profile) devices. In the future, support for BLE devices and device management operations should be be added to this class as well.

The class derives from the PAL::PHDBluetoothProvider which handles the HDP communication with other modules.

Todo:
Revisit documentation for instructions on starting and terminating the module using the module launcher
See also
PAL::PHDBluetoothProvider

Constructor & Destructor Documentation

PAL::BluetoothModule::BluetoothModule ( )

The Bluetooth module is initialized.

Todo:
Revisit documentation for instructions on starting and terminating the module using the module launcher

Member Function Documentation

void PAL::BluetoothModule::disconnect ( std::shared_ptr< PAL::VirtualPHD device)
noexcept

The session-layer component handling this device wishes to disconnect. When the device has been disconnected, we must reply with a disconnectIndication().

Parameters
deviceThe device we must disconnect.
void PAL::BluetoothModule::msgGoingDown ( )
virtual

This method stops the Bluetooth module. If any connections are open, they will be disconnected with "gentle force". This signal should be delivered to the module just before it is destructed. When the module receives this signal, it will stop accepting new connections and close all existing - in other words: it will be a brick waiting for destruction.

Parameters
signalThe Terminate signal.

Reimplemented from FSYS::Module.

void PAL::BluetoothModule::registerDatatype ( uint16_t  datatype)
virtualnoexcept

This method is called when a session-layer component is ready to handle the given datatype. We should start accepting incoming connections of this type.

Parameters
datatypeThe datatype that will be handled.

Implements PAL::PersonalHealthDeviceConnector.

void PAL::BluetoothModule::sendApduPrimary ( std::shared_ptr< PAL::VirtualPHD device,
std::shared_ptr< std::vector< uint8_t > >  apdu 
)
noexcept

Send a message to the given device on the reliable primary channel. If no channel is currently open to this device, ignore the call; if the transmission fails (e.g. because the destination went out of range), follow up with a disconnectIndication() with a suitable error code.

Parameters
deviceThe destination
apduThe message payload
void PAL::BluetoothModule::sendApduStreaming ( std::shared_ptr< PAL::VirtualPHD device,
std::shared_ptr< std::vector< uint8_t > >  apdu 
)
noexcept

Attempt to send this message to the given device on an unreliable streaming channel. If no streaming channel is currently open, use the primary channel instead (

See also
sendApduPrimary()).
Parameters
deviceThe destination
apduThe message payload
void PAL::BluetoothModule::unregisterDatatype ( uint16_t  datatype)
virtualnoexcept

This method is called when no more session-layer components are ready to handle the given datatype. We should no longer accept incoming connections of this type.

Parameters
datatypeThe datatype that will no longer be accepted.

Implements PAL::PersonalHealthDeviceConnector.


The documentation for this class was generated from the following file: