Skip to end of metadata
Go to start of metadata

Versions

The Wifi API provides the ability to manage STB's wifi connection.

org.rdk.Wifi.2 - incremental update to add support for getting supported security modes

org.rdk.Wifi.1 - First version of the Wifi Thunder API

Methods

cancelWPSPairing  (v1)

Description: Cancels WPS pairing

Arguments: None

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.cancelWPSPairing", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"result":"","success":true}}

clearSSID  (v1)

Description: Clears the saved SSID

Arguments: None

Returns:

  • result: int - 0 if successful, 1 otherwise
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.clearSSID", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"result":0,"success":true}}

connect  (v1)

Description: Attempts to connect to the specified ssid with the given passphrase. Passphrase can be null when the network security is NONE. See "Security Modes" section below. When called with no arguments, attempts to connect to the saved SSID and password (see saveSSID() )

Arguments:

  • ssid: string - access point ssid
  • passphrase: string - access point password
  • securityMode: int - valid security mode value. See getSupportedSecurityModes (v2).

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.connect", "params":{"ssid":"123412341234", "passphrase": "foobar", "securityMode": 2}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"success":true}}

disconnect  (v1)

Description: Disconnects from the SSID

Arguments: None

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.disconnect", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"result":"","success":true}}

getConnectedSSID  (v1)

Description: Returns the connected SSID information

Arguments: None

Returns:

  • result object in the following format

    {
      "ssid"           : "<the name of the SSID>",
      "bssid"          : "<the Basic Service Set ID (mac address). bssid will be empty if the device is currently not connected to any Wi-Fi network>",
      "rate"           : "<the physical data rate in Mbps>",
      "noise"          : "<the average noise strength in dBm>",
      "security"       : "5",
      "signalStrength" : "<the RSSI value in dBm>",
      "frequency"      : "<the supported frequency for this ssid, measured in GHz>",
      "success"        : <operation status>
    }
Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.getConnectedSSID", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"ssid":"TP-LINK 1234","bssid":"ec:08:6b:ce:09:20","rate":"144.000000","noise":"-121.000000","security":"5","signalStrength":"-27.000000","frequency":"2.442000","success":true}

getCurrentState  (v1)

Description: Returns the current WIFI state

Arguments: None

Returns:

  • state: int - value from "Wifi State" table
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.getCurrentState", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result": {"state":2,"success":true}}

getPairedSSID  (v1)

Description: Returns the SSID this device is currently paired with

Arguments: None

Returns:

  • ssid: string - paired ssid
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.getPairedSSID", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"ssid": "123412341234","success":true}}}

getPairedSSIDInfo  (v1)

Description: Returns the SSID this device is currently paired with also including the BSSID.

Arguments: None

Returns:

  • ssid: string - paired ssid
  • bssid: string - paired bssid
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.getPairedSSIDInfo", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"ssid": "123412341234", "bssid": "ff:ff:ff:ff:ff:ff,"success":true}}

getSupportedSecurityModes (v2)

Description: Returns the Wifi security modes that the device supports.

Arguments: None

Returns:

  • security_modes - JSON objects for each supported security mode and its associated integer value.
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.2.getSupportedSecurityModes", "params":{}}

Response: {"jsonrpc":"2.0","id":3,"result":{"security_modes":{"NET_WIFI_SECURITY_NONE":0,"NET_WIFI_SECURITY_WEP_64":1,"NET_WIFI_SECURITY_WEP_128":2,"NET_WIFI_SECURITY_WPA_PSK_TKIP":3,
"NET_WIFI_SECURITY_WPA_PSK_AES":4,"NET_WIFI_SECURITY_WPA2_PSK_TKIP":5,"NET_WIFI_SECURITY_WPA2_PSK_AES":6,"NET_WIFI_SECURITY_WPA_ENTERPRISE_TKIP":7,"NET_WIFI_SECURITY_WPA_ENTERPRISE_AES":8,
"NET_WIFI_SECURITY_WPA2_ENTERPRISE_TKIP":9,"NET_WIFI_SECURITY_WPA2_ENTERPRISE_AES":10,"NET_WIFI_SECURITY_WPA3_SAE":14},"success":true}}

initiateWPSPairing  (v1)

Description: Initiates the connection via WPS

Arguments: None

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.initiateWPSPairing"}

Response: {"jsonrpc":"2.0", "id":3, "result":{"result":"","success":true}}

isPaired  (v1)

Description: Determines if the device paired to an SSID

Arguments: None

Returns:

  • result: int - 0 if this device has been previously paired (calling saveSSID marks this device as paired ), nonzero when not paired
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.isPaired", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"result":0,"success":true}}

isSignalThresholdChangeEnabled  (v1)

Description: Returns true when threshold changes are enabled

Arguments: None

Returns:

  • result: int - 0 if enabled, 1 otherwise
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.isSignalThresholdChangeEnabled", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"result":1,"success":true}}

saveSSID  (v1)

Description: Saves the ssid, passphrase and security mode for future sessions. If an SSID was previously saved, the new SSID and passphrase will overwrite the existing one.

Arguments:

  • ssid: string - access point ssid
  • passphrase: string - access point password
  • securityMode: int - valid security mode value. See getSupportedSecurityModes (v2).

Returns:

  • result: int - 0 if successful, 1 otherwise
  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.saveSSID", "params":{"ssid": "123412341234", "passphrase": "foobar", "securityMode": 2}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"result":0,"success":true}}

setEnabled  (v1)

Description: Enables / disables the wifi adapter for this device

Arguments:

  • enable: bool - true to enable

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.setEnabled", "params":{"enable": true}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"success":true}}

setSignalThresholdChangeEnabled  (v1)

Description: Enables / disables signalThresholdChange events to be fired

Arguments:

  • enabled: bool - true to enable
  • interval: int - value in ms for which the current signal strength is compared to the previous value to determine if the strength crossed a threshold value

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.setSignalThresholdChangeEnabled", "params":{"enabled": true, "interval": 2000}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"success":true}}

startScan (v1)

Description: Scans for available SSIDs. Available SSIDs will be returned in onAvailableSSIDs event.

Arguments:

  • incremental: bool - when true, SSIDs will be returned in multiple events as the SSIDs are discovered. This may allow the UI to populate faster on screen rather than waiting on the full set of results in one shot.
  • ssid: string - when not null and not empty, results will only be returned for matching ssid names. ssid may be a string literal or regular expression.
  • frequency: string - either "2.4" or "5.0". When not null and not empty, results will be returned only for ssids that have matching frequency

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.startScan", "params":{"incremental":false,"ssid":"","frequency":""}}'

Response: {"jsonrpc":"2.0", "id":3, "result":{"success":true}}

stopScan  (v1)

Description: Stops scanning for SSIDs. Any discovered SSIDs from the above method up to the point where this method is issued would still be returned.

Arguments: None

Returns:

  • success: bool - operation status


Request: {"jsonrpc":"2.0", "id":3, "method":"org.rdk.Wifi.1.stopScan", "params":{}}

Response: {"jsonrpc":"2.0", "id":3, "result":{"success":true}}

Events

onAvailableSSIDs (v1)

Description: Fired when scan is called and SSIDs are obtained. Contains the list of currently available SSIDs. If scan is called with incremental = true, moreData will be false when the last set of results are received. If incremental == false, a single event will be fired with moreData = false.

Payload:

  • ssids: array -  ssid information with the following keys for each element
    • ssid: string - ssid name
    • security: int - security mode value from "Security Modes" table
    • signalStrength: int - the RSSI value in dBm
    • frequency: float - mesured frequency in GHz
  • moreData: bool - when true, scanning is not complete and more SSIDs will be returned as separate events


{
  "jsonrpc":"2.0", 
  "method":"org.rdk.Wifi.1.onAvailableSSIDs", 
  "params": { "ssids": [
    {
      "ssid": "123412341234",
      "security": 2,
      "signalStrength": -33,
	  "frequency": 5.0
    },
    {
      "ssid": "456745674567",
      "security": 2,
      "signalStrength": -33,
	  "frequency": 5.0
    }
  ],
  "moreData": true
 } 
}

onError (v1)

Description: Fired when a recoverable, unexcpected Wifi error occurs

Payload: 

  • code: int - value from "Error Code" table


{
  "jsonrpc":"2.0", 
  "method":"org.rdk.Wifi.1.onError", 
  "params": { "code": 2 } 
}

onSSIDsChanged (v1)

Description: Fired when a new SSID becomes available or an existing SSID is no longer available

Payload: None

{
  "jsonrpc":"2.0", 
  "method":"org.rdk.Wifi.1.onSSIDsChanged", 
  "params": {} 
}

onWifiSignalThresholdChanged (v1)

Description: Fired at interval specified in setSignalThresholdChangeEnabled

Payload: 

  • signalStrength: string - signal strength in dBm
  • strength: string - a human readable indicator of strength. One of Excellent, Good, Fair, or Weak.


{
  "jsonrpc":"2.0", 
  "method":"org.rdk.Wifi.1.onWifiSignalThresholdChanged", 
  "params": {"signalStrength": -35, "strength": "Excellent"} 
}

onWIFIStateChanged (v1)

Description: Indicates that the state has changed

Payload:

  • state: int - the current wifi state value from "Wifi State" table
  • isLNF: bool - if connected to a LNF SSID


{
  "jsonrpc":"2.0", 
  "method":"org.rdk.Wifi.1.onWIFIStateChanged", 
  "params": {
    "state": 0,
    "isLNF": false
  } 
}

Constants:

Wifi State

valuedescription
0UNINSTALLED - the device was in an installed state and was uninstalled; OR the device does not have a wifi radio installed
1DISABLED - the device is installed (or was just installed) and has not yet been enabled
2DISCONNECTED - the device is installed and enabled, but not yet connected to a network
3PAIRING - the device is in the process of pairing, but not yet connected to a network
4CONNECTING - the device is attempting to connect to a network
5CONNECTED - the device is successfully connected to a network
6FAILED - the device has encountered an unrecoverable error with the wifi adapter

Error Codes

valuedescription
0SSID_CHANGED - the SSID of the network changed
1CONNECTION_LOST - the connection to the network was lost
2CONNECTION_FAILED - the connection failed for an unknown reason
3CONNECTION_INTERRUPTED - the connection was interrupted
4INVALID_CREDENTIALS - the connection failed due to invalid credentials
5NO_SSID - the SSID does not exist
6UNKNOWN - any other error
  • No labels

4 Comments

  1. Is there any example/method for registering the events like onAvailableSSIDs using jsonrpc?

    1. bharath 

      You can refer to this sample testapp to understand event notification from Thunder plugins:

      https://github.com/rdkcentral/rdkservices/blob/main/WifiManager/test/thunder-wifimanager-test.js

  2. Any error code if the disconnect function fails?

    1. If disconnect fails, success parameter will be returned false.