Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Current »

Introduction

The Windows BLE Communications interface will provide a set of interfaces and abstract classes that enable developers to communicate with bluetooth devices, facilitating communication with VictoR devices in the VictoR Core library. An abstract device class will be created to provide a means to read, write, connect, and disconnect from bluetooth devices, while refraining from direct references to core VictoR concepts.

Requirements

https://unity3d.atlassian.net/wiki/spaces/FNUPEXT/pages/1584529409/Software+Requirements#2.-Communications

Constraints

Performance

Similar to other interfaces dealing with communications to the VictoR device, asynchronous Read/Write calls will be made available from the interface..

OS Requirements

The interface will target Windows 10 platforms.

Ease of Use

The process of connecting, disconnecting, reading, and writing to a Bluetooth device often requires multiple steps. To help soften the workflow when dealing with this process, the aim for each of the abstract classes is to wrap this behavior in single call functions.

Detailed Design

The Windows BLE Communications Interface will enable communication with a BLE device by wrapping functionality within the Windows BLE library in an abstract class. This class will provide the ability to connect to and disconnect from a device. A VictorBleDevice will derive from this abstract class to define how users can read from and write to specific characteristics. These calls will be handled asynchronously to allow for the continued execution of code while the device performs the requested action and reports back the success of the read or write operation. Subscription functionality is also defined in the VictorBleDevice class to raise events when a characteristic’s value has changed, as long as the characteristic in question supports notifications. A BluetoothLEDevice object within the VictorBleDevice class is what allows for the communication with a VictoR device connected through BLE. The BluetoothLEDevice will be hidden from the user, only allowing modifications to be made to the device through the available functions within the VictorBleDevice class. A device manager will contain a dictionary of devices to allow for the management of these devices, and ensuring the user does not need to retain their own collection of devices within their application.

VictorDeviceManager

Connect

  • Given the user has completed a scan for devices

  • Add device to a hashed collection in DeviceManager

Disconnect

GetConnectedDeviceIDs

  • Return list of IDs from DeviceManager’s connected device hashed collection

ScanForDevices

Subscribe

Unsubscribe

ReadAsync

WriteAsync

ConnectionStatusChanged

System Interaction

Any requests to read and write data to and from a device will be managed through the VictorDeviceManager class. Users will not be interfacing with a Device class directly. Instead, the VictorDeviceManager will expose general read/write/subscription functionality and handle communicating with the device directly. The below example demonstrates a quick sequence diagram of how users will interface with both the Device and the VictorDeviceManager interfaces.

  • No labels