🚴
COBI.Bike
  • Introduction
  • Getting up and running
  • Namespaces
    • App
      • Theme
      • Text to Speech
      • Read Later
      • Language
      • Contact
      • Touch Interaction Enabled
      • Hub Location
      • Clock Visible
      • Is Dark
      • Is Hub Connected
    • Parameters
      • Language
      • Context
      • SDK Version
    • Hub
      • Motor Interface Ready
      • Bell Ringing
      • External Interface Action
      • Ambient Light State
    • Battery
      • State
    • Battery Two
      • State
    • Battery Controller
      • Slots
      • State
    • Motor
      • Serialnumber
      • Distance
      • Assistance Indicator
      • Range
      • Supported Drive Modes
      • Drive mode
      • Next Service
      • Power On Time
    • Mobile
      • Location
      • Heading
      • Location Availability
    • Navigation Service
      • Route
      • Eta
      • Distance To Destination
      • Status
      • Control
    • User
      • Temperature Unit
      • Length Unit
    • Bike
      • Type
    • Ride Service
      • Speed
      • User Power
      • User Power Availability
      • Heart Rate
      • Heart Rate Availability
      • Cadence
      • Cadence Availability
    • Tour Service
      • Calories
      • Ascent
      • Riding Distance
      • Riding Duration
      • Average Speed
    • Devkit
      • Override ThumbController Mapping
  • Entities
    • Theme
    • RgbColor
    • TextToSpeechContent
    • ReadLaterItem
    • ContactData
    • ExternalInterfaceAction
    • AmbientLightState
    • BatteryCondition
      • BatteryState
    • BatterySlots
    • ServiceTrigger
    • Location
    • Coordinate
    • Route
    • NavigationStatus
    • NavigationCommand
      • NavigationAction
    • TemperatureUnit
    • MeasurementUnit
    • BikeType
    • Placemark
      • PlacemarkCategory
Powered by GitBook
On this page
  1. Namespaces
  2. Hub

External Interface Action

PreviousBell RingingNextAmbient Light State

Last updated 2 years ago

When the user presses a button on the connected thumb controller.

Note that not all events will be sent to all components: For instance, the hub may directly use some actions to control the motor assistance level on e-bikes (this behavior can be turned off via devkit.overrideThumbControllerMapping).

Also, the app might choose to handle some actions directly, for instance to accept incoming calls, manage overlays or close the current module. Parts of that behavior cannot be overriden by DevKit modules (see the documentation for ExternalInterfaceAction for details).

Only when the action is not handled by another component it is sent to the active DevKit module.

const onExternalInterfaceAction = (value: ExternalInterfaceAction, timestamp?: Date) => {
    console.log(value, timestamp);
};

COBI.hub.externalInterfaceAction.subscribe(onExternalInterfaceAction);
COBI.hub.externalInterfaceAction.unsubscribe(onExternalInterfaceAction);
const onExternalInterfaceAction = (value, timestamp) => {
    console.log(value, timestamp);
};

COBI.hub.externalInterfaceAction.subscribe(onExternalInterfaceAction);
COBI.hub.externalInterfaceAction.unsubscribe(onExternalInterfaceAction);
ExternalInterfaceAction