dom/bluetooth/BluetoothUuid.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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/. */
     7 #ifndef mozilla_dom_bluetooth_bluetoothuuid_h__
     8 #define mozilla_dom_bluetooth_bluetoothuuid_h__
    10 #include "BluetoothCommon.h"
    12 BEGIN_BLUETOOTH_NAMESPACE
    14 class BluetoothProfileManagerBase;
    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 };
    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);
    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);
    59   static BluetoothServiceClass
    60   GetBluetoothServiceClass(uint16_t aServiceUuid);
    62   static BluetoothProfileManagerBase*
    63   GetBluetoothProfileManager(uint16_t aServiceUuid);
    64 };
    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 };
    82 END_BLUETOOTH_NAMESPACE
    84 #endif

mercurial