Changes

Line 86: Line 86:  
Now that you have obtained a Session ID, you can issue commands to the router. Lets start with commands that return information about the router. For example, this is a command that returns the router's '''[[RSSI]]'''(signal strength) value:
 
Now that you have obtained a Session ID, you can issue commands to the router. Lets start with commands that return information about the router. For example, this is a command that returns the router's '''[[RSSI]]'''(signal strength) value:
   −
'''{"jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "<span style="color:red">bde01a2da4a6f4a515bb9466f90bc58a</span>", "file", "exec", { "command": "<span style="color:orange">gsmctl</span>", "params":["<span style="color:orange">-q</span>"] } ] }'''
+
  {
 +
      "jsonrpc": "2.0", "id": 1, "method": "call", "params":  
 +
      [
 +
          "<span style=color:red>bde01a2da4a6f4a515bb9466f90bc58a</span>", "file", "exec",
 +
      {
 +
          "command":"<span style=color:orange>gsmctl</span>",
 +
  "params":["<span style=color:orange>-q</span>"]
 +
      }
 +
      ]
 +
  }
 +
The section highlighted in red is your Session ID, and the sections highlighted in orange are the command and the parameter. In this example we're using a '''gsmctl -q''' SSH command that returns the router's '''[[RSSI]]''' value:
   −
The section highlighted in red is your Session ID, and the sections highlighted in orange are the command and the parameter. In this example we're using a '''gsmctl -q''' command that returns the router's '''[[RSSI]]''' value:
      +
[[Image:Configuration examples json-rpc firefox poster get gsmctl q.PNG]]
   −
[[Image:Configuration examples json-rpc firefox poster gsmctl q.PNG]]
      
The Response  '''{"jsonrpc":"2.0","id":1,"result":[0,{"code":0,"stdout":"<span style="color:green">-59</span>\n"}]}''' tells us that the router's current signal strength is <span style="color:green">-59 dBm </span>.
 
The Response  '''{"jsonrpc":"2.0","id":1,"result":[0,{"code":0,"stdout":"<span style="color:green">-59</span>\n"}]}''' tells us that the router's current signal strength is <span style="color:green">-59 dBm </span>.
Line 97: Line 106:  
You can issue almost any SSH command in a similar manner. For example, you wish to check the '''network''' config file. The SSH command to do so would be '''cat /etc/config/network''', which, translated to JSON-RPC, would be:
 
You can issue almost any SSH command in a similar manner. For example, you wish to check the '''network''' config file. The SSH command to do so would be '''cat /etc/config/network''', which, translated to JSON-RPC, would be:
   −
'''{"jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "a74c8e07646f0da2bfddce35bf3de1f3", "file", "exec", { "command": "<span style="color:orange">cat</span>", "params":["<span style="color:orange">/etc/config/network</span>"] } ] }'''
+
  {
 +
      "jsonrpc": "2.0", "id": 1, "method": "call", "params":  
 +
      [
 +
          "a74c8e07646f0da2bfddce35bf3de1f3", "file", "exec",
 +
          {
 +
              "command": "<span style="color:orange">cat</span>",
 +
              "params":
 +
              [
 +
              "<span style="color:orange">/etc/config/network</span>"
 +
              ]
 +
          }
 +
      ]
 +
  }
 +
The command and the parameter are highlighted in orange. In this case the Linux '''cat'''(short for “concatenate“) is used to view the contents of the  '''/etc/config/network''' file. The Response is:
       
[[Image:Configuration examples json-rpc firefox poster cat network.PNG]]
 
[[Image:Configuration examples json-rpc firefox poster cat network.PNG]]
  −
The command and the parameter are highlighted in orange. In this case the Linux '''cat'''(short for “concatenate“) is used to view the contents of the  '''/etc/config/network''' file.
  −
      
===Setting router parameters===
 
===Setting router parameters===

Navigation menu