...
The VictorMockDeviceManager manages all mock VictoR device connection interfaces through VictorMockDevice objects that it creates, maintains, and destroys as needed. This class acts as the primary interface for end-users to “discover” (create) mock devices and manage connections to them. In addition, the VictorMockDeviceManager provides a wrapper around the functions that the VictorMockDevice class offers, requiring only that the end-user provide the ID for the specific mock device that they are interested in interacting with, so that they don’t need to have any knowledge of the underlying organization of the devices within the manager. The class diagram in Figure 1 illustrates the architecture of the Mock Communications API.
...
VictorMockDevice
MockDevice VictorMockDevice represents an “internal” device, i.e. it is simply a data structure containing data fields (“attributes”, “characteristics”) that can be read from/written to, held in system memory.
Additionally, MockDevice VictorMockDevice maintains a dictionary that maps attributes to callbacks. The callbacks should be triggered with the associated attribute whenever the attribute is written to, or on state changes.
GetDeviceIDGetDevice
Returns the device ID information as a stringVictorDeviceInfo structure
Connect
Flags device as “connected”
Retrieves a list of services, building the list if it does not exist
The list may contain mock services
For each service, retrieve a list of offered characteristics, building the list if it does not exist
The list may contain mock characteristics
Disconnect
Un-flags device as “connected”
...
Reads the specified attribute and returns data via the given callback
Attribute and data is stored as a dictionary of UUID to byte arrays
Where possible, byte array size will adhere to the specifications stated in the ICD
Write
Writes the given data to the specified attribute
Attribute and data is stored as a dictionary of UUID to byte arrays
Where possible, byte array size will adhere to the specifications stated in the ICD
Triggers all callbacks associated with the specified attribute
SubscribeSubscribeAttributeChange
Creates the specified attribute if such attribute does not already exist in the mock device
Register the given callback by adding it to the association table
UnsubscribeUnsubscribeAttributeChange
Deregister the given callback by removing it from the association table
SubscribeConnectionStateChange
Register the given callback by adding it to the association table
Associated callbacks are triggered when connection state changes
UnsubscribeConnectionStateChange
Deregister the given callback by removing it from the association table
VictorMockDeviceManager
Connect
...
Removes device from dictionary
GetConnectedDeviceIDsGetConnectedDevices
Returns a list of VictorDeviceInfos of IDs connected devices from connected device dictionary
...
SubscribeConnectionStateChange
Register the given callback by adding it to the association table
Associated callbacks are triggered when connection state changes
UnsubscribeConnectionStateChange
Deregister the given callback by removing it from the association table
Glossary
Term | Description |
---|---|
API | Application Programming Interface |
End-User | A developer utilizing the VictoR SDK libraries for software application development |
ICD | Interface Control Document |
ID | Identifier |
I/O | Input/Output |
OS | Operating System |
SDK | Software Development Kit |
UUID | Universally Unique Identifier |