DeviceController
Keeps the DeviceManager of every device and service on this phone.
This includes the phone itself. A singleton, used by the SmartPhoneClientManager as its DeviceDataCollectorFactory. Device managers come from the SamplingPackages registered in the SamplingPackageRegistry, one per device type, and are kept in devices.
Use it to find a device manager, e.g. to connect a Bluetooth device: SmartPhoneClientManager().deviceController.getDeviceManager(type).
- Inheritance
-
- Object
- DeviceDataCollectorFactory
- DeviceController
Constructors
DeviceController
Returns the singleton DeviceController.
Constants
HEARTBEAT_PERIOD
The period of sending Heartbeat measurements, in minutes.
Properties
connectedDevices
The device managers whose device is connected now.
devices
The registered device managers, by device type.
localDataCollector
The data collector for the primary device.
smartphoneDeviceManager
The device manager of this phone (the primary device).
Throws a StateError if none is registered.
Methods
createConnectedDataCollector
- String deviceType,
- DeviceRegistration deviceRegistration
Create a ConnectedDeviceDataCollector for a connected deviceType using connection options specified in deviceRegistration.
Returns null in case the ConnectedDeviceDataCollector cannot be created.
devicesToString
The short names of all device types in devices, for logging.
disconnectAllConnectedDevices
Starts disconnecting all connectedDevices. Does not wait for them.
getDeviceManager
- String deviceType
Returns the device manager for deviceType.
If none is registered yet, it is taken from the sampling packages and registered. Returns null if no sampling package provides deviceType.
hasDevice
Whether a device manager for deviceType is registered in devices.
registerAllAvailableDevices
Registers the device managers of all packages in SamplingPackageRegistry.
registerDevice
- String deviceType,
- DeviceManager<
DeviceConfiguration< managerDeviceRegistration> , DeviceRegistration>
Registers manager for deviceType.
Does nothing if a manager is already registered for deviceType.
supportsDevice
Whether a registered SamplingPackage provides the device deviceType.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.
unregisterDevice
- String deviceType
Unregister the manager for deviceType.