ESenseDeviceManager class
The DeviceManager for an ESenseDevice.
Connects to the earable, sets its sampling rate, and gives the eSense probes access to the device through manager.
Key points:
- eSense uses the
bleName(and not the BLE address) for connecting. It is typically of the formeSense-xxxx. canConnect is false untilbleNameis set. connectreturns while connecting; the status follows the device's connection events.- While connected, it reads the battery voltage every 2 minutes and emits an estimated level on batteryEvents.
- Inheritance
-
- Object
- DeviceManager<
ESenseDevice, BLEDeviceRegistration> - HardwareDeviceManager<
ESenseDevice, BLEDeviceRegistration> - BLEDeviceManager<
ESenseDevice, BLEDeviceRegistration> - ESenseDeviceManager
- Implemented types
-
- DeviceDataCollector
Constructors
- ESenseDeviceManager(String type, {ESenseDevice? configuration})
-
Creates a manager for an eSense device of the given device
type.
Properties
-
batteryEvents
→ Stream<
int> -
The battery level (0-100) of this hardware device, each time it changes.
no setteroverride
- batteryLevel → int?
-
An estimate of the battery level of the eSense device.
no setteroverride
- bleAddress ↔ String?
-
The BLE address of this device.
getter/setter pairoverride
- bleName ↔ String?
-
The BLE name of this device, if known.
getter/setter pairinherited
- canConnect → bool
-
Determines whether a connection can be made at this point in time to the device.
no setteroverride
- configuration → ESenseDevice?
-
The configuration for this device.
no setterinherited
- deviceType → String
-
The type of the device managed by this device manager, e.g.
dk.cachet.carp.common.application.devices.Smartphone.no setterinherited - displayName → String?
-
Default display name for a BLE device is its BLE name or address.
no setteroverride
-
executors
→ Set<
TaskControlExecutor> -
The task control executors whose tasks run on this device.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConfigured → bool
-
Has this device manager been configured?
no setterinherited
- isConnected → bool
-
Is this device manager connected to the real device?
no setterinherited
- isConnecting → bool
-
Is this device manager connecting or already connected to a device?
no setterinherited
- manager → ESenseManager?
-
The
esense_flutterESenseManagerthat talks to the device. Null untilbleNamehas been set.no setter -
manufacturerData
↔ List<
int> -
Manufacturer specific data. The first 2 bytes are the Company Identifier Codes.
getter/setter pairinherited
- registration → BLEDeviceRegistration?
-
The latest registration for this device.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
serviceUuids
↔ List<
String> -
Advertised services of this device, if known.
getter/setter pairinherited
- shouldConnect → bool
-
Whether to connect to the real device, based on the last registration.
no setterinherited
- status ↔ DeviceStatus
-
The runtime status of this device.
getter/setter pairinherited
-
statusEvents
→ Stream<
DeviceStatus> -
The stream of status events for this device.
no setterinherited
-
supportedDataTypes
→ Set<
DataType> -
The set of data types defining which data can be collected on this device.
no setterinherited
- typeName → String
-
The name of the
deviceTypewithout the namespace.no setterinherited
Methods
-
configure(
ESenseDevice configuration, [DeviceRegistration? registration]) → void -
Configures this device manager with its
configuration.inherited -
connect(
) → Future< DeviceStatus> -
Connects to the device and returns its new
DeviceStatus.inherited -
createRegistration(
) → BLEDeviceRegistration -
Creates a registration of this device for the deployment.
override
-
disconnect(
) → Future< bool> -
Disconnects from the device.
inherited
-
hasPermissions(
) → Future< bool> -
Whether this device manager has the permissions it needs to run.
inherited
-
isDisconnecting(
) → Future< void> -
Called when the device is lost for a while.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onConfigure(
) → void -
Callback on configure.
inherited
-
onConnect(
) → Future< DeviceStatus> -
Callback on
connect. Returns theDeviceStatusof the device.override -
onDisconnect(
) → Future< bool> -
Callback on disconnect.
override
-
onHasPermissions(
) → Future< bool> -
Callback on hasPermissions.
inherited
-
onPaired(
) → bool -
Called by
pairafter the BLE device information is set.inherited -
onRequestPermissions(
) → Future< void> -
Callback on requestPermissions.
inherited
-
pair(
{required String bleAddress, String? bleName, List< String> ? serviceUuids, List<int> ? manufacturerData}) → void -
Pairs this device manager with the BLE device at
bleAddress.inherited -
requestPermissions(
) → Future< void> -
Asks the user for the permissions this device manager needs.
Calls
onRequestPermissions.inherited -
restart(
) → void -
Restarts sampling of the measures using this device.
inherited
-
start(
) → void -
Starts sampling of all measures using this device.
inherited
-
stop(
{bool shouldBeResumed = false}) → void -
Stops sampling the measures using this device.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited