Pebble.WatchInfo
Access information about the watch itself.
This API mirrors Pebble's C WatchInfo module and provides information such as watch model, watch color, and firmware version.
import Pebble.WatchInfo as WatchInfo
type Msg
= GotModel WatchInfo.WatchModel
| GotFirmware WatchInfo.FirmwareVersion
| GotColor WatchInfo.WatchColor
init _ =
( model
, Cmd.batch
[ WatchInfo.getModel GotModel
, WatchInfo.getFirmwareVersion GotFirmware
, WatchInfo.getColor GotColor
]
)
For a runnable example, use the watch-demo-watch-info project template in the IDE.
Native Pebble C API
- WatchInfo on developer.repebble.com
Types
WatchModel
type WatchModel
= UnknownModel
| PebbleOriginal
| PebbleSteel
| PebbleTime
| PebbleTimeSteel
| PebbleTimeRound14
| PebbleTimeRound20
| Pebble2Hr
| Pebble2Se
| PebbleTime2
| CoreDevicesP2D
| CoreDevicesPT2
| CoreDevicesPR2The model of the watch.
This corresponds to the C WatchInfoModel enum.
FirmwareVersion
type alias FirmwareVersion =
{ major : Int
, minor : Int
, patch : Int
}Firmware version of the watch.
This corresponds to the C WatchInfoVersion struct.
The version has the form X.[X.[X]]. When a version component is not present, it is reported as 0.
Examples:
- 2.4.1 is represented as { major = 2, minor = 4, patch = 1 } - 2.4 is represented as { major = 2, minor = 4, patch = 0 }
WatchColor
type WatchColor
= UnknownColor
| Black
| White
| Red
| Orange
| Gray
| StainlessSteel
| MatteBlack
| Blue
| Green
| Pink
| TimeWhite
| TimeBlack
| TimeRed
| TimeSteelSilver
| TimeSteelBlack
| TimeSteelGold
| TimeRoundSilver14
| TimeRoundBlack14
| TimeRoundSilver20
| TimeRoundBlack20
| TimeRoundRoseGold14
| Pebble2HrBlack
| Pebble2HrLime
| Pebble2HrFlame
| Pebble2HrWhite
| Pebble2HrAqua
| Pebble2SeBlack
| Pebble2SeWhite
| PebbleTime2Black
| PebbleTime2Silver
| PebbleTime2Gold
| CoreDevicesP2DBlack
| CoreDevicesP2DWhite
| CoreDevicesPT2BlackGrey
| CoreDevicesPT2BlackRed
| CoreDevicesPT2SilverBlue
| CoreDevicesPT2SilverGrey
| CoreDevicesPR2Black20
| CoreDevicesPR2Silver20
| CoreDevicesPR2Gold14
| CoreDevicesPR2Silver14The case color of the watch.
This corresponds to the C WatchInfoColor enum.
Device info
getModel
getModel : (WatchModel -> msg) -> Cmd msgRequest the model of the current watch.
Equivalent to watch_info_get_model() in the C API.
getFirmwareVersion
getFirmwareVersion : (FirmwareVersion -> msg) -> Cmd msgRequest the firmware version running on the watch.
Equivalent to watch_info_get_firmware_version() in the C API.
getColor
getColor : (WatchColor -> msg) -> Cmd msgRequest the case color of the current watch.
Equivalent to watch_info_get_color() in the C API.
Drawing
caseColor
caseColor : WatchColor -> Color.ColorClosest Pebble palette color for the watch case.
Use this for letterbox fills and other chrome that should match the body, not the face. Unknown and black cases map to Color.black.