dom/bluetooth/BluetoothUuid.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bluetooth/BluetoothUuid.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,84 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_bluetooth_bluetoothuuid_h__
    1.11 +#define mozilla_dom_bluetooth_bluetoothuuid_h__
    1.12 +
    1.13 +#include "BluetoothCommon.h"
    1.14 +
    1.15 +BEGIN_BLUETOOTH_NAMESPACE
    1.16 +
    1.17 +class BluetoothProfileManagerBase;
    1.18 +
    1.19 +/*
    1.20 + * Service classes and Profile Identifiers
    1.21 + *
    1.22 + * Supported Bluetooth services for v1 are listed as below.
    1.23 + *
    1.24 + * The value of each service class is defined in "AssignedNumbers/Service
    1.25 + * Discovery Protocol (SDP)/Service classes and Profile Identifiers" in the
    1.26 + * Bluetooth Core Specification.
    1.27 + */
    1.28 +enum BluetoothServiceClass
    1.29 +{
    1.30 +  A2DP          = 0x110D,
    1.31 +  HANDSFREE     = 0x111E,
    1.32 +  HANDSFREE_AG  = 0x111F,
    1.33 +  HEADSET       = 0x1108,
    1.34 +  HEADSET_AG    = 0x1112,
    1.35 +  HID           = 0x1124,
    1.36 +  OBJECT_PUSH   = 0x1105,
    1.37 +  UNKNOWN       = 0x0000
    1.38 +};
    1.39 +
    1.40 +class BluetoothUuidHelper
    1.41 +{
    1.42 +public:
    1.43 +  /**
    1.44 +   * Get a 128-bit uuid string calculated from a 16-bit service class UUID and
    1.45 +   * BASE_UUID
    1.46 +   *
    1.47 +   * @param aServiceClassUuid  16-bit service class UUID
    1.48 +   * @param aRetUuidStr  out parameter, 128-bit uuid string
    1.49 +   */
    1.50 +  static void
    1.51 +  GetString(BluetoothServiceClass aServiceClassUuid, nsAString& aRetUuidStr);
    1.52 +
    1.53 +  /**
    1.54 +   * Convert a 128-bit uuid string to a value of BluetoothServiceClass
    1.55 +   *
    1.56 +   * @param aUuidStr  128-bit uuid string
    1.57 +   * @return  a value of BluetoothServiceClass
    1.58 +   */
    1.59 +  static BluetoothServiceClass
    1.60 +  GetBluetoothServiceClass(const nsAString& aUuidStr);
    1.61 +
    1.62 +  static BluetoothServiceClass
    1.63 +  GetBluetoothServiceClass(uint16_t aServiceUuid);
    1.64 +
    1.65 +  static BluetoothProfileManagerBase*
    1.66 +  GetBluetoothProfileManager(uint16_t aServiceUuid);
    1.67 +};
    1.68 +
    1.69 +// TODO/qdot: Move these back into gonk and make the service handler deal with
    1.70 +// it there.
    1.71 +//
    1.72 +// Gotten from reading the "u8" values in B2G/external/bluez/src/adapter.c
    1.73 +// These were hardcoded into android
    1.74 +enum BluetoothReservedChannels {
    1.75 +  CHANNEL_DIALUP_NETWORK = 1,
    1.76 +  CHANNEL_HANDSFREE_AG   = 10,
    1.77 +  CHANNEL_HEADSET_AG     = 11,
    1.78 +  CHANNEL_OPUSH          = 12,
    1.79 +  CHANNEL_SIM_ACCESS     = 15,
    1.80 +  CHANNEL_PBAP_PSE       = 19,
    1.81 +  CHANNEL_FTP            = 20,
    1.82 +  CHANNEL_OPUSH_L2CAP    = 5255
    1.83 +};
    1.84 +
    1.85 +END_BLUETOOTH_NAMESPACE
    1.86 +
    1.87 +#endif

mercurial