Documentation ¶
Index ¶
- Constants
- Variables
- func Exit() error
- func Init(adapterID string)
- func LoadResources(file *os.File, fs *blefs.FS) (<-chan ResourceLoadProgress, error)
- type Agent
- func (*Agent) AuthorizeService(device dbus.ObjectPath, uuid string) *dbus.Error
- func (*Agent) Cancel() *dbus.Error
- func (*Agent) DisplayPasskey(device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Error
- func (*Agent) DisplayPinCode(device dbus.ObjectPath, pincode string) *dbus.Error
- func (*Agent) Interface() string
- func (*Agent) Path() dbus.ObjectPath
- func (*Agent) Release() *dbus.Error
- func (*Agent) RequestAuthorization(device dbus.ObjectPath) *dbus.Error
- func (*Agent) RequestConfirmation(device dbus.ObjectPath, passkey uint32) *dbus.Error
- func (a *Agent) RequestPasskey(device dbus.ObjectPath) (uint32, *dbus.Error)
- func (*Agent) RequestPinCode(device dbus.ObjectPath) (pincode string, err *dbus.Error)
- type DFU
- type DFUProgress
- type Device
- func (i *Device) AddWeatherEvent(event interface{}) error
- func (i *Device) Address() string
- func (i *Device) BatteryLevel() (uint8, error)
- func (i *Device) FS() (*blefs.FS, error)
- func (i *Device) HeartRate() (uint8, error)
- func (i *Device) Motion() (MotionValues, error)
- func (i *Device) Notify(title, body string) error
- func (i *Device) NotifyCall(from string) (<-chan uint8, error)
- func (i *Device) SetTime(t time.Time) error
- func (i *Device) StepCount() (uint32, error)
- func (i *Device) Version() (string, error)
- func (i *Device) WatchBatteryLevel(ctx context.Context) (<-chan uint8, error)
- func (i *Device) WatchHeartRate(ctx context.Context) (<-chan uint8, error)
- func (i *Device) WatchMotion(ctx context.Context) (<-chan MotionValues, error)
- func (i *Device) WatchStepCount(ctx context.Context) (<-chan uint32, error)
- type ErrCharNotAvail
- type MotionValues
- type MusicCtrl
- type MusicEvent
- type NavFlag
- type NavigationService
- type ObsoleteResource
- type Options
- type Resource
- type ResourceLoadProgress
- type ResourceManifest
- type ResourceOperation
Constants ¶
const ( DFUCtrlPointChar = "00001531-1212-efde-1523-785feabcd123" // UUID of Control Point characteristic DFUPacketChar = "00001532-1212-efde-1523-785feabcd123" // UUID of Packet characteristic )
const ( DFUSegmentSize = 20 // Size of each firmware packet DFUPktRecvInterval = 10 // Amount of packets to send before checking for receipt )
const ( NewAlertChar = "00002a46-0000-1000-8000-00805f9b34fb" NotifEventChar = "00020001-78fc-48fe-8e23-433b3a1942d0" StepCountChar = "00030001-78fc-48fe-8e23-433b3a1942d0" MotionValChar = "00030002-78fc-48fe-8e23-433b3a1942d0" FirmwareVerChar = "00002a26-0000-1000-8000-00805f9b34fb" CurrentTimeChar = "00002a2b-0000-1000-8000-00805f9b34fb" LocalTimeChar = "00002a0f-0000-1000-8000-00805f9b34fb" BatteryLvlChar = "00002a19-0000-1000-8000-00805f9b34fb" HeartRateChar = "00002a37-0000-1000-8000-00805f9b34fb" FSTransferChar = "adaf0200-4669-6c65-5472-616e73666572" FSVersionChar = "adaf0100-4669-6c65-5472-616e73666572" WeatherDataChar = "00040001-78fc-48fe-8e23-433b3a1942d0" )
const ( CallStatusDeclined uint8 = iota CallStatusAccepted CallStatusMuted )
These constants represent the possible call statuses selected by the user
const ( MusicEventChar = "00000001-78fc-48fe-8e23-433b3a1942d0" MusicStatusChar = "00000002-78fc-48fe-8e23-433b3a1942d0" MusicArtistChar = "00000003-78fc-48fe-8e23-433b3a1942d0" MusicTrackChar = "00000004-78fc-48fe-8e23-433b3a1942d0" MusicAlbumChar = "00000005-78fc-48fe-8e23-433b3a1942d0" )
const ()
const ( // ResourceOperationUpload represents the upload phase // of resource loading ResourceOperationUpload = iota // ResourceOperationRemoveObsolete represents the obsolete // file removal phase of resource loading ResourceOperationRemoveObsolete )
const BTName = "InfiniTime"
Variables ¶
var ( DFUCmdStart = []byte{0x01, 0x04} DFUCmdRecvInitPkt = []byte{0x02, 0x00} DFUCmdInitPktComplete = []byte{0x02, 0x01} DFUCmdPktReceiptInterval = []byte{0x08, 0x0A} DFUCmdRecvFirmware = []byte{0x03} DFUCmdValidate = []byte{0x04} DFUCmdActivateReset = []byte{0x05} )
var ( DFUResponseStart = []byte{0x10, 0x01, 0x01} DFUResponseInitParams = []byte{0x10, 0x02, 0x01} DFUResponseRecvFwImgSuccess = []byte{0x10, 0x03, 0x01} DFUResponseValidate = []byte{0x10, 0x04, 0x01} )
var ( ErrDFUInvalidInput = errors.New("input file invalid, must be a .bin file") ErrDFUTimeout = errors.New("timed out waiting for response") ErrDFUNoFilesLoaded = errors.New("no files are loaded") ErrDFUInvalidResponse = errors.New("invalid response returned") ErrDFUSizeMismatch = errors.New("amount of bytes sent does not match amount received") )
var ( ErrNoDevices = errors.New("no InfiniTime devices found") ErrNotFound = errors.New("could not find any advertising InfiniTime devices") ErrNotConnected = errors.New("not connected") ErrNoTimelineHeader = errors.New("events must contain the timeline header") ErrPairTimeout = errors.New("reached timeout while pairing") )
var DFUNotifPktRecvd = []byte{0x11}
Functions ¶
func LoadResources ¶
LoadResources accepts a resources zip file and a BLE FS. It loads the resources from the zip onto the FS.
Types ¶
type Agent ¶
Agent implements the agent.Agent1Client interface. It only requires RequestPasskey as that is all InfiniTime will use.
func (*Agent) AuthorizeService ¶
AuthorizeService returns nil
func (*Agent) DisplayPasskey ¶
DisplayPasskey returns nil
func (*Agent) DisplayPinCode ¶
DisplayPinCode returns nil
func (*Agent) Path ¶
func (*Agent) Path() dbus.ObjectPath
Path returns "/dev/arsenm/infinitime/Agent"
func (*Agent) RequestAuthorization ¶
func (*Agent) RequestAuthorization(device dbus.ObjectPath) *dbus.Error
RequestAuthorization returns nil
func (*Agent) RequestConfirmation ¶
RequestConfirmation returns nil
func (*Agent) RequestPasskey ¶
RequestPasskey runs Agent.ReqPasskey and returns the result
func (*Agent) RequestPinCode ¶
RequestPinCode returns an empty string and nil
type DFU ¶
type DFU struct {
// contains filtered or unexported fields
}
DFU stores everything required for doing firmware upgrades
func (*DFU) LoadArchive ¶
LoadArchive loads an init packet and firmware image from a zip archive using a maifest.json also stored in the archive.
func (*DFU) Progress ¶
func (dfu *DFU) Progress() <-chan DFUProgress
type DFUProgress ¶
type Device ¶
func Connect ¶
Connect will attempt to connect to a paired InfiniTime device. If none are paired, it will attempt to discover and pair one.
It will also attempt to reconnect to the device if it disconnects and that is enabled in the options.
func (*Device) AddWeatherEvent ¶
AddWeatherEvent adds one of the event structs from the weather package to the timeline. Input must be a struct containing TimelineHeader.
func (*Device) BatteryLevel ¶
BatteryLevel gets the watch's battery level via the Battery Service
func (*Device) Motion ¶
func (i *Device) Motion() (MotionValues, error)
func (*Device) Notify ¶
Notify sends a notification to InfiniTime via the Alert Notification Service (ANS)
func (*Device) NotifyCall ¶
NotifyCall sends a call notification to the PineTime and returns a channel. This channel will contain the user's response to the call notification.
func (*Device) SetTime ¶
SetTime sets the watch's * time using the Current Time Service's current time characteristic * timezone information using the CTS's local time characteristic
func (*Device) WatchBatteryLevel ¶
func (*Device) WatchHeartRate ¶
func (*Device) WatchMotion ¶
func (i *Device) WatchMotion(ctx context.Context) (<-chan MotionValues, error)
type ErrCharNotAvail ¶
type ErrCharNotAvail struct {
// contains filtered or unexported fields
}
func (ErrCharNotAvail) Error ¶
func (e ErrCharNotAvail) Error() string
type MotionValues ¶
type MusicCtrl ¶
type MusicCtrl struct {
// contains filtered or unexported fields
}
MusicCtrl stores everything required to control music
func (MusicCtrl) WatchEvents ¶
func (mc MusicCtrl) WatchEvents() (<-chan MusicEvent, error)
WatchEvents watches music events from InfiniTime
type MusicEvent ¶
type MusicEvent uint8
const ( MusicEventOpen MusicEvent = 0xe0 MusicEventPlay MusicEvent = 0x00 MusicEventPause MusicEvent = 0x01 MusicEventNext MusicEvent = 0x03 MusicEventPrev MusicEvent = 0x04 MusicEventVolUp MusicEvent = 0x05 MusicEventVolDown MusicEvent = 0x06 )
type NavigationService ¶
type NavigationService struct {
// contains filtered or unexported fields
}
func (*NavigationService) SetFlag ¶
func (n *NavigationService) SetFlag(flag NavFlag) error
func (*NavigationService) SetManDist ¶
func (n *NavigationService) SetManDist(manDist string) error
func (*NavigationService) SetNarrative ¶
func (n *NavigationService) SetNarrative(narrative string) error
func (*NavigationService) SetProgress ¶
func (n *NavigationService) SetProgress(progress uint8) error
type ObsoleteResource ¶
ObsoleteResource represents an obsolete file entry in the manifest
type ResourceLoadProgress ¶
type ResourceLoadProgress struct { Operation ResourceOperation Name string Total int64 Sent int64 Err error }
ResourceLoadProgress contains information on the progress of a resource load
type ResourceManifest ¶
type ResourceManifest struct { Resources []Resource `json:"resources"` Obsolete []ObsoleteResource `json:"obsolete_files"` }
ResourceManifest is the structure of the resource manifest file
type ResourceOperation ¶
type ResourceOperation uint8
ResourceOperation represents an operation performed during resource loading