Available Functions
Overview
The OBH Flutter SDK provides a set of functions for integrating OBH device management into Flutter applications. It includes APIs for authentication, mount and device management, Bluetooth Low Energy (BLE) operations, firmware updates, NFC tag handling, and alarm configuration.
This documentation outlines the available functions, their parameters, and expected behavior to assist in implementation.
General
setAuthCredentials
Description: sets the authentication credentials for the SDK.
Parameters:
token: The OBH access token for API authentication.apiBaseUrl: The base URL of the OBH API (e.g.,https://api.obh-mobility.com/api/v1).
getCurrentAccount
- Description: retrieves information about the currently authenticated account.
Mount Management
getAllMounts
- Description: fetches all mounts associated with the account, supporting pagination.
getMount
Description: retrieves a specific mount by its unique identifier.
Parameters:
uid: Unique identifier of the mount.
readOwnerUid
Description: reads the owner UID from a specified mount.
Parameters:
uid: Unique identifier of the mount.
associateMount
Description: associates the mount with the currently authenticated account.
Parameters:
uid: Unique identifier of the mount.
dissociateMount
Description: dissociates the mount from the current account and removes ownership credentials from the device.
Parameters:
uid: Unique identifier of the mount.
abandonMount
Description: marks the mount as abandoned on the server. The mount remains associated locally until the next association occurs.
Parameters:
uid: Unique identifier of the mount.
Device Operations
scanObhDevices
Description: initiates a Bluetooth Low Energy (BLE) scan for OBH devices.
Parameters:
timeout: (Optional) Timeout for scanning (in milliseconds).
stopScan
- Description: stops an ongoing BLE scan for devices.
getBleEngineState
- Description: retrieves the current state of the BLE scanning engine.
getDevice
Description: fetches a device using its unique identifier.
Parameters:
uid: Unique identifier of the device.
connectDevice
Description: establishes a BLE connection with a device.
Parameters:
uid: Unique identifier of the device.address: (Optional) Device's MAC address.timeout: (Optional) Connection timeout (in milliseconds).
disconnectDevice
Description: disconnects a specific device from the SDK.
Parameters:
uid: Unique identifier of the device.
disconnectAllDevices
- Description: disconnects all currently connected devices.
unlockHelmet
Description: unlocks the helmet latch on a specific mount.
Parameters:
uid: Unique identifier of the mount.
Firmware Management
upgradeFirmware
Description: initiates a firmware upgrade on a specified mount.
Parameters:
uid: Unique identifier of the mount.softwareRevision: (Optional) Firmware version; defaults to the latest available if unspecified.
checkFirmwareUpdates
Description: checks if firmware updates are available for a specified mount.
Parameters:
uid: Unique identifier of the mount.
Real-Time State Monitoring
getDeviceStateEventStream
Description: subscribes to real-time device state changes.
Parameters:
uid: Unique identifier of the device.
getBleEngineStateEventStream
- Description: subscribes to real-time BLE engine state updates, including scan results and connection states.
Models
Mount
Represents the data fetch from the API.
| Field | Type | Description |
|---|---|---|
uid | String | Unique identifier for the mount. |
name | String | User-friendly name assigned to the mount. |
serialNumber | String | Serial number from the manufacturer to uniquely identify the device. |
macAddress | String | MAC address used for network or Bluetooth connectivity. |
firmwareRevision | String | Detailed identifier for the firmware revision. |
softwareRevision | String | Revision of the software running on the mount. |
modelNumber | String | Model number of the mount hardware, used to identify the specific model variant. |
state | AssociationState | Represents the current association state of the mount (e.g., associated, dissociated). |
mountLocked | bool | Indicates if the latch holding the helmet is locked. |
helmetMounted | bool | Indicates if a helmet is currently mounted on the device. |
batteryLevel | int | Battery level of the mount, expressed as a percentage. |
cpuTemperature | double | CPU temperature of the mount, measured in degrees Celsius. |
alarmSensitivity | AlarmSensitivity | Defines the sensitivity level for the mount's alarm system. |
alarmVolume | AlarmSound | Specifies the volume level of the mount's alarm. |
associatedAt | DateTime | ISO Date indicating when the mount was associated with your account. |
nfcTagsCount | int | Count of NFC tags registered with the mount. |
ObhDeviceEvent
Represents the data emitted by getDeviceStateEventStream
| Event | Parameters type | Description |
|---|---|---|
ConnectionStateEvent | ConnectionState | Émet le nouvel état de la connexion de l'appareil. |
FeatureStateEvent | FeatureState | Émet l'état mis à jour des fonctionnalités de l'appareil. |
HelmetStateEvent | HelmetState | Fournit l'état actuel du casque sur l'appareil. |
MountStateEvent | MountState | Indique l'état du mount associé à l'appareil. |
FirmwareStateEvent | FirmwareState | Représente l'état actuel du firmware de l'appareil. |
NfcTagStateEvent | NfcTagsState | Contient les informations sur l'état des tags NFC de l'appareil. |
AlarmStateEvent | AlarmState | Fournit l'état du système d'alarme de l'appareil. |
ConnectionState
| Field | Type | Description |
|---|---|---|
status | ConnectionStatus | Represents the current connection status of the device. Possible values: UNKNOWN, DISCONNECTED, CONNECTING, CONNECTED, DISCONNECTING. |
MountState
| Field | Type | Description |
|---|---|---|
batteryLevel | int | Represents the battery level of the mount, typically expressed as a percentage. |
cpuTemperature | double | Indicates the CPU temperature of the mount, usually measured in degrees Celsius. |
HelmetState
| Field | Type | Description |
|---|---|---|
helmetMounted | bool | Indicates if a helmet is mounted on the device. Possible values: true (helmet is mounted), false (no helmet mounted). |
helmetLocked | bool | Indicates if the helmet is locked. Possible values: true (helmet is locked), false (helmet is not locked)## FirmwareState Model |
FirmwareState
| Field | Type | Description |
|---|---|---|
upgradeProgress | double | Represents the progress of the firmware upgrade, typically expressed as a percentage (e.g., 0.0 to 100.0). |
upgradeStatus | FirmwareUpgradeStatus | Indicates the current status of the firmware upgrade process. Possible values: NONE, UNKNOWN, VALIDATE, UPLOAD, TEST, RESET, CONFIRM, RESTARTING, COMPLETE, FAILED. |
updateCheckResult | UpdateCheckResultCode | Indicates the result of the firmware update check. Possible values: UP_TO_DATE, UPDATE_AVAILABLE, MANDATORY_UPDATE. |
availableFirmwareVersion | String | Contains the available firmware version if an update is available. |