Documentation ¶
Index ¶
- type ByLevel
- type MeshInfo
- type Wifi
- func (wifi *Wifi) HTTPCon(w http.ResponseWriter, r *http.Request)
- func (wifi *Wifi) HandleMessage(ctx context2.Context, cmdS string, meta map[string]string, data []byte)
- func (wifi *Wifi) JsonScan(w http.ResponseWriter, r *http.Request)
- func (wifi *Wifi) OnConnect(ssid string)
- func (wifi *Wifi) OnNetStatus(meta map[string]string, scanR *mesh.ScanResults)
- func (wifi *Wifi) ScanStatus() string
- type WifiCallbacks
- type WifiCtl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByLevel ¶
type ByLevel []*mesh.MeshDevice
type MeshInfo ¶
type MeshInfo struct { SSID string `json:"s,omitempty"` PSK string `json:"p,omitempty"` LastSeen time.Time `json:"-"` Name string `json:"N,omitempty"` }
Persisted device info.
type Wifi ¶
type Wifi struct { Mesh *local.LLDiscovery // Full database of found devices (by anyone). May be trimmed periodically // ( x hours ). Will be saved to speed up discovery. Will be sent to parent // and children. MeshInfo map[string]*MeshInfo // Current visible wifi devices, with last level (from this device perspective) MeshDevices map[string]*mesh.MeshDevice // Mesh devices visible from this device. VisibleDevices map[string]*mesh.MeshDevice // Connection to the master. Only used on non-android SendMessage *msgs.MsgConnection // Last scan results (raw). Includes known and DIRECT networks. Scan map[string]*mesh.MeshDevice ScanTime time.Time DiscoveryTime time.Time DiscoveryCnt int // True if the database needs to be saved, for fast reload. // Periodic thread will save. NeedsSave bool // contains filtered or unexported fields }
Wifi controls the Wifi interface - DMesh currently uses P2P and APs with DM- names and fixed PSK. The actual low level implementation is part of the native android app, or a separate process running as root (or net_admin CAP) and using WPA directly. Messages are used to communicate with the real wifi implementation.
func NewWifi ¶
func NewWifi(cb WifiCallbacks, u *msgs.MsgConnection, msh *local.LLDiscovery) *Wifi
Create the Wifi object, using the UDS channel for communication.
func (*Wifi) HTTPCon ¶
func (wifi *Wifi) HTTPCon(w http.ResponseWriter, r *http.Request)
Connect to strongest signal - /wifi/con
func (*Wifi) HandleMessage ¶
func (wifi *Wifi) HandleMessage(ctx context2.Context, cmdS string, meta map[string]string, data []byte)
Message from the wpa layer: /wifi/status
func (*Wifi) JsonScan ¶
func (wifi *Wifi) JsonScan(w http.ResponseWriter, r *http.Request)
Return the raw result of the last Wifi SCAN. /debug/scan
func (*Wifi) OnNetStatus ¶
func (wifi *Wifi) OnNetStatus(meta map[string]string, scanR *mesh.ScanResults)
OnNetStatus is called when the WPA or Android layer gets a Wifi update - changed list of visible Mesh nodes, or periodic update, or changed signal.
Will decide if a connection should be started or changed. This moved to native side, since it has better visibility of the mesh and can avoid discovery.
type WifiCallbacks ¶
type WifiCallbacks interface {
// Called when a network event is received that would require network refresh.
RefreshNetworks()
}