2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

bluetoothの研究 その2

Last updated at Posted at 2018-07-12

概要

bluetoothを理解したかった。

bluezとは。

Linux 2.4.6から正式採用となった。 Bluetooth プロトコルスタックです。

bluez utilsとは。

対話的に使う方法は bluetoothctl コマンドで、プログラム的には bluetoothd の提供する DBus API を使う。

廃止されたツール 代わりとなるツール
gatttool btgatt-client
hciattach btattach
hciconfig btmgmt (と bluetoothctl)
hcidump btmon (と btsnoop)
hcitool 存在しません。D-Bus Device API から利用できます。
rfcomm 存在しません。D-Bus Profile1 API で実装できます。
sdptool 存在しません。複数の D-Bus オブジェクトに機能が分散されています

dbusとは。

D-Bus は1台のコンピュータ上で動作する複数のプログラムの間で情報を交換するシステム(IPC: Inter Process Communication)です。
IPCとは、パイプ、名前付きパイプ、シグナル、共有メモリ、Unix ソケット、ループバックソケット等です。
D-Bus もリンク層は Unix ソケットで動作していますが、手順とフォーマット(プレゼンテーション層)が既定されていることが「生の」Unix ソケットとは異なります。

bluetoothctlコマンド

  • list : ローカルコントローラのリスト表示
  • show : コントローラの状態表示
  • power on : コントローラ起動
  • power off : コントローラ停止
  • scan on : デバイス検索モード
  • devices : デバイス表示
  • pair (dev) : ペアリング
  • trust (dev) : デバイスを信用する。自動接続に登録
  • paired-devices : ペアリング済デバイス表示
  • connect (dev) : 接続
  • info (dev) : デバイスの状態
  • select (ctrl) : コントローラ (ローカルの BT) 選択
  • discoverable (on/off) : on で発見可能にする
  • agent (on/off/capability) : リモートデバイスからペアリングを行う時使う。
  • default-agent : リモートデバイスからペアリングを行う時使う。
  • pairable (on/off) : ペア機能の ON/OFF
  • remove (dev) : ペアリングの削除
  • disconnect (dev) : デバイス切断
  • exit : 終了

以上。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?