|
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ |
|
2 /* vim: set ts=2 et sw=2 tw=80: */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef mozilla_dom_bluetooth_bluetoothuuid_h__ |
|
8 #define mozilla_dom_bluetooth_bluetoothuuid_h__ |
|
9 |
|
10 #include "BluetoothCommon.h" |
|
11 |
|
12 BEGIN_BLUETOOTH_NAMESPACE |
|
13 |
|
14 class BluetoothProfileManagerBase; |
|
15 |
|
16 /* |
|
17 * Service classes and Profile Identifiers |
|
18 * |
|
19 * Supported Bluetooth services for v1 are listed as below. |
|
20 * |
|
21 * The value of each service class is defined in "AssignedNumbers/Service |
|
22 * Discovery Protocol (SDP)/Service classes and Profile Identifiers" in the |
|
23 * Bluetooth Core Specification. |
|
24 */ |
|
25 enum BluetoothServiceClass |
|
26 { |
|
27 A2DP = 0x110D, |
|
28 HANDSFREE = 0x111E, |
|
29 HANDSFREE_AG = 0x111F, |
|
30 HEADSET = 0x1108, |
|
31 HEADSET_AG = 0x1112, |
|
32 HID = 0x1124, |
|
33 OBJECT_PUSH = 0x1105, |
|
34 UNKNOWN = 0x0000 |
|
35 }; |
|
36 |
|
37 class BluetoothUuidHelper |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Get a 128-bit uuid string calculated from a 16-bit service class UUID and |
|
42 * BASE_UUID |
|
43 * |
|
44 * @param aServiceClassUuid 16-bit service class UUID |
|
45 * @param aRetUuidStr out parameter, 128-bit uuid string |
|
46 */ |
|
47 static void |
|
48 GetString(BluetoothServiceClass aServiceClassUuid, nsAString& aRetUuidStr); |
|
49 |
|
50 /** |
|
51 * Convert a 128-bit uuid string to a value of BluetoothServiceClass |
|
52 * |
|
53 * @param aUuidStr 128-bit uuid string |
|
54 * @return a value of BluetoothServiceClass |
|
55 */ |
|
56 static BluetoothServiceClass |
|
57 GetBluetoothServiceClass(const nsAString& aUuidStr); |
|
58 |
|
59 static BluetoothServiceClass |
|
60 GetBluetoothServiceClass(uint16_t aServiceUuid); |
|
61 |
|
62 static BluetoothProfileManagerBase* |
|
63 GetBluetoothProfileManager(uint16_t aServiceUuid); |
|
64 }; |
|
65 |
|
66 // TODO/qdot: Move these back into gonk and make the service handler deal with |
|
67 // it there. |
|
68 // |
|
69 // Gotten from reading the "u8" values in B2G/external/bluez/src/adapter.c |
|
70 // These were hardcoded into android |
|
71 enum BluetoothReservedChannels { |
|
72 CHANNEL_DIALUP_NETWORK = 1, |
|
73 CHANNEL_HANDSFREE_AG = 10, |
|
74 CHANNEL_HEADSET_AG = 11, |
|
75 CHANNEL_OPUSH = 12, |
|
76 CHANNEL_SIM_ACCESS = 15, |
|
77 CHANNEL_PBAP_PSE = 19, |
|
78 CHANNEL_FTP = 20, |
|
79 CHANNEL_OPUSH_L2CAP = 5255 |
|
80 }; |
|
81 |
|
82 END_BLUETOOTH_NAMESPACE |
|
83 |
|
84 #endif |