Skip to content

Latest commit

 

History

History
619 lines (462 loc) · 13.7 KB

WifiControlPlugin.md

File metadata and controls

619 lines (462 loc) · 13.7 KB

Wifi Control Plugin

Version: 1.0

Status: ⚫⚫⚪

WifiControl plugin for Thunder framework.

Table of Contents

Introduction

Scope

This document describes purpose and functionality of the WifiControl plugin. It includes detailed specification about its configuration, methods and properties as well as sent notifications.

Case Sensitivity

All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.

Acronyms, Abbreviations and Terms

The table below provides and overview of acronyms used in this document and their definitions.

Acronym Description
API Application Programming Interface
HTTP Hypertext Transfer Protocol
JSON JavaScript Object Notation; a data interchange format
JSON-RPC A remote procedure call protocol encoded in JSON

The table below provides and overview of terms and abbreviations used in this document and their definitions.

Term Description
callsign The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique.

References

Ref ID Description
HTTP HTTP specification
JSON-RPC JSON-RPC 2.0 specification
JSON JSON specification
Thunder Thunder API Reference

Description

The WiFi Control plugin allows to manage various aspects of wireless connectivity.

The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].

Configuration

The table below lists configuration options of the plugin.

Name Type Description
callsign string Plugin instance name (default: WifiControl)
classname string Class name: WifiControl
locator string Library name: libWPEWifiControl.so
startmode string Determines if the plugin shall be started automatically along with the framework
configuration object (optional)
configuration?.connector string (optional) Connector name
configuration?.interface string (optional) Interface name
configuration?.application string (optional) Application name
configuration?.autoconnect string (optional) Enable autoconnect
configuration?.retryinterval string (optional) Retry interval

Interfaces

This plugin implements the following interfaces:

Methods

The following methods are provided by the WifiControl plugin:

WifiControl interface methods:

Method Description
scan Trigger Scanning
abortscan Abort Currentlt running scan
connect Connect device to requested SSID
disconnect Disconnect device from requested SSID
status Status of current device, like which SSID is connected and it is in scanning state or not

scan method

Trigger Scanning.

Parameters

This method takes no parameters.

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.scan"
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

abortscan method

Abort Currentlt running scan.

Parameters

This method takes no parameters.

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.abortscan"
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

connect method

Connect device to requested SSID.

Parameters

Name Type Description
params object
params.configssid string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.connect",
  "params": {
    "configssid": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

disconnect method

Disconnect device from requested SSID.

Parameters

Name Type Description
params object
params.configssid string

Result

Name Type Description
result null Always null

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.disconnect",
  "params": {
    "configssid": "..."
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

status method

Status of current device, like which SSID is connected and it is in scanning state or not.

Parameters

This method takes no parameters.

Result

Name Type Description
result object
result.connectedssid string
result.isscanning boolean

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.status"
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "connectedssid": "...",
    "isscanning": false
  }
}

Properties

The following properties are provided by the WifiControl plugin:

WifiControl interface properties:

Property Description
networks RO Provides available networks information
securities RO Provides security method of requested SSID
configs RO Provides configs list
config Provide config details for requested SSID

networks property

Provides access to the provides available networks information.

This property is read-only.

Value

Result

Name Type Description
result array Provides available networks information
result[#] object
result[#].ssid string
result[#].bssid integer
result[#].frequency integer
result[#].signal integer
result[#].security array
result[#].security[#] string (must be one of the following: Open, WEP, WPA, WPA2, WPS, Enterprise, WPA_WPA2, Unknown)

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.networks"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    {
      "ssid": "...",
      "bssid": 0,
      "frequency": 0,
      "signal": 0,
      "security": [
        "Open"
      ]
    }
  ]
}

securities property

Provides access to the provides security method of requested SSID.

This property is read-only.

Value

The ssid argument shall be passed as the index to the property, e.g. WifiControl.1.securities@xyz.

Result

Name Type Description
result array Provides security method of requested SSID
result[#] object
result[#].method string (must be one of the following: Open, WEP, WPA, WPA2, WPS, Enterprise, WPA_WPA2, Unknown)
result[#].keys array
result[#].keys[#] string (must be one of the following: PSK, EAP, CCMP, TKIP, Preauth, PBC, PIN, PSK_HASHED, None)

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.securities@xyz"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    {
      "method": "Open",
      "keys": [
        "PSK"
      ]
    }
  ]
}

configs property

Provides access to the provides configs list.

This property is read-only.

Value

Result

Name Type Description
result array Provides configs list
result[#] string

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.configs"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    "..."
  ]
}

config property

Provides access to the provide config details for requested SSID.

Value

Name Type Description
(property) object Provide config details for requested SSID
(property).value object
(property).value.hidden boolean
(property).value.accesspoint boolean
(property).value.ssid string
(property).value.secret string
(property).value.identity string
(property).value.method string (must be one of the following: Open, WEP, WPA, WPA2, WPS, Enterprise, WPA_WPA2, Unknown)
(property).value.key string (must be one of the following: PSK, EAP, CCMP, TKIP, Preauth, PBC, PIN, PSK_HASHED, None)

The ssid argument shall be passed as the index to the property, e.g. WifiControl.1.config@xyz.

Result

Name Type Description
result object
result.hidden boolean
result.accesspoint boolean
result.ssid string
result.secret string
result.identity string
result.method string (must be one of the following: Open, WEP, WPA, WPA2, WPS, Enterprise, WPA_WPA2, Unknown)
result.key string (must be one of the following: PSK, EAP, CCMP, TKIP, Preauth, PBC, PIN, PSK_HASHED, None)

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.config@xyz"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "hidden": false,
    "accesspoint": false,
    "ssid": "...",
    "secret": "...",
    "identity": "...",
    "method": "Open",
    "key": "PSK"
  }
}

Set Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "WifiControl.1.config@xyz",
  "params": {
    "value": {
      "hidden": false,
      "accesspoint": false,
      "ssid": "...",
      "secret": "...",
      "identity": "...",
      "method": "Open",
      "key": "PSK"
    }
  }
}

Set Response

{
    "jsonrpc": "2.0",
    "id": 42,
    "result": "null"
}

Notifications

Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.

The following events are provided by the WifiControl plugin:

WifiControl interface events:

Event Description
networkchange Notifies that Network were added, removed or modified
connectionchange Notifies that wifi connection changes

networkchange event

Notifies that Network were added, removed or modified.

Parameters

This event carries no parameters.

Example

{
  "jsonrpc": "2.0",
  "method": "client.events.1.networkchange"
}

connectionchange event

Notifies that wifi connection changes.

Parameters

Name Type Description
params object
params.ssid string

Example

{
  "jsonrpc": "2.0",
  "method": "client.events.1.connectionchange",
  "params": {
    "ssid": "..."
  }
}