Add NmActiveConnectionState
This commit is contained in:
parent
7e14f55cb3
commit
94be8f57f6
3 changed files with 41 additions and 3 deletions
|
@ -46,7 +46,7 @@ type ActiveConnection interface {
|
||||||
GetDevices() []Device
|
GetDevices() []Device
|
||||||
|
|
||||||
// GetState gets the state of the connection.
|
// GetState gets the state of the connection.
|
||||||
GetState() uint32
|
GetState() NmActiveConnectionState
|
||||||
|
|
||||||
// GetStateFlags gets the state flags of the connection.
|
// GetStateFlags gets the state flags of the connection.
|
||||||
GetStateFlags() uint32
|
GetStateFlags() uint32
|
||||||
|
@ -119,8 +119,8 @@ func (a *activeConnection) GetDevices() []Device {
|
||||||
return devices
|
return devices
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *activeConnection) GetState() uint32 {
|
func (a *activeConnection) GetState() NmActiveConnectionState {
|
||||||
return a.getUint32Property(ActiveConnectionPropertyState)
|
return NmActiveConnectionState(a.getUint32Property(ActiveConnectionPropertyState))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *activeConnection) GetStateFlags() uint32 {
|
func (a *activeConnection) GetStateFlags() uint32 {
|
||||||
|
|
11
enums.go
11
enums.go
|
@ -44,6 +44,17 @@ const (
|
||||||
NmDeviceStateFailed NmDeviceState = 120
|
NmDeviceStateFailed NmDeviceState = 120
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:generate stringer -type=NmActiveConnectionState
|
||||||
|
type NmActiveConnectionState uint32
|
||||||
|
|
||||||
|
const (
|
||||||
|
NmActiveConnectionStateUnknown NmActiveConnectionState = 0 // The state of the connection is unknown
|
||||||
|
NmActiveConnectionStateActivating NmActiveConnectionState = 1 // A network connection is being prepared
|
||||||
|
NmActiveConnectionStateActivated NmActiveConnectionState = 2 // There is a connection to the network
|
||||||
|
NmActiveConnectionStateDeactivating NmActiveConnectionState = 3 // The network connection is being torn down and cleaned up
|
||||||
|
NmActiveConnectionStateDeactivated NmActiveConnectionState = 4 // The network connection is disconnected and will be removed
|
||||||
|
)
|
||||||
|
|
||||||
//go:generate stringer -type=NmDeviceType
|
//go:generate stringer -type=NmDeviceType
|
||||||
type NmDeviceType uint32
|
type NmDeviceType uint32
|
||||||
|
|
||||||
|
|
27
nmactiveconnectionstate_string.go
Normal file
27
nmactiveconnectionstate_string.go
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Code generated by "stringer -type=NmActiveConnectionState"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package gonetworkmanager
|
||||||
|
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
|
func _() {
|
||||||
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||||
|
// Re-run the stringer command to generate them again.
|
||||||
|
var x [1]struct{}
|
||||||
|
_ = x[NmActiveConnectionStateUnknown-0]
|
||||||
|
_ = x[NmActiveConnectionStateActivating-1]
|
||||||
|
_ = x[NmActiveConnectionStateActivated-2]
|
||||||
|
_ = x[NmActiveConnectionStateDeactivating-3]
|
||||||
|
_ = x[NmActiveConnectionStateDeactivated-4]
|
||||||
|
}
|
||||||
|
|
||||||
|
const _NmActiveConnectionState_name = "NmActiveConnectionStateUnknownNmActiveConnectionStateActivatingNmActiveConnectionStateActivatedNmActiveConnectionStateDeactivatingNmActiveConnectionStateDeactivated"
|
||||||
|
|
||||||
|
var _NmActiveConnectionState_index = [...]uint8{0, 30, 63, 95, 130, 164}
|
||||||
|
|
||||||
|
func (i NmActiveConnectionState) String() string {
|
||||||
|
if i >= NmActiveConnectionState(len(_NmActiveConnectionState_index)-1) {
|
||||||
|
return "NmActiveConnectionState(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||||
|
}
|
||||||
|
return _NmActiveConnectionState_name[_NmActiveConnectionState_index[i]:_NmActiveConnectionState_index[i+1]]
|
||||||
|
}
|
Reference in a new issue