Bluetooth RFCOMM(remote operation)

You can control of Haruzira’s network communication by using bluetooth rfcomm service. (via your program or electric circuit)

This section descriptions of the how to that you will develop your program or electric circuit.

Incidentally, You can’t available microphone for voice recognition when Haruzira has been background state.
Because, OS security will be worked for safety.

Please available in a foreground state. (I think it’s inconvenience security function.)

※You can available this function from Haruzira’s version 2.3.0 and more.

 

Functions for remote control

You can control following operations via your bluetooth device.

 Operations  Description
Start of a voice recognition

It activates the voice recognition and waiting for your voice input for sending a remote voice command.

Send of the user command It sends to some remote devices a voice command by direct. (Not use voice recognition)
Lock of the remote operation

It locks all remote operations for safety protection, in case of malicious operations by outsiders.

*By using Haruzira, it is possible to unlock.

 

 

Usage

Examples for device environment as follows.

 Device environments Explanations
 Server

Windows 10 desktop or windows 10 mobile for working Haruzira.

 Client

An electronic circuit and python program for remote operating a raspberry Pi 3.
It uses ‘PyBluez module’ for controlling bluetooth function by python program.

 

※Hereafter, it is expressed as follows.
【S】:operation for server device
【C】:operation for client device

1.You install of the PyBluez module as follows for using bluetooth module by python. and install of the GATT profile module too.

①【C】Install dependent packages of the pyBluez.

>  sudo apt-get install python-dev libbluetooth3-dev

②【C】Install pyBluez modules.

>  sudo pip3 install pybluez

③【C】Install dependent packages of the gattlib.

>  sudo apt-get install libglib2.0 libboost-python-dev libboost-thread-dev

④【C】Install the gattlib.

>  sudo pip3 install gattlib

⑤【C】Check the Raspberry Pi for status of bluetooth device.

> hciconfig

hci0:   Type: BR/EDR  Bus: UART
        BD Address: XX:XX:XX:XX:XX:XX ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING PSCAN ISCAN
        RX bytes:794 acl:0 sco:0 events:53 errors:0
        TX bytes:2586 acl:0 sco:0 commands:53 errors:0

If when the status is ‘DOWN’, you need to change to ‘UP’ status.
> sudo hciconfig hci0 up
It will be occurred error as follows in DOWN status, when you execute to scan by using the command of bluetoothctl.
Failed to start discovery: org.bluez.Error.NotReady

2.Bluetooth pairing for connecting your device.

①【S】You need to set a switch of bluetooth as follows on the setting page of bluetooth for windows 10.

 

 

 

 

 

 

②【C】Execute ‘bluetoothctl’ on the consol of raspberry pi. >  sudo bluetoothctl

③【C】Scan bluetooth devices and waiting for result of detecting. >  scan on

If when success of the detecting, it will be shown the message as follows.

[NEW] Device XX:XX:XX:XX:XX:XX device name

(XX:XX:XX:XX:XX:XX is a address of the bluetooth device)

※Don’t forget that detected address of the bluetooth device for connecting.

④【C】Execute to pairing by using the address.

>  pair xx:xx:xx:xx:xx:xx

If when success of the pairing, it will be shown the message as follows.

Attempting to pair with xx:xx:xx:xx:xx:xx
[CHG] Device xx:xx:xx:xx:xx:xx Connected: yes                                                            
[CHG] Device xx:xx:xx:xx:xx:xx Modalias: bluetooth:v0006p0001d0A00                                       
[CHG] Device xx:xx:xx:xx:xx:xx UUIDs:                                                                    
        00001000-0000-1000-8000-00805f9b34fb                                                             
        00001105-0000-1000-8000-00805f9b34fb                                                             
                             :
        232e51d8-91ff-4c24-ac0f-9ee055da30a5                                                             
        d9009112-cd2b-4e7a-a463-437d71e14905                                                             
[CHG] Device xx:xx:xx:xx:xx:xx Paired: yes                                                               
Pairing successful                                                                                       
[CHG] Device xx:xx:xx:xx:xx:xx Connected: no

⑤【S】Permit when the pairing message show on the setting page of Windows 10.

If when the pairing success, the page will be shown as follows.

 

 

 

 

 

 

⑥【C】Stop to scan on the bluetoothctrl’s console. >  scan off

⑦【C】Exit the bluetoothctrl console. >  quit

 

3.Enable the Haruzira’s bluetooth rfcomm service.

①【S】View a page of the ‘Remote Setting’ in Haruzira’s setting menu.

②【S】Enable the bluetooth available.

 

 

 

 

 

4.Add some remote devices and remote voice commands.

①【S】Add some remote devices for connecting on the manage of remote devices page.

 

 

 

 

 

②【S】Add some remote voice commands on the manage of remote voice commands page.

 

 

 

 

 

 

5.Get a ‘Channel number (port number)’ of Haruzira’s bluetooth rfcomm service.

①【S】Start a server on Haruzira’s ‘remote speech page’.

②【C】Get a Channel number by using sdptool command on the ‘Rasberry Pi”s console.

>  sdptool browse XX:XX:XX:XX:XX:XX

It output as follows when get the channel in success.

Service Name: Bluetooth Rfcomm Haruzira Service
Service Description: Bluetooth Rfcomm Haruzira Service Windows10 UWP
Service RecHandle: 0x1000f
Service Class ID List:
  UUID 128: 00001101-0000-1000-8000-00805f9b34fb
Protocol Descriptor List:
  “L2CAP” (0x0100)
  “RFCOMM” (0x0003)
    Channel: 7

※Remember the bluetooth device address and Channel number for using connect to Haruzira’s bluetooth rfcomm service.

 

Sample Programs