4S Device Communication Module Collection  Version 0.6-SNAPSHOT
Full documentation of the modules in the 4SDC collection (aimed at 4SDC module developers)
PAL::PersonalHealthDeviceHandler Class Reference

The abstract class, session-layer components must implement to handle communication with personal health devices from any transport class. More...

#include <personalhealthdevice.h>

+ Inheritance diagram for PAL::PersonalHealthDeviceHandler:
+ Collaboration diagram for PAL::PersonalHealthDeviceHandler:

Classes

class  PrivatePHDHandler
 

Public Member Functions

virtual ~PersonalHealthDeviceHandler ()
 Cleanup and make sure all devices are disconnected. More...
 

Protected Member Functions

void registerDatatype (uint16_t datatype)
 Registers a session-layer component as handler of a datatype. More...
 
void unregisterDatatype (uint16_t datatype) noexcept
 Unregisters a session-layer component as handler of a datatype. More...
 
void sendApduPrimary (std::shared_ptr< VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu) noexcept
 Send a message to this device on the primary virtual channel. More...
 
void disconnect (std::shared_ptr< VirtualPHD > device) noexcept
 Disconnect the device. More...
 
void sendApduStreaming (std::shared_ptr< VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu) noexcept
 Send a message to this device on a streaming virtual channel. More...
 
- Protected Member Functions inherited from PAL::PersonalHealthDeviceConnector
virtual void connectIndication (std::shared_ptr< VirtualPHD > device) noexcept=0
 Indicates the connection of a new device. More...
 
virtual void disconnectIndication (std::shared_ptr< VirtualPHD > device, errortype error=0) noexcept=0
 Indicates a device disconnection along with error details. More...
 
virtual void apduReceived (std::shared_ptr< VirtualPHD > device, std::shared_ptr< std::vector< uint8_t > > apdu, bool reliableTransport) noexcept=0
 Receive a message from this device. More...
 

Private Attributes

PrivatePHDHandlerprivateParts
 

Detailed Description

Constructor & Destructor Documentation

PersonalHealthDeviceHandler::~PersonalHealthDeviceHandler ( )
virtual

The destructor will make sure that any connection to the PAL-layer components that was left open will be disconnected, and that any registered datatype that the session-layer component (child class) forgot to unregister will be properly unregistered.

Member Function Documentation

void PersonalHealthDeviceHandler::disconnect ( std::shared_ptr< VirtualPHD device)
protectedvirtualnoexcept

A protocol-to-PAL message. If the device is currently connected, it will be disconnected immediately (and a disconnectIndication() will be returned from the PAL shortly), otherwise nothing will happen.

Parameters
deviceThe device, we wish to disconnect.

Implements PAL::PersonalHealthDeviceConnector.

+ Here is the caller graph for this function:

void PersonalHealthDeviceHandler::registerDatatype ( uint16_t  datatype)
protectedvirtual

A protocol-to-PAL message. This message is issued by the session-layer component, when it is ready to handle a given datatype. When the component no longer handles the datatype, the unregisterDatatype() is used to stop new connections of that particular datatype.

The datatype must be one of the IEEE MDC_DEV_SPEC_PROFILE_ codes belonging to the MDC_PART_INFRA partition.

The PersonalHealthDeviceProviderBase and PersonalHealthDeviceHandler classes will keep track of which session-layer components handles which datatypes, and will broadcast the registerDatatype() and unregisterDatatype() messages to all PAL-layer components when a previously unhandled datatype is registered for the first time and when a datatype is no longer being handled.

Except in the unlikely event of memory exhaustion, this method should never throw any exceptions.

See also
unregisterDatatype()
Parameters
datatypeThe datatype handled by this component.
Exceptions
std::bad_allocin case of memory exhaustion.

Implements PAL::PersonalHealthDeviceConnector.

+ Here is the caller graph for this function:

void PersonalHealthDeviceHandler::sendApduPrimary ( std::shared_ptr< VirtualPHD device,
std::shared_ptr< std::vector< uint8_t > >  apdu 
)
protectedvirtualnoexcept

A protocol-to-PAL message. If the device is currently connected, this method will (attempt to) send a message to the device on the primary virtual channel (which by definition is a reliable transport service). There will be no indication of whether this attempt was succesful or not. In particular, if this device object is currently not connected, the method invocation will be ignored.

Parameters
deviceThe device, we are sending to.
apduThe buffer of bytes to transmit to the device.

Implements PAL::PersonalHealthDeviceConnector.

+ Here is the caller graph for this function:

void PersonalHealthDeviceHandler::sendApduStreaming ( std::shared_ptr< VirtualPHD device,
std::shared_ptr< std::vector< uint8_t > >  apdu 
)
protectedvirtualnoexcept

A protocol-to-PAL message. If the device is currently connected, this method will (attempt to) send a message to the device on a streaming virtual channel. If such a channel is not available, it will attempt the primary virtual channel instead. There will be no indication of whether this attempt was succesful or not. In particular, if this device object is currently not connected, the method invocation will simply be ignored.

Parameters
deviceThe bluetooth device to send to. The shared pointer must point to a PHDBluetoothDevice, otherwise the method will use the primary virtual channel.
apduThe buffer of bytes to transmit to the device.

Implements PAL::PHDBluetoothConnector.

+ Here is the call graph for this function:

void PersonalHealthDeviceHandler::unregisterDatatype ( uint16_t  datatype)
protectedvirtualnoexcept

A protocol-to-PAL message. This message is issued by the session-layer component, when it no longer wishes to handle the given datatype. For more details, see the documentation of the registerDatatype() method.

See also
registerDatatype()
Parameters
datatypeThe datatype no longer handled by this component.

Implements PAL::PersonalHealthDeviceConnector.

+ Here is the caller graph for this function:


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