rfkill

package module
v0.0.0-...-15d88f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2015 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
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) Blocked

func (e *Event) Blocked() bool

Blocked returns true if the device is either soft or hard blocked.

func (*Event) HardBlocked

func (e *Event) HardBlocked() bool

HardBlocked returns true if the device is hard blocked.

func (*Event) Index

func (e *Event) Index() int

Index returns the index of the device.

func (*Event) SoftBlocked

func (e *Event) SoftBlocked() bool

SoftBlocked returns true if the device is soft blocked.

func (*Event) Type

func (e *Event) Type() Type

Type returns the type of the device.

type Filter

type Filter func(s *Switch) bool

Filter is a function, which passes switches with specified condition.

func Any

func Any() Filter

Any is a filter which passes any switch.

func WithIndex

func WithIndex(i int) Filter

WithIndex is a filter which passes switches with the specified index.

func WithName

func WithName(n string) Filter

WithName is a filter which passes switches with the specified name.

func WithType

func WithType(t Type) Filter

WithType is a filter which passes switches with the specified type.

func WithTypeName

func WithTypeName(n string) Filter

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.

func Open

func Open() (*RFKill, error)

Open returns a rfkill control device.

func (*RFKill) Close

func (r *RFKill) Close()

Close closes the rfkill control device.

func (*RFKill) Listen

func (r *RFKill) Listen(fn func(e Event), d time.Duration)

Listen registers the provided event handler. When events are drain, it waits for d before next poll.

func (*RFKill) Switches

func (r *RFKill) Switches(f Filter) ([]*Switch, error)

Switches returns all switches which pass the filter.

type Switch

type Switch struct {
	Event
	// contains filtered or unexported fields
}

Switch is a switch on a RF device.

func (*Switch) Block

func (s *Switch) Block() error

Block blocks(soft) the device.

func (*Switch) Blocked

func (s *Switch) Blocked() bool

Blocked returns true if the device is either soft or hard blocked.

func (*Switch) HardBlocked

func (s *Switch) HardBlocked() bool

HardBlocked returns true if the device is hard blocked.

func (*Switch) Index

func (s *Switch) Index() int

Index returns the index of the device.

func (*Switch) Listen

func (s *Switch) Listen(fn func(e Event), d time.Duration)

Listen registers the provided event handler. When events are drain, it waits for d before next poll.

func (*Switch) Name

func (s *Switch) Name() string

Name returns the name of the device.

func (*Switch) SoftBlocked

func (s *Switch) SoftBlocked() bool

SoftBlocked returns true if the device is soft blocked.

func (Switch) String

func (s Switch) String() string

func (*Switch) Type

func (s *Switch) Type() Type

Type returns the type of the device.

func (*Switch) Unblock

func (s *Switch) Unblock() error

Unblock unblocks (soft) the device.

type Type

type Type int

Type is the type of switch where the definitions must conform to those in linux kernel

func (Type) String

func (t Type) String() string

Directories

Path Synopsis
cmd
go-rfkill command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL