Changes

no edit summary
Line 1: Line 1: −
This page contains instructions on how to use '''ubus''' commands in CLI / SSH to scan and pair '''Bluetooth''' devices on '''RUTX10/11'''.
+
==Introduction==
 +
This page contains instructions on how to use '''ubus''' commands in [[CLI]] / SSH to scan and pair '''Bluetooth''' devices on '''RUTX10/11'''.
    
----
 
----
Line 6: Line 7:     
----
 
----
Before you start using ubus commands to control Bluetooth, make sure you have enabled it. You can do that in '''Network -> Bluetooth -> General''' settings. Click '''Enable Bluetooth''' and press '''Save & Apply'''.
+
Before you start using ubus commands to control Bluetooth, make sure to enable it first. You can do that in '''Network Bluetooth General''' settings. Click '''Enable Bluetooth''' and press '''Save & Apply'''.
 
    
 
    
 
[[File:Networking_rutx_configuration_example_bluetooth_enable_v1.png]]
 
[[File:Networking_rutx_configuration_example_bluetooth_enable_v1.png]]
   −
*Now login to [[CLI]] or SSH and run '''scan.start''' command to start Bluetooth scan:
+
*Now login to [[CLI]] or SSH and initialize blesemd, run '''blesemd -D''' command:
 +
 
 +
...
 +
root@Teltonika-RUTX11:~# blesemd -D
 +
Initializing blesemd...
 +
Warning: debug messages will be shown!
 +
Preparing bluetooth interface...
 +
Reading config...
 +
Devices loaded: 0
 +
Creating database...
 +
modbus_data table already exists
 +
SENT_ID_TABLE already exists
 +
Create DB done
 +
Initializing uloop...
 +
Connecting to ubus...
 +
Initializing BLE device...
 +
Initializing BLE ubus interface...
 +
Adding ubus object...
 +
...
 +
 
 +
*Run '''scan.start''' command to start Bluetooth scan:
    
  ...
 
  ...
Line 22: Line 43:  
  ...
 
  ...
   −
The scan takes about 30 seconds. The '''"scanning": 1''' output shows us that scan still in progress. After it finishes you should see a similar output:
+
The scan process takes about 30 seconds. If you can see '''"scanning": 1''' in the output, it means, that scanning is still in progress. After it finishes you should see a similar output:
    
  ...
 
  ...
Line 31: Line 52:  
                       "name": "RT_T",  
 
                       "name": "RT_T",  
 
                       "rssi": -72,  
 
                       "rssi": -72,  
                       "address": "FF:CB:FA:6A:23:CB"  
+
                       "address": "FF:CB:FF:6F:23:FB"  
 
               }  
 
               }  
 
       ]  
 
       ]  
Line 37: Line 58:  
  ...
 
  ...
   −
The list of devices always contains '''"rssi"''' and '''"address"''', but '''"name"''' output might be missing:
+
The list of devices always contains '''"rssi"''' and '''"address"''', but '''"name"''' output might be missing if the device is not supported:
    
  ...
 
  ...
Line 45: Line 66:  
               {   
 
               {   
 
                       "rssi": -42,  
 
                       "rssi": -42,  
                       "address": "28:21:06:02:72:AD"  
+
                       "address": "2F:2A:0A:0A:7A:AA"  
 
               },
 
               },
 
               {  
 
               {  
 
                       "name": "RT_T",  
 
                       "name": "RT_T",  
 
                       "rssi": -77,  
 
                       "rssi": -77,  
                       "address": "C6:0D:52:5E:35:D7"  
+
                       "address": "CF:0A:52:5E:35:D7"  
 
               }  
 
               }  
 
       ]  
 
       ]  
Line 56: Line 77:  
  ...
 
  ...
   −
*Device pairing command:
+
*In order to pair devices use this command:
    
  ...
 
  ...
  ubus call blesem pair '{"address":"FF:CB:FA:6A:23:CB"}'
+
  ubus call blesem pair '{"address":"FF:CC:FF:6A:23:CB"}'
 
  ...
 
  ...
   −
On success pairing you should see output:
+
If the pairing process was successful you should see this output:
    
  ...
 
  ...
Line 70: Line 91:  
  ...
 
  ...
   −
On success pairing new device info will be written in '''blesem''' service config:
+
*To get the statistics from paired devices, use '''stat''' command:
 
  −
...
  −
      config device
  −
            option address "FF:CB:FA:6A:23:CB"
  −
...
  −
 
  −
*Device unpairing command:
  −
 
  −
...
  −
ubus call blesem unpair '{"address":"FF:CB:FA:6A:23:CB"}'
  −
...
  −
 
  −
*To get statistic from paired devices, use '''stat''' command:
      
  ...
 
  ...
Line 89: Line 97:  
  ...
 
  ...
   −
You should see output:
+
You should see similar output:
    
  ...
 
  ...
Line 102: Line 110:  
  }
 
  }
 
  ...
 
  ...
 
+
[[Category:Hardware application]]
----
  −
 
  −
[[Category:RUT FAQ]]
 

Navigation menu