bluetoothlist
説明
例
近くの Bluetooth Classic デバイスのスキャン
近くの Bluetooth Classic デバイスをスキャンし、その接続ステータスをチェックします。
bluetoothlist
を使用して近くにあるすべてのデバイスをリストします。デバイスが別のデバイスまたはアプリケーションに既に接続されていると、このリストには表示されない場合があります。MATLAB® で検出するには、まずデバイスを他のデバイスまたはアプリケーションから切断してください。
devlist = bluetoothlist
devlist=5×4 table
Name Address Channel Status
_____________ ______________ _______ __________________
"Pixel 3" "3C286DD533CA" 8 "Ready to connect"
"HC-06" "98D331FB3B77" 1 "Requires pairing"
"mjin-maci" "A886DDA44062" 3 "Requires pairing"
"DMTDevice" "B0B448F47A4C" Unknown "Unknown"
Name
列および Address
列は、デバイスを識別します。Channel
列は、デバイスの SPP チャンネルを示します。Status
列は、現在のデバイス接続ステータスを示します。
既定の 35 秒 (Windows) および 20 秒 (macOS) よりも短いタイムアウト値を指定することもできます。
devlist = bluetoothlist("Timeout",10)
devlist=3×4 table
Name Address Channel Status
_____________ ______________ _______ __________________
"Pixel 3" "3C286DD533CA" 8 "Ready to connect"
"mjin-maci" "A886DDA44062" 3 "Requires pairing"
出力引数
devlist
— 近くの Bluetooth デバイスのリスト
table
近くの Bluetooth デバイスのリスト。table として返されます。table には次の列があります。
Name
— デバイス名
string スカラー
デバイス名。string スカラーとして返されます。複数のデバイスで同じ名前を共有できます。
データ型: string
Address
— デバイス識別子
string スカラー
デバイスの識別子。string スカラーとして返されます。
データ型: string
Channel
— デバイス チャネル
カテゴリカル スカラー
デバイス SPP チャネル。categorical スカラーとして返されます。チャネルが不明の場合、この列の値は Unknown
になります。
データ型: categorical
Status
— デバイス接続のステータス
"Ready to connect"
| "Requires pairing"
| "Connected"
| "Unsupported"
| "Unknown"
デバイス接続のステータス。string として返されます。bluetooth
を使用して Bluetooth デバイスに接続できるのは、そのステータスが "Ready to connect"
の場合だけです。取り得る値は以下のとおりです。
値 | 説明 |
---|---|
"Ready to connect" | デバイスは SPP をサポートし、ペアリングされていますが、どこにも接続されていません。 |
"Requires pairing" | デバイスは SPP をサポートし、ペアリングされていません。 |
"Connected" | デバイスは SPP をサポートし、接続されています。 |
"Unsupported" | デバイスは SPP をサポートしていません。 |
"Unknown" | デバイスが SPP をサポートしているかどうか不明です。デバイスがオフであるか、スキャン要求に応答しません。 |
データ型: string
バージョン履歴
R2020b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)