linux

package
v0.0.0-...-a5bef77 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdExec

func CmdExec(args ...string) (string, error)

CmdExec Execute a command

func Down

func Down(adapterID int) error

Down turn down an HCI device

func RestartBluetoothUnit

func RestartBluetoothUnit(fn func(err error)) (int, error)

RestartBluetoothUnit by its systemd unit

func StartBluetoothUnit

func StartBluetoothUnit(fn func(err error)) (int, error)

StartBluetoothUnit by its systemd unit

func StopBluetoothUnit

func StopBluetoothUnit(fn func(err error)) (int, error)

StopBluetoothUnit by its systemd unit

func Up

func Up(adapterID int) error

Up turn up an HCI device

Types

type BtAdapter

type BtAdapter struct {
	ID                string
	Name              string
	ShortName         string
	Addr              string
	Version           string
	Manufacturer      string
	Class             string
	SupportedSettings []string
	CurrentSettings   []string
}

BtAdapter contains info about adapter from btmgmt

func GetAdapters

func GetAdapters() ([]BtAdapter, error)

GetAdapters return a list of adapters

type BtMgmt

type BtMgmt struct {
	// contains filtered or unexported fields
}

BtMgmt an hciconfig command wrapper

func NewBtMgmt

func NewBtMgmt(adapterID string) *BtMgmt

NewBtMgmt init a new BtMgmt command

func (*BtMgmt) Reset

func (h *BtMgmt) Reset() error

Reset reset the power

func (*BtMgmt) SetAdvertising

func (h *BtMgmt) SetAdvertising(status bool) error

SetAdvertising Set LE advertising

func (*BtMgmt) SetBondable

func (h *BtMgmt) SetBondable(status bool) error

SetBondable Set bondable state

func (*BtMgmt) SetBredr

func (h *BtMgmt) SetBredr(status bool) error

SetBredr Set BR/EDR support

func (*BtMgmt) SetClass

func (h *BtMgmt) SetClass(major, minor string) error

SetClass set device class

func (*BtMgmt) SetConnectable

func (h *BtMgmt) SetConnectable(status bool) error

SetConnectable Set connectable state

func (*BtMgmt) SetDeviceID

func (h *BtMgmt) SetDeviceID(did string) error

SetDeviceID Set Device ID name

func (*BtMgmt) SetDiscoverable

func (h *BtMgmt) SetDiscoverable(status bool) error

SetDiscoverable Set discoverable state

func (*BtMgmt) SetFastConnectable

func (h *BtMgmt) SetFastConnectable(status bool) error

SetFastConnectable Set fast connectable state

func (*BtMgmt) SetHs

func (h *BtMgmt) SetHs(status bool) error

SetHs Set HS support

func (*BtMgmt) SetLe

func (h *BtMgmt) SetLe(status bool) error

SetLe Set LE support

func (*BtMgmt) SetLinkLevelSecurity

func (h *BtMgmt) SetLinkLevelSecurity(status bool) error

SetLinkLevelSecurity Set link level security

func (*BtMgmt) SetName

func (h *BtMgmt) SetName(name string) error

SetName Set local name

func (*BtMgmt) SetPairable

func (h *BtMgmt) SetPairable(status bool) error

SetPairable Set bondable state

func (*BtMgmt) SetPowered

func (h *BtMgmt) SetPowered(status bool) error

SetPowered set power to adapter

func (*BtMgmt) SetPrivacy

func (h *BtMgmt) SetPrivacy(status bool) error

SetPrivacy Set privacy support

func (*BtMgmt) SetSc

func (h *BtMgmt) SetSc(status bool) error

SetSc Toogle SC support

func (*BtMgmt) SetSsp

func (h *BtMgmt) SetSsp(status bool) error

SetSsp Set SSP mode

type HCIConfig

type HCIConfig struct {
	// contains filtered or unexported fields
}

HCIConfig an hciconfig command wrapper

func NewHCIConfig

func NewHCIConfig(adapterID string) *HCIConfig

NewHCIConfig initialize a new HCIConfig

func (*HCIConfig) Down

func (h *HCIConfig) Down() (*HCIConfigResult, error)

Down Turn down an HCI device

func (*HCIConfig) Status

func (h *HCIConfig) Status() (*HCIConfigResult, error)

Status return status information for a hci device

func (*HCIConfig) Up

func (h *HCIConfig) Up() (*HCIConfigResult, error)

Up Turn on an HCI device

type HCIConfigResult

type HCIConfigResult struct {
	Enabled bool
	Address string
	Type    string
	Bus     string
}

HCIConfigResult contains details for an adapter

type RFKill

type RFKill struct{}

RFKill is a wrapper for linux utility: rfkill Checks the status of kill switches. If either is set, the device will be disabled. Soft = Software (set by software) Hard = Hardware (physical on/off switch on the device) Identifiers = all, wifi, wlan, bluetooth, uwb, ultrawideband, wimax, wwan, gps, fm See: http://wireless.kernel.org/en/users/Documentation/rfkill

func NewRFKill

func NewRFKill() RFKill

NewRFKill Creates a new RFKill instance

func (RFKill) IsBlocked

func (rfkill RFKill) IsBlocked(identifier string) bool

IsBlocked Checks if an identifier has a software or hardware block

func (RFKill) IsBlockedAfterUnblocking

func (rfkill RFKill) IsBlockedAfterUnblocking(identifier string) bool

IsBlockedAfterUnblocking Checks if an identifier has a software or hardware block after removing a software block if it exists

func (RFKill) IsHardBlocked

func (rfkill RFKill) IsHardBlocked(identifier string) bool

IsHardBlocked Checks if an identifier has a hardware block

func (RFKill) IsInstalled

func (rfkill RFKill) IsInstalled() bool

IsInstalled Checks if the program rfkill exists using PATH environment variable

func (RFKill) IsSoftBlocked

func (rfkill RFKill) IsSoftBlocked(identifier string) bool

IsSoftBlocked Checks if an identifier has a software block

func (RFKill) ListAll

func (rfkill RFKill) ListAll() ([]RFKillResult, error)

ListAll Returns a list of rfkill results for every identifier type

func (RFKill) SoftBlock

func (rfkill RFKill) SoftBlock(identifier string) error

SoftBlock RFKill Sets a software block on an identifier

func (RFKill) SoftUnblock

func (rfkill RFKill) SoftUnblock(identifier string) error

SoftUnblock Removes a software block on an identifier

type RFKillResult

type RFKillResult struct {
	Index          int
	IdentifierType string
	Description    string
	SoftBlocked    bool
	HardBlocked    bool
}

RFKillResult Result of rfkill request

Jump to

Keyboard shortcuts

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