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