ap

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NumOfChannels        = 13 // Number of channels in the 2.4GHz band
	NumOfChannelsCovered = 5  // Number of channels covered by a channel, including itself. For example, channel 1 covers channels 1, 2, 3, 4, 5.

	Infinite = 1000000000000 // A very large number.
)

Variables

This section is empty.

Functions

func FindBestChannel

func FindBestChannel(ifname string, chain SelectionChain) (int, error)

FindBestChannel returns the best channel to use for the given interface.

func Select

func Select(chain SelectionChain, usedChannels map[int]*Channel) map[int]int

func UsedChannels

func UsedChannels(cells []wlist.Cell) map[int]*Channel

UsedChannels returns a map of channels from a list of cells.

Types

type AccessPointNumber

type AccessPointNumber struct {
	Weight int `json:"weight"` // Weight of the criteria
}

func (AccessPointNumber) Criteria

func (c AccessPointNumber) Criteria() string

func (AccessPointNumber) Name

func (c AccessPointNumber) Name() string

func (AccessPointNumber) Select

func (c AccessPointNumber) Select(ScoredChannels map[int]int, UsedChannels map[int]*Channel) (map[int]int, error)

func (*AccessPointNumber) SetWeight

func (c *AccessPointNumber) SetWeight(weight int)

type Channel

type Channel struct {
	Number           int          // Channel number.
	SignalStrength   int          // Sum of quality of the channel, representing the overall signal usage of the channel.
	NbOfAccessPoints int          // Number of access points on the channel.
	Cells            []wlist.Cell // Cells on the channel.
	ChannelsCovered  []int        // Represents the channels that are covered by the channel.
}

Channel represents a wifi channel.

type Coverage

type Coverage struct {
	Weight int `json:"weight"` // Weight of the criteria
}

Coverage is a criteria that select the channels with the least coverage.

func (Coverage) Criteria

func (r Coverage) Criteria() string

func (Coverage) Name

func (r Coverage) Name() string

func (Coverage) Select

func (r Coverage) Select(ScoredChannels map[int]int, UsedChannels map[int]*Channel) (map[int]int, error)

func (*Coverage) SetWeight

func (r *Coverage) SetWeight(weight int)

type SelectionChain

type SelectionChain []SelectionMiddleware // A chain of selection middlewares.

type SelectionMiddleware

type SelectionMiddleware interface {
	// Select ranks the channels based on the criteria.
	Select(ScoredChannels map[int]int, UsedChannels map[int]*Channel) (map[int]int, error)
	// Criteria returns the criteria of the middleware.
	Criteria() string
	// Name returns the name of the criteria.
	Name() string
	// SetWeight sets the weight of the criteria.
	// The weight is an int between 0 and 100.
	SetWeight(int)
}

SelectionMiddleware is a middleware that selects the best channel given a criteria.

type Signal

type Signal struct {
	Weight int `json:"weight"` // Weight of the criteria
}

func (Signal) Criteria

func (s Signal) Criteria() string

func (Signal) Name

func (s Signal) Name() string

func (Signal) Select

func (s Signal) Select(ScoredChannels map[int]int, UsedChannels map[int]*Channel) (map[int]int, error)

func (*Signal) SetWeight

func (s *Signal) SetWeight(weight int)

type UnoccupiedChannel

type UnoccupiedChannel struct {
	Weight int `json:"weight"` // Weight of the criteria. This criteria shall be always 1000000000.
}

UnoccupiedChannel is a criteria that select the channel free of other channel coverage?

func (UnoccupiedChannel) Criteria

func (e UnoccupiedChannel) Criteria() string

Criteria returns the description of the criteria

func (UnoccupiedChannel) Name

func (e UnoccupiedChannel) Name() string

Name returns the name of the criteria

func (UnoccupiedChannel) Select

func (e UnoccupiedChannel) Select(ScoredChannels map[int]int, UsedChannels map[int]*Channel) (map[int]int, error)

func (*UnoccupiedChannel) SetWeight

func (e *UnoccupiedChannel) SetWeight(weight int)

SetWeight sets the weight of the criteria

Jump to

Keyboard shortcuts

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