Users Guide
Bluetooth SPP(Serial Port Profile)
각 BT 어댑터의 MAC 주소에 대한 가정:
● BT MAC(MYCLIENT): XX:XX:XX:XX:XX:XX
● BT MAC(MYSERVER): YY:YY:YY:YY:YY:YY
1. 사전 요구 사항입니다.
# sudo apt-get install bluez bluez-tools
2. MYSERVER 및 MYCLIENT의 페어링을 준비합니다.
# sudo bluetoothctl
[bluetoothctl]# power on
[bluetooth]# discoverable on
[bluetooth]# scan on
[NEW] Device XX:XX:XX:XX:XX:XX MYCLIENT
[bluetooth]# scan off
3. 서로 페어링합니다.
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# pairable on
[bluetooth]# pair XX:XX:XX:XX:XX:XX <MAC Address of Device to Pair>
[bluetooth]# connect XX:XX:XX:XX:XX:XX [CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
[bluetooth]# exit
Bluetooth V2.1부터 SPP는 Edge Gateway에 적용 가능한 세 가지 디바이스 페어링 방법을 제공합니다.
● Just Works(바로 작동)
● Numeric Comparison(숫자 비교)
● Passkey Entry(패스키 입력)
노트: Bluetooth 페어링에 대한 자세한 내용은 blog.bluetooth.com/bluetooth-pairing-part-4를 참조하십시오.
4. SPP를 구성합니다.
서버 디바이스
# bluez.sdptool add --channel=22 SP
# ./rfcomm -r listen /dev/rfcomm0 22
Waiting for connection on channel 22
Connection from XX:XX:XX:XX:XX:XX to /dev/rfcomm0 <These lines will be seen when client
comes>
Press CTRL-C for hangup
그런 다음, 터미널의 새 인스턴스를 생성하여 Bluetooth 직렬을 통해 데이터를 차단합니다.
$ cat /dev/rfcomm0
클라이언트 디바이스
# bluez.sdptool add --channel=22 SP
# ./rfcomm -r connect /dev/rfcomm0 YY:YY:YY:YY:YY:YY 22
그런 다음, 터미널의 새 인스턴스(예: ssh의 새 인스턴스)를 생성하여 데이터를 보냅니다.
# echo "test" > /dev/rfcomm0
노트: rfcomm 명령은 이 명령에서 사용할 수 없습니다. 필요한 경우, Ubuntu 16.04 이상을 실행하는 AMD64 기반 시스템에서
Edge Gateway에 바이너리를 복사할 수 있습니다.
운영 체제 설정 83