Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectivityCellularType ¶
type ConnectivityCellularType int
const ( ConnectivityCellularUnknown ConnectivityCellularType = iota ConnectivityCellularNone ConnectivityCellular2G ConnectivityCellular3G ConnectivityCellular4G ConnectivityCellular5G )
func (ConnectivityCellularType) String ¶
func (cct ConnectivityCellularType) String() string
type ConnectivityInfo ¶
type ConnectivityInfo struct { // False when the device is not connected to a network. State ConnectivityState // True when the device is connected to a metered network. Metering ConnectivityState // True when the device is connected to a bluetooth network. Bluetooth ConnectivityState // The type of the network the device is connected to: wifi/ethernet/cellular. NetType ConnectivityNetType // If the device is connected to a cellular network: // The type of the cellular network the device is connected to: 2G/3G/4G/5G. CellularType ConnectivityCellularType }
func (ConnectivityInfo) String ¶
func (ci ConnectivityInfo) String() string
type ConnectivityNetType ¶
type ConnectivityNetType int
const ( ConnectivityNetUnknown ConnectivityNetType = iota ConnectivityNetNone ConnectivityNetWifi ConnectivityNetEthernet ConnectivityNetCellular )
func (ConnectivityNetType) String ¶
func (cnt ConnectivityNetType) String() string
type ConnectivityState ¶
type ConnectivityState int
const ( ConnectivityStateUnknown ConnectivityState = iota ConnectivityStateOff ConnectivityStateOn )
func (ConnectivityState) String ¶
func (cs ConnectivityState) String() string
type EventType ¶
type EventType uint
const ( ConnectivityStateChanged EventType = 1 << iota ConnectivityMeteringChanged ConnectivityBluetoothChanged ConnectivityNetTypeChanged ConnectivityCellularTypeChanged ConnectivityChanged = 0 | ConnectivityStateChanged | ConnectivityMeteringChanged | ConnectivityBluetoothChanged | ConnectivityNetTypeChanged | ConnectivityCellularTypeChanged )
type NetManager ¶
type NetManager struct {
// contains filtered or unexported fields
}
func NewNetManager ¶
func NewNetManager(initialState ConnectivityInfo) *NetManager
func (*NetManager) GetCurrentState ¶
func (m *NetManager) GetCurrentState() (state ConnectivityInfo)
GetCurrentState return the current state of the Manager
func (*NetManager) UpdateState ¶
func (m *NetManager) UpdateState(state ConnectivityInfo)
UpdateState update the current state of the Manager
func (*NetManager) WaitForStateChange ¶
func (m *NetManager) WaitForStateChange(ctx context.Context, sourceState *ConnectivityInfo, eventType EventType) (bool, EventType)
WaitForStateChange waits until the currentState changes from sourceState or ctx expires. The eventType argument allow you to filter out the event you want to wait for. A true value is returned in former case and false in latter. The EventType is also returned to know which events has been triggered.
Click to show internal directories.
Click to hide internal directories.