回答編集履歴
2
ダンプ結果書き忘れ、追記
answer
CHANGED
@@ -28,6 +28,24 @@
|
|
28
28
|
ServiceRecordUtilities.Dump(Console.Error, record);
|
29
29
|
}
|
30
30
|
```
|
31
|
+
ダンプの例:
|
32
|
+
```text
|
33
|
+
AttrId: 0x0000 -- ServiceRecordHandle
|
34
|
+
UInt32: 0x0
|
35
|
+
|
36
|
+
AttrId: 0x0001 -- ServiceClassIdList
|
37
|
+
ElementSequence
|
38
|
+
Uuid16: 0x1000 -- ServiceDiscoveryServer
|
39
|
+
(中略)
|
40
|
+
AttrId: 0x0001 -- ServiceClassIdList
|
41
|
+
ElementSequence
|
42
|
+
Uuid16: 0x1124 -- HumanInterfaceDevice
|
43
|
+
(中略)
|
44
|
+
AttrId: 0x0001 -- ServiceClassIdList
|
45
|
+
ElementSequence
|
46
|
+
Uuid16: 0x1200 -- PnPInformation
|
47
|
+
(後略)
|
48
|
+
```
|
31
49
|
テキストでダンプしたデータのうち`AttrId: 0x0001`のレコードのUUIDがそのデバイスで対応するプロファイルのようです。
|
32
50
|
これがうまく取得できればプロファイルもOKではないでしょうか。
|
33
51
|
|
1
プロファイルインストール方法、プロファイル一覧取得方法を追記
answer
CHANGED
@@ -13,4 +13,22 @@
|
|
13
13
|
}
|
14
14
|
```
|
15
15
|
|
16
|
-
ただ、可能なのはペアリングまでで必要なサービスのインストール等は自前で実施する必要があります。
|
16
|
+
ただ、可能なのはペアリングまでで必要なサービスのインストール等は自前で実施する必要があります。
|
17
|
+
|
18
|
+
### 追記
|
19
|
+
サービスプロトコルを決め打ちで良いなら`BluetoothDeviceInfo.SetServiceState`でインストールできました。
|
20
|
+
```C#
|
21
|
+
// ペアリング後
|
22
|
+
targetDevice.SetServiceState(BluetoothService.HumanInterfaceDevice, true);
|
23
|
+
```
|
24
|
+
また、L2CapProtocolで`GetServiceRecords`を実行するとそのデバイスでインストール可能なサービスを取得できるみたいです。
|
25
|
+
```C#
|
26
|
+
var serviceinfo = targetDevice.GetServiceRecords(BluetoothService.L2CapProtocol);
|
27
|
+
foreach(var record in serviceinfo){
|
28
|
+
ServiceRecordUtilities.Dump(Console.Error, record);
|
29
|
+
}
|
30
|
+
```
|
31
|
+
テキストでダンプしたデータのうち`AttrId: 0x0001`のレコードのUUIDがそのデバイスで対応するプロファイルのようです。
|
32
|
+
これがうまく取得できればプロファイルもOKではないでしょうか。
|
33
|
+
|
34
|
+
※Logicool M557 のマウスで試しています。
|