Last updated

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.

FieldTypeDescription
uidStringUnique identifier for the mount.
nameStringUser-friendly name assigned to the mount.
serialNumberStringSerial number from the manufacturer to uniquely identify the device.
macAddressStringMAC address used for network or Bluetooth connectivity.
firmwareRevisionStringDetailed identifier for the firmware revision.
softwareRevisionStringRevision of the software running on the mount.
modelNumberStringModel number of the mount hardware, used to identify the specific model variant.
stateAssociationStateRepresents the current association state of the mount (e.g., associated, dissociated).
mountLockedboolIndicates if the latch holding the helmet is locked.
helmetMountedboolIndicates if a helmet is currently mounted on the device.
batteryLevelintBattery level of the mount, expressed as a percentage.
cpuTemperaturedoubleCPU temperature of the mount, measured in degrees Celsius.
alarmSensitivityAlarmSensitivityDefines the sensitivity level for the mount's alarm system.
alarmVolumeAlarmSoundSpecifies the volume level of the mount's alarm.
associatedAtDateTimeISO Date indicating when the mount was associated with your account.
nfcTagsCountintCount of NFC tags registered with the mount.

ObhDeviceEvent

Represents the data emitted by getDeviceStateEventStream

EventParameters typeDescription
ConnectionStateEventConnectionStateÉmet le nouvel état de la connexion de l'appareil.
FeatureStateEventFeatureStateÉmet l'état mis à jour des fonctionnalités de l'appareil.
HelmetStateEventHelmetStateFournit l'état actuel du casque sur l'appareil.
MountStateEventMountStateIndique l'état du mount associé à l'appareil.
FirmwareStateEventFirmwareStateReprésente l'état actuel du firmware de l'appareil.
NfcTagStateEventNfcTagsStateContient les informations sur l'état des tags NFC de l'appareil.
AlarmStateEventAlarmStateFournit l'état du système d'alarme de l'appareil.

ConnectionState

FieldTypeDescription
statusConnectionStatusRepresents the current connection status of the device. Possible values: UNKNOWN, DISCONNECTED, CONNECTING, CONNECTED, DISCONNECTING.

MountState

FieldTypeDescription
batteryLevelintRepresents the battery level of the mount, typically expressed as a percentage.
cpuTemperaturedoubleIndicates the CPU temperature of the mount, usually measured in degrees Celsius.

HelmetState

FieldTypeDescription
helmetMountedboolIndicates if a helmet is mounted on the device. Possible values: true (helmet is mounted), false (no helmet mounted).
helmetLockedboolIndicates if the helmet is locked. Possible values: true (helmet is locked), false (helmet is not locked)## FirmwareState Model

FirmwareState

FieldTypeDescription
upgradeProgressdoubleRepresents the progress of the firmware upgrade, typically expressed as a percentage (e.g., 0.0 to 100.0).
upgradeStatusFirmwareUpgradeStatusIndicates the current status of the firmware upgrade process. Possible values: NONE, UNKNOWN, VALIDATE, UPLOAD, TEST, RESET, CONFIRM, RESTARTING, COMPLETE, FAILED.
updateCheckResultUpdateCheckResultCodeIndicates the result of the firmware update check. Possible values: UP_TO_DATE, UPDATE_AVAILABLE, MANDATORY_UPDATE.
availableFirmwareVersionStringContains the available firmware version if an update is available.