Elm Pebble

Pebble.Hardware

Enhanced hardware access for Pebble watch devices.

Types

Vibration

Backlight

System Status

Audio (if supported)

Union Types

VibrationType

type VibrationType
type VibrationType
    = Short
    | Long
    | Double
    | Nudge

Types of vibration available.

BacklightLevel

type BacklightLevel
type BacklightLevel
    = Off
    | Low
    | Medium
    | High
    | Max

Backlight intensity levels.

HardwareCmd

type HardwareCmd msg
type HardwareCmd
    = Vibrate VibrationType
    | VibratePattern VibrationPattern
    | SetBacklight BacklightLevel Int
    | GetBatteryLevel (Int -> msg)
    | GetConnectionStatus (Bool -> msg)
    | PlayTone Int Int
    | StopTone

Commands for watch hardware operations.

Type Aliases

VibrationPattern

type alias VibrationPattern = List ( Int, Int )

Custom vibration patterns as a list of (duration_ms, pause_ms) pairs.

Values

vibrate

vibrate : VibrationType -> HardwareCmd msg

Trigger a simple vibration.

vibratePattern

vibratePattern : VibrationPattern -> HardwareCmd msg

Create a custom vibration pattern.

setBacklight

setBacklight : BacklightLevel -> Int -> HardwareCmd msg

Set backlight level for a specific duration.

enableBacklight

enableBacklight : HardwareCmd msg

Enable backlight at medium level for 3 seconds.

disableBacklight

disableBacklight : HardwareCmd msg

Turn off backlight immediately.

flashBacklight

flashBacklight : HardwareCmd msg

Flash backlight for attention.

getBatteryLevel

getBatteryLevel : (Int -> msg) -> HardwareCmd msg

Get current battery level (0-100).

getConnectionStatus

getConnectionStatus : (Bool -> msg) -> HardwareCmd msg

Check if connected to phone via Bluetooth.

playTone

playTone : Int -> Int -> HardwareCmd msg

Play a tone at specific frequency and duration.

stopTone

stopTone : HardwareCmd msg

Stop any currently playing tone.