michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_bluetooth_bluetoothuuid_h__ michael@0: #define mozilla_dom_bluetooth_bluetoothuuid_h__ michael@0: michael@0: #include "BluetoothCommon.h" michael@0: michael@0: BEGIN_BLUETOOTH_NAMESPACE michael@0: michael@0: class BluetoothProfileManagerBase; michael@0: michael@0: /* michael@0: * Service classes and Profile Identifiers michael@0: * michael@0: * Supported Bluetooth services for v1 are listed as below. michael@0: * michael@0: * The value of each service class is defined in "AssignedNumbers/Service michael@0: * Discovery Protocol (SDP)/Service classes and Profile Identifiers" in the michael@0: * Bluetooth Core Specification. michael@0: */ michael@0: enum BluetoothServiceClass michael@0: { michael@0: A2DP = 0x110D, michael@0: HANDSFREE = 0x111E, michael@0: HANDSFREE_AG = 0x111F, michael@0: HEADSET = 0x1108, michael@0: HEADSET_AG = 0x1112, michael@0: HID = 0x1124, michael@0: OBJECT_PUSH = 0x1105, michael@0: UNKNOWN = 0x0000 michael@0: }; michael@0: michael@0: class BluetoothUuidHelper michael@0: { michael@0: public: michael@0: /** michael@0: * Get a 128-bit uuid string calculated from a 16-bit service class UUID and michael@0: * BASE_UUID michael@0: * michael@0: * @param aServiceClassUuid 16-bit service class UUID michael@0: * @param aRetUuidStr out parameter, 128-bit uuid string michael@0: */ michael@0: static void michael@0: GetString(BluetoothServiceClass aServiceClassUuid, nsAString& aRetUuidStr); michael@0: michael@0: /** michael@0: * Convert a 128-bit uuid string to a value of BluetoothServiceClass michael@0: * michael@0: * @param aUuidStr 128-bit uuid string michael@0: * @return a value of BluetoothServiceClass michael@0: */ michael@0: static BluetoothServiceClass michael@0: GetBluetoothServiceClass(const nsAString& aUuidStr); michael@0: michael@0: static BluetoothServiceClass michael@0: GetBluetoothServiceClass(uint16_t aServiceUuid); michael@0: michael@0: static BluetoothProfileManagerBase* michael@0: GetBluetoothProfileManager(uint16_t aServiceUuid); michael@0: }; michael@0: michael@0: // TODO/qdot: Move these back into gonk and make the service handler deal with michael@0: // it there. michael@0: // michael@0: // Gotten from reading the "u8" values in B2G/external/bluez/src/adapter.c michael@0: // These were hardcoded into android michael@0: enum BluetoothReservedChannels { michael@0: CHANNEL_DIALUP_NETWORK = 1, michael@0: CHANNEL_HANDSFREE_AG = 10, michael@0: CHANNEL_HEADSET_AG = 11, michael@0: CHANNEL_OPUSH = 12, michael@0: CHANNEL_SIM_ACCESS = 15, michael@0: CHANNEL_PBAP_PSE = 19, michael@0: CHANNEL_FTP = 20, michael@0: CHANNEL_OPUSH_L2CAP = 5255 michael@0: }; michael@0: michael@0: END_BLUETOOTH_NAMESPACE michael@0: michael@0: #endif