Documentation
¶
Overview ¶
Package cellular provides functions for testing Cellular connectivity.
Package cellular provides functions for testing Cellular connectivity.
Index ¶
- Constants
- func GetDeviceVariant(ctx context.Context) (string, error)
- func GetModemFirmwareManifestPath() string
- func GetModemFirmwarePath() string
- func GetModemHelperManifestPath() string
- func GetModemHelperPath() string
- func ParseModemFirmwareManifest(ctx context.Context) (*mfwd.FirmwareManifestV2, error)
- func ParseModemHelperManifest(ctx context.Context) (*mfwd.HelperManifest, error)
- func SetServiceProvidersExclusiveOverride(ctx context.Context, sourceFile string) (func(), error)
- type Helper
- func (h *Helper) BadPin(ctx context.Context, currentPin string) (string, error)
- func (h *Helper) BadPuk(ctx context.Context, currentPuk string) (string, error)
- func (h *Helper) CaptureDBusLogs(ctx context.Context) error
- func (h *Helper) ClearSIMLock(ctx context.Context, pin, puk string) error
- func (h *Helper) ConnectToDefault(ctx context.Context) (time.Duration, error)
- func (h *Helper) ConnectToService(ctx context.Context, service *shill.Service) error
- func (h *Helper) ConnectToServiceWithTimeout(ctx context.Context, service *shill.Service, timeout time.Duration) error
- func (h *Helper) Disable(ctx context.Context) (time.Duration, error)
- func (h *Helper) Disconnect(ctx context.Context) (time.Duration, error)
- func (h *Helper) Enable(ctx context.Context) (time.Duration, error)
- func (h *Helper) EnterIncorrectPin(ctx context.Context, currentPin string) error
- func (h *Helper) EnterIncorrectPuk(ctx context.Context, currentPuk string) error
- func (h *Helper) FindService(ctx context.Context) (*shill.Service, error)
- func (h *Helper) FindServiceForDevice(ctx context.Context) (*shill.Service, error)
- func (h *Helper) FindServiceForDeviceWithTimeout(ctx context.Context, timeout time.Duration) (*shill.Service, error)
- func (h *Helper) GetCellularLastAttachAPN(ctx context.Context) (map[string]string, error)
- func (h *Helper) GetCellularLastGoodAPN(ctx context.Context) (map[string]string, error)
- func (h *Helper) GetCellularSIMLockStatus(ctx context.Context) (map[string]interface{}, error)
- func (h *Helper) GetRetriesLeft(ctx context.Context) (int32, error)
- func (h *Helper) GetUUIDFromShill(ctx context.Context) (string, error)
- func (h *Helper) InitDeviceProperty(ctx context.Context, prop string, value interface{}) (func(ctx context.Context), error)
- func (h *Helper) InitServiceProperty(ctx context.Context, prop string, value interface{}) (func(ctx context.Context), error)
- func (h *Helper) IsSimLockEnabled(ctx context.Context) bool
- func (h *Helper) IsSimPinLocked(ctx context.Context) bool
- func (h *Helper) IsSimPukLocked(ctx context.Context) bool
- func (h *Helper) PinLockSim(ctx context.Context, newPin string) error
- func (h *Helper) PukLockSim(ctx context.Context, currentPin string) error
- func (h *Helper) ResetModem(ctx context.Context) (time.Duration, error)
- func (h *Helper) ResetShill(ctx context.Context) []error
- func (h *Helper) RestartModemManager(ctx context.Context, enableDebugLogs bool) error
- func (h *Helper) SetDeviceProperty(ctx context.Context, prop string, value interface{}, timeout time.Duration) error
- func (h *Helper) SetServiceAutoConnect(ctx context.Context, autoConnect bool) (bool, error)
- func (h *Helper) UnlockDut(ctx context.Context, currentPin, currentPuk string) error
- func (h *Helper) WaitForEnabledState(ctx context.Context, expected bool) error
Constants ¶
const AutoConnectCleanupTime = 1 * time.Second
AutoConnectCleanupTime provides enough time for a successful dbus operation. If a timeout occurs during cleanup, the operation will fail anyway.
const PropertyCleanupTime = 1 * time.Second
PropertyCleanupTime provides enough time for a successful dbus operation at the end of the test.
Variables ¶
This section is empty.
Functions ¶
func GetDeviceVariant ¶
GetDeviceVariant gets the variant of the device using cros config.
func GetModemFirmwareManifestPath ¶
func GetModemFirmwareManifestPath() string
GetModemFirmwareManifestPath Get the path of the modem firmware manifest.
func GetModemFirmwarePath ¶
func GetModemFirmwarePath() string
GetModemFirmwarePath Get the path where the modem firmware files are located.
func GetModemHelperManifestPath ¶
func GetModemHelperManifestPath() string
GetModemHelperManifestPath Get the path of the modem helper manifest.
func GetModemHelperPath ¶
func GetModemHelperPath() string
GetModemHelperPath Get the path where the modem helper files are located.
func ParseModemFirmwareManifest ¶
func ParseModemFirmwareManifest(ctx context.Context) (*mfwd.FirmwareManifestV2, error)
ParseModemFirmwareManifest Parses the modem firmware manifest and returns the FirmwareManifestV2 proto object.
func ParseModemHelperManifest ¶
func ParseModemHelperManifest(ctx context.Context) (*mfwd.HelperManifest, error)
ParseModemHelperManifest Parses the modem helper manifest and returns the HelperManifest proto object.
Types ¶
type Helper ¶
Helper fetches Cellular Device and Service properties.
func (*Helper) CaptureDBusLogs ¶
CaptureDBusLogs - Capture DBus system logs Return nil if DBus log collection succeeds, else return error.
func (*Helper) ClearSIMLock ¶
ClearSIMLock clears puk, pin lock if any of them enabled and locked.
func (*Helper) ConnectToDefault ¶
ConnectToDefault connects to the default Cellular Service.
func (*Helper) ConnectToService ¶
ConnectToService connects to a Cellular Service. It ensures that the connect attempt succeeds, repeating attempts if necessary. Otherwise an error is returned.
func (*Helper) ConnectToServiceWithTimeout ¶
func (h *Helper) ConnectToServiceWithTimeout(ctx context.Context, service *shill.Service, timeout time.Duration) error
ConnectToServiceWithTimeout connects to a Cellular Service with a specified timeout. It ensures that the connect attempt succeeds, repeating attempts if necessary. Otherwise an error is returned.
func (*Helper) Disable ¶
Disable calls Manager.DisableTechnology(cellular) and returns true if the disable succeeded, or an error otherwise.
func (*Helper) Disconnect ¶
Disconnect from the Cellular Service and ensure that the disconnect succeeded, otherwise return an error.
func (*Helper) Enable ¶
Enable calls Manager.EnableTechnology(cellular) and returns true if the enable succeeded, or an error otherwise.
func (*Helper) EnterIncorrectPin ¶
EnterIncorrectPin gets incorrect pin and tries to unlock.
func (*Helper) EnterIncorrectPuk ¶
EnterIncorrectPuk generates bad puk and tries to unlock.
func (*Helper) FindService ¶
FindService returns the first connectable Cellular Service. If no such Cellular Service is available, returns a nil service and an error.
func (*Helper) FindServiceForDevice ¶
FindServiceForDevice returns the first connectable Cellular Service matching the Device ICCID. If no such Cellular Service is available, returns a nil service and an error. The default timeout is used for waiting for the service to appear.
func (*Helper) FindServiceForDeviceWithTimeout ¶
func (h *Helper) FindServiceForDeviceWithTimeout(ctx context.Context, timeout time.Duration) (*shill.Service, error)
FindServiceForDeviceWithTimeout returns the first connectable Cellular Service matching the Device ICCID. If no such Cellular Service is available, returns a nil service and an error. |timeout| specifies how long to wait for a service to appear.
func (*Helper) GetCellularLastAttachAPN ¶
GetCellularLastAttachAPN gets Cellular.LastAttachAPN dictionary from shill properties.
func (*Helper) GetCellularLastGoodAPN ¶
GetCellularLastGoodAPN gets Cellular.LastAttachAPN dictionary from shill properties.
func (*Helper) GetCellularSIMLockStatus ¶
GetCellularSIMLockStatus dict gets Cellular.SIMLockStatus dictionary from shill properties.
func (*Helper) GetRetriesLeft ¶
GetRetriesLeft helps to get modem property UnlockRetries value.
func (*Helper) GetUUIDFromShill ¶
GetUUIDFromShill gets the current carrier's UUID from shill.
func (*Helper) InitDeviceProperty ¶
func (h *Helper) InitDeviceProperty(ctx context.Context, prop string, value interface{}) (func(ctx context.Context), error)
InitDeviceProperty sets a device property and returns a function to restore the initial value.
func (*Helper) InitServiceProperty ¶
func (h *Helper) InitServiceProperty(ctx context.Context, prop string, value interface{}) (func(ctx context.Context), error)
InitServiceProperty sets a service property and returns a function to restore the initial value.
func (*Helper) IsSimLockEnabled ¶
IsSimLockEnabled returns lockenabled value.
func (*Helper) IsSimPinLocked ¶
IsSimPinLocked returns true if locktype value is 'sim-pin' locktype value is 'sim-pin2' for QC and 'none' when not locked.
func (*Helper) IsSimPukLocked ¶
IsSimPukLocked returns true if locktype value is 'sim-puk' locktype value is 'sim-pin2' for QC and value 'none' when not locked.
func (*Helper) PinLockSim ¶
PinLockSim is a helper method to pin-lock a sim, assuming nothing bad happens.
func (*Helper) PukLockSim ¶
PukLockSim is a helper method to puk-lock a SIM, assuming nothing bad happens.
func (*Helper) ResetModem ¶
ResetModem calls Device.ResetModem(cellular) and returns true if the reset succeeded, or an error otherwise.
func (*Helper) ResetShill ¶
ResetShill restarts shill and clears all profiles.
func (*Helper) RestartModemManager ¶
RestartModemManager - restart modemmanager with debug logs enabled/disabled. Return nil if restart succeeds, else return error.
func (*Helper) SetDeviceProperty ¶
func (h *Helper) SetDeviceProperty(ctx context.Context, prop string, value interface{}, timeout time.Duration) error
SetDeviceProperty sets a Device property and waits for the property to be set.
func (*Helper) SetServiceAutoConnect ¶
SetServiceAutoConnect sets the AutoConnect property of the Cellular Service associated with the Cellular Device to |autoConnect| if the current value does not match |autoConnect|. Returns true when Service.AutoConnect is set and the operation succeeds. Returns an error if any operation fails.