14935db63e
Adds full ADB client, device manager, static DeviceInfo fetcher, and live DeviceLiveStats poller. Exposes ListDevices, ConnectDevice, DisconnectDevice, GetDeviceInfo, GetDeviceLiveStats as Wails-bound methods with a 1s devices:changed event loop. Bundles ADB binary infrastructure via //go:embed all:bin with runtime fallback chain.
66 lines
2.3 KiB
Go
66 lines
2.3 KiB
Go
package device
|
|
|
|
type ConnectionType string
|
|
|
|
const (
|
|
ConnectionUSB ConnectionType = "usb"
|
|
ConnectionWifi ConnectionType = "wifi"
|
|
)
|
|
|
|
type Status string
|
|
|
|
const (
|
|
StatusOnline Status = "online"
|
|
StatusOffline Status = "offline"
|
|
StatusUnauthorized Status = "unauthorized"
|
|
StatusRecovery Status = "recovery"
|
|
)
|
|
|
|
type Device struct {
|
|
ID string `json:"id"`
|
|
Model string `json:"model"`
|
|
Product string `json:"product"`
|
|
AndroidVersion string `json:"androidVersion"`
|
|
ABI string `json:"abi"`
|
|
ConnectionType ConnectionType `json:"connectionType"`
|
|
Status Status `json:"status"`
|
|
BatteryLevel int `json:"batteryLevel"`
|
|
Manufacturer string `json:"manufacturer"`
|
|
}
|
|
|
|
// DeviceLiveStats holds fields that change while the device is running.
|
|
// Polled separately from the static DeviceInfo.
|
|
type DeviceLiveStats struct {
|
|
AvailableRAMMB int `json:"availableRamMb"`
|
|
BatteryLevel int `json:"batteryLevel"`
|
|
BatteryStatus string `json:"batteryStatus"`
|
|
ThermalStatus string `json:"thermalStatus"`
|
|
AvailableStorageGB string `json:"availableStorageGb"`
|
|
IPAddress string `json:"ipAddress"`
|
|
}
|
|
|
|
// DeviceInfo holds extended device details fetched on demand.
|
|
type DeviceInfo struct {
|
|
ID string `json:"id"`
|
|
Manufacturer string `json:"manufacturer"`
|
|
Model string `json:"model"`
|
|
Product string `json:"product"`
|
|
AndroidVersion string `json:"androidVersion"`
|
|
SDKVersion string `json:"sdkVersion"`
|
|
SecurityPatch string `json:"securityPatch"`
|
|
BuildFingerprint string `json:"buildFingerprint"`
|
|
ABI string `json:"abi"`
|
|
SupportedABIs string `json:"supportedAbis"`
|
|
ScreenResolution string `json:"screenResolution"`
|
|
ScreenDensity string `json:"screenDensity"`
|
|
TotalRAMMB int `json:"totalRamMb"`
|
|
AvailableRAMMB int `json:"availableRamMb"`
|
|
TotalStorageGB string `json:"totalStorageGb"`
|
|
AvailableStorageGB string `json:"availableStorageGb"`
|
|
BatteryLevel int `json:"batteryLevel"`
|
|
BatteryStatus string `json:"batteryStatus"`
|
|
ThermalStatus string `json:"thermalStatus"`
|
|
IPAddress string `json:"ipAddress"`
|
|
SerialNumber string `json:"serialNumber"`
|
|
}
|