Documentation ¶
Index ¶
- Variables
- func AudioStreamVolume(name string, volume int) error
- func Brightness(level uint8) error
- func BrightnessAuto() error
- func ClipboardGet() (string, error)
- func ClipboardSet(val string) error
- func Dialog() error
- func Download(desc string, title string, url string) error
- func Fingerprint() error
- func Notification(id string, opt NotificationOpt) error
- func NotificationRemove(id string) error
- func Record(duration int, outFile string) error
- func SMSSend(numbers []string, text string) error
- func Sensor(ctx context.Context, opt SensorWatchOpt) (<-chan []byte, error)
- func SensorList() ([]string, error)
- func Share(title string, data []byte, contentType string, useDefault bool, ...) error
- func ShareFile(title string, path string, useDefault bool, actionType ShareType) error
- func StopRecord() error
- func TakePhoto(cameraID string, outfile string) error
- func Toast(text string, opts ToastOption) error
- func TorchEnable(enabled bool) error
- func UpdatedLocation(ctx context.Context, provider LocationProvider) (..., error)
- func Vibrate(ms int, force bool) error
- func WallpaperFile(path string, lockscreen bool) error
- func WallpaperURL(url string, lockscreen bool) error
- func WifiEnable(enabled bool) error
- type AudioInfoResponse
- type AudioStreamState
- type BatteryStatusResponse
- type CallLogPiece
- type CameraInfoPiece
- type ContactPiece
- type LocationProvider
- type LocationRecord
- type NotificationButton
- type NotificationListResponse
- type NotificationOpt
- type NotificationPriority
- type RecordInfo
- type SMS
- type SMSBoxType
- type SensorWatchOpt
- type ShareType
- type ToastOption
- type ToastPosition
- type WifiAP
- type WifiConnection
Constants ¶
This section is empty.
Variables ¶
var GlobalTimeout = 15 * time.Second
GlobalTimeout The global timeout to non-persistent and non-time-consuming operations
Functions ¶
func AudioStreamVolume ¶
AudioStreamVolume sets the volume of a given audio stream name
func Brightness ¶
Brightness sets the current brightness level from 0 to 255
func BrightnessAuto ¶
func BrightnessAuto() error
BrightnessAuto sets the current brightness to auto
func ClipboardGet ¶
ClipboardGet gets the current content of the clipboard
func ClipboardSet ¶
ClipboardSet sets the clipboard to the given value
func Dialog ¶
func Dialog() error
Dialog pops up a dialog on the device Not implemented yet as the original api does not work on mmy device
func Fingerprint ¶
func Fingerprint() error
Fingerprint uses the fingerprint sensor on the device for authentication Not implemented as the original API does not work on my device
func Notification ¶
func Notification(id string, opt NotificationOpt) error
Notification creates a new notification with the given id and options
func NotificationRemove ¶
NotificationRemove removes the notification with the given id
func Sensor ¶
func Sensor(ctx context.Context, opt SensorWatchOpt) (<-chan []byte, error)
Sensor starts a sensor watch in a given context and options returns raw data bytes encoded with JSON
func SensorList ¶
SensorList acquires a list of available sensors on the device
func Share ¶
func Share(title string, data []byte, contentType string, useDefault bool, actionType ShareType) error
Share shares raw data bytes with the given content type, useDefault determines whether to use the default app if available
func ShareFile ¶
ShareFile shares a file with MIME type determined by the file extension, useDefault determines whether to use the default app if available
func TakePhoto ¶
TakePhoto uses the device camera to take a photo and save the result to outfile cameraID is the id of the camera specified by the return of CameraInfo
func TorchEnable ¶
TorchEnable sets the current state of the device flashlight
func UpdatedLocation ¶
func UpdatedLocation(ctx context.Context, provider LocationProvider) (<-chan struct { Location *LocationRecord Error error }, error)
UpdatedLocation acquires the real-time location of the device from a channel
func Vibrate ¶
Vibrate creates a vibration on the device, force means whether to vibrate even if the device is set to silent mode
func WallpaperFile ¶
WallpaperFile sets the current wallpaper, main screen if lockscreen is false
func WallpaperURL ¶
WallpaperURL sets the current wallpaper, main screen if lockscreen is false
func WifiEnable ¶
WifiEnable sets the current enabled state of the device Wi-Fi
Types ¶
type AudioInfoResponse ¶
type AudioInfoResponse struct { JavaOutputSampleRate string `json:"PROPERTY_OUTPUT_SAMPLE_RATE"` JavaOutputFramesPerBuffer string `json:"PROPERTY_OUTPUT_FRAMES_PER_BUFFER"` AudioTrackOutputSampleRate int `json:"AUDIOTRACK_NATIVE_OUTPUT_SAMPLE_RATE"` BluetoothA2DP bool `json:"BLUETOOTH_A2DP_IS_ON"` WiredHeadsetConnected bool `json:"WIREDHEADSET_IS_CONNECTED"` }
AudioInfoResponse represents the current audio stream status
func AudioInfo ¶
func AudioInfo() (*AudioInfoResponse, error)
AudioInfo acquires the current audio info
func (AudioInfoResponse) String ¶ added in v0.0.2
func (a AudioInfoResponse) String() string
type AudioStreamState ¶
type AudioStreamState struct { Name string `json:"stream"` Volume int `json:"volume"` MaxVolume int `json:"max_volume"` }
AudioStreamState represents the volume info of an audio stream
func AudioStreams ¶
func AudioStreams() ([]AudioStreamState, error)
AudioStreams acquires all audio stream volume info from the device
func (AudioStreamState) String ¶ added in v0.0.2
func (a AudioStreamState) String() string
type BatteryStatusResponse ¶
type BatteryStatusResponse struct { Health string `json:"health"` Percentage int `json:"percentage"` Plugged string `json:"plugged"` Status string `json:"status"` Temperature float64 `json:"temperature"` }
BatteryStatusResponse represents the current battery status
func BatteryStatus ¶
func BatteryStatus() (*BatteryStatusResponse, error)
BatteryStatus acquires the current audio info
func (BatteryStatusResponse) String ¶ added in v0.0.2
func (b BatteryStatusResponse) String() string
type CallLogPiece ¶
type CallLogPiece struct { Name string `json:"name"` Number string `json:"phone_number"` Type string `json:"type"` Date string `json:"date"` Duration string `json:"duration"` }
CallLogPiece represents one piece of call log
func CallLog ¶
func CallLog(limit int, offset int) ([]CallLogPiece, error)
CallLog acquires call logs with a given limit and offset
func (CallLogPiece) String ¶ added in v0.0.2
func (c CallLogPiece) String() string
type CameraInfoPiece ¶
type CameraInfoPiece struct { ID string `json:"id"` Facing string `json:"facing"` JPEGOutputSizes []struct { Width int `json:"width"` Height int `json:"height"` } `json:"jpeg_output_sizes"` FocalLengths []float64 `json:"focal_lengths"` AEModes []string `json:"auto_exposure_modes"` PhysicalSize struct { Width float64 `json:"width"` Height float64 `json:"height"` } `json:"physical_size"` Capabilities []string `json:"capabilities"` }
CameraInfoPiece represent the info of one camera on the device
func CameraInfo ¶
func CameraInfo() ([]CameraInfoPiece, error)
CameraInfo gets the information of available cameras on the device
func (CameraInfoPiece) String ¶ added in v0.0.2
func (c CameraInfoPiece) String() string
type ContactPiece ¶
ContactPiece represents one contact info
func ContactList ¶
func ContactList() ([]ContactPiece, error)
ContactList gets all contact from the device
func (ContactPiece) String ¶ added in v0.0.2
func (c ContactPiece) String() string
type LocationProvider ¶
type LocationProvider string
LocationProvider enumerates the location sources provided by the device
const ( // GPS acquire location with GPS GPS LocationProvider = "gps" // Network acquire location using current network Network LocationProvider = "network" // Passive acquire location using passive methods Passive LocationProvider = "passive" )
type LocationRecord ¶
type LocationRecord struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Altitude float64 `json:"altitude"` Accuracy float64 `json:"accuracy"` Bearing float64 `json:"bearing"` Speed float64 `json:"speed"` ElapsedMS int `json:"elapsedMs"` Provider string `json:"provider"` }
LocationRecord represents a location record provided by the device
func LastLocation ¶
func LastLocation(ctx context.Context, provider LocationProvider) (*LocationRecord, error)
LastLocation acquires the last known location of the device
func Location ¶
func Location(ctx context.Context, provider LocationProvider) (*LocationRecord, error)
Location acquires the current location of the device
func (LocationRecord) String ¶ added in v0.0.2
func (l LocationRecord) String() string
type NotificationButton ¶
NotificationButton represents a button shown in the notification bar
type NotificationListResponse ¶ added in v0.0.2
type NotificationListResponse struct { ID int `json:"id"` Tag string `json:"tag"` Key string `json:"key"` Group string `json:"group"` PackageName string `json:"packageName"` Title string `json:"title"` Content string `json:"content"` When string `json:"when"` }
NotificationListResponse represents a notification
func NotificationList ¶ added in v0.0.2
func NotificationList() ([]NotificationListResponse, error)
func (NotificationListResponse) String ¶ added in v0.0.2
func (n NotificationListResponse) String() string
type NotificationOpt ¶
type NotificationOpt struct { Content string Sound bool Title string Vibrate []int32 Priority NotificationPriority LED struct { Color string On int Off int } Action string DeleteAction string Btn1 NotificationButton Btn2 NotificationButton Btn3 NotificationButton }
NotificationOpt represents the options of a notification
type NotificationPriority ¶
type NotificationPriority string
NotificationPriority enumerates the priority level of the notification
const ( // Max notification priority Max NotificationPriority = "max" // High notification priority High NotificationPriority = "high" // Default notification priority Default NotificationPriority = "default" // Low notification priority Low NotificationPriority = "low" // Min notification priority Min NotificationPriority = "min" )
type RecordInfo ¶
type RecordInfo struct { IsRecording bool `json:"isRecording"` OutputFile string `json:"outputFile"` }
RecordInfo represent the current state of recording process
func GetRecordInfo ¶
func GetRecordInfo() (RecordInfo, error)
GetRecordInfo returns the current state of the recording process
type SMS ¶
type SMS struct { ThreadID int `json:"threadid"` // ThreadID is the unique identifier of the SMS thread Type string `json:"type"` // Type is the type of the SMS box Read bool `json:"read"` // Read is the flag indicating whether the SMS has been read Number string `json:"number"` // Number is the phone number of the sender Received string `json:"received"` // Received is the time when the SMS was received Body string `json:"body"` // Body is the content of the SMS ID int `json:"_id"` // ID is the unique identifier of the SMS }
SMS represents a piece of SMS Example:
{ "threadid": 4, "type": "inbox", "read": true, "number": "+1000001", "received": "2023-08-15 10:01:40", "body": "Hello World!", "_id": 3 }
type SMSBoxType ¶
type SMSBoxType int
SMSBoxType enumerates available sms box types
const ( // All sms box type All SMSBoxType = 0 // Inbox sms box type Inbox SMSBoxType = 1 // Sent sms box type Sent SMSBoxType = 2 // Draft sms box type Draft SMSBoxType = 3 // Outbox sms box type Outbox SMSBoxType = 4 )
type SensorWatchOpt ¶
SensorWatchOpt represents the options to a Sensor call
type ShareType ¶
type ShareType = string
ShareType represent the action of the share, defaults to edit
type ToastOption ¶
type ToastOption struct { BGColor string FontColor string Position ToastPosition Short bool }
ToastOption represents the optional options to a toast
type ToastPosition ¶
type ToastPosition string
ToastPosition enumerates current position of the toast
const ( // Top lifts the toast ot the top of the screen Top ToastPosition = "top" // Middle is the default position of the toast Middle ToastPosition = "middle" // Bottom puts the toast to the bottom of the screen Bottom ToastPosition = "bottom" )
type WifiAP ¶
type WifiAP struct { BSSID string `json:"bssid"` FreqMHZ int `json:"frequency_mhz"` RSSI int `json:"rssi"` SSID string `json:"ssid"` TimeStamp int64 `json:"timestamp"` // CenterFreqMHZ not used for 20Mhz bands CenterFreqMHZ int `json:"center_frequency_mhz"` ChannelBandwidth string `json:"channel_bandwidth_mhz"` }
WifiAP represents a discovered AP in a Wi-Fi scan
type WifiConnection ¶
type WifiConnection struct { BSSID string `json:"bssid"` FreqMHZ int `json:"frequency_mhz"` IP string `json:"ip"` LinkSpeedMbps int `json:"link_speed_mbps"` MACAddr string `json:"mac_address"` NetworkID int `json:"network_id"` RSSI int `json:"rssi"` SSID string `json:"ssid"` SSIDHidden bool `json:"ssid_hidden"` SupplicantState string `json:"supplicant_state"` }
WifiConnection represents the current connection info of the device Wi-Fi interface
func WifiConnectionState ¶
func WifiConnectionState() (*WifiConnection, error)
WifiConnectionState returns the current Wi-Fi connection state of the device
func (WifiConnection) String ¶ added in v0.0.2
func (w WifiConnection) String() string
Source Files ¶
- audioInfo.go
- batteryStatus.go
- brightness.go
- callLog.go
- cameraInfo.go
- cameraPhoto.go
- clipboard.go
- contactList.go
- dialog.go
- download.go
- error.go
- exec.go
- fingerprint.go
- location.go
- microphone.go
- notification.go
- notificationList.go
- sensor.go
- share.go
- sms.go
- toast.go
- torch.go
- vibrate.go
- volume.go
- wallpaper.go
- wifi.go