Documentation
¶
Index ¶
- Constants
- type Event
- type Filter
- type RFKill
- type Switch
- func (s *Switch) Block() error
- func (s *Switch) Blocked() bool
- func (s *Switch) HardBlocked() bool
- func (s *Switch) Index() int
- func (s *Switch) Listen(fn func(e Event), d time.Duration)
- func (s *Switch) Name() string
- func (s *Switch) SoftBlocked() bool
- func (s Switch) String() string
- func (s *Switch) Type() Type
- func (s *Switch) Unblock() error
- type Type
Constants ¶
const ( // OpAdd indicates a switch has been added. OpAdd = 0 // OpDel indicates a switch has been removed. OpDel = 1 // OpChange indicate a switch has been changed. OpChange = 2 // OpChangeAll indicates all switches or all specific type switches have been changed. OpChangeAll = 3 )
The following definitions must conform to those in linux kernel.
const ( // TypeAll is the type used to specify all the switches TypeAll = 0 // TypeWLAN is the type of a 802.11 wireless switch TypeWLAN = 1 // TypeBluetooth is the type of a bluetooth switch TypeBluetooth = 2 // TypeUWB is the type of an ultra wideband switch TypeUWB = 3 // TypeWimax is the type of a WiMax switch TypeWimax = 4 // TypeWWAN is the type of a wireless WAN switch TypeWWAN = 5 // TypeGPS is the type of a GPS switch TypeGPS = 6 // TypeFM is the type of a FM radio switch TypeFM = 7 // TypeNFC is the type of a NFC switch TypeNFC = 8 // TypeUnknown is the type of an Unknown switch TypeUnknown = 9 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event is the representation of an rfkill event.
func (*Event) HardBlocked ¶
HardBlocked returns true if the device is hard blocked.
func (*Event) SoftBlocked ¶
SoftBlocked returns true if the device is soft blocked.
type Filter ¶
Filter is a function, which passes switches with specified condition.
func WithTypeName ¶
WithTypeName is a filter which passes switches with the specified type.
type RFKill ¶
type RFKill struct {
// contains filtered or unexported fields
}
RFKill is the control device of wireless switches.
type Switch ¶
type Switch struct {
Event
// contains filtered or unexported fields
}
Switch is a switch on a RF device.
func (*Switch) HardBlocked ¶
HardBlocked returns true if the device is hard blocked.
func (*Switch) Listen ¶
Listen registers the provided event handler. When events are drain, it waits for d before next poll.
func (*Switch) SoftBlocked ¶
SoftBlocked returns true if the device is soft blocked.