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_bluetoothrillistener_h__ |
michael@0 | 8 | #define mozilla_dom_bluetooth_bluetoothrillistener_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "BluetoothCommon.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "nsAutoPtr.h" |
michael@0 | 13 | |
michael@0 | 14 | #include "nsIIccProvider.h" |
michael@0 | 15 | #include "nsIMobileConnectionProvider.h" |
michael@0 | 16 | #include "nsITelephonyProvider.h" |
michael@0 | 17 | |
michael@0 | 18 | BEGIN_BLUETOOTH_NAMESPACE |
michael@0 | 19 | |
michael@0 | 20 | class BluetoothRilListener; |
michael@0 | 21 | |
michael@0 | 22 | class IccListener : public nsIIccListener |
michael@0 | 23 | { |
michael@0 | 24 | public: |
michael@0 | 25 | NS_DECL_ISUPPORTS |
michael@0 | 26 | NS_DECL_NSIICCLISTENER |
michael@0 | 27 | |
michael@0 | 28 | IccListener() { } |
michael@0 | 29 | virtual ~IccListener() { } |
michael@0 | 30 | |
michael@0 | 31 | bool Listen(bool aStart); |
michael@0 | 32 | void SetOwner(BluetoothRilListener *aOwner); |
michael@0 | 33 | |
michael@0 | 34 | private: |
michael@0 | 35 | BluetoothRilListener* mOwner; |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | class MobileConnectionListener : public nsIMobileConnectionListener |
michael@0 | 39 | { |
michael@0 | 40 | public: |
michael@0 | 41 | NS_DECL_ISUPPORTS |
michael@0 | 42 | NS_DECL_NSIMOBILECONNECTIONLISTENER |
michael@0 | 43 | |
michael@0 | 44 | MobileConnectionListener(uint32_t aClientId) |
michael@0 | 45 | : mClientId(aClientId) { } |
michael@0 | 46 | virtual ~MobileConnectionListener() { } |
michael@0 | 47 | |
michael@0 | 48 | bool Listen(bool aStart); |
michael@0 | 49 | |
michael@0 | 50 | private: |
michael@0 | 51 | uint32_t mClientId; |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | class TelephonyListener : public nsITelephonyListener |
michael@0 | 55 | { |
michael@0 | 56 | public: |
michael@0 | 57 | NS_DECL_ISUPPORTS |
michael@0 | 58 | NS_DECL_NSITELEPHONYLISTENER |
michael@0 | 59 | |
michael@0 | 60 | TelephonyListener() { } |
michael@0 | 61 | virtual ~TelephonyListener() { } |
michael@0 | 62 | |
michael@0 | 63 | bool Listen(bool aStart); |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | class BluetoothRilListener |
michael@0 | 67 | { |
michael@0 | 68 | public: |
michael@0 | 69 | BluetoothRilListener(); |
michael@0 | 70 | ~BluetoothRilListener(); |
michael@0 | 71 | |
michael@0 | 72 | /** |
michael@0 | 73 | * Start/Stop listening. |
michael@0 | 74 | * |
michael@0 | 75 | * @param aStart [in] whether to start/stop listening |
michael@0 | 76 | */ |
michael@0 | 77 | bool Listen(bool aStart); |
michael@0 | 78 | |
michael@0 | 79 | /** |
michael@0 | 80 | * Be informed that certain client's service has changed. |
michael@0 | 81 | * |
michael@0 | 82 | * @param aClientId [in] the client id with service change |
michael@0 | 83 | * @param aRegistered [in] whether changed service is registered |
michael@0 | 84 | */ |
michael@0 | 85 | void ServiceChanged(uint32_t aClientId, bool aRegistered); |
michael@0 | 86 | |
michael@0 | 87 | /** |
michael@0 | 88 | * Enumerate current calls. |
michael@0 | 89 | */ |
michael@0 | 90 | void EnumerateCalls(); |
michael@0 | 91 | |
michael@0 | 92 | /** |
michael@0 | 93 | * The id of client that mobile connection and icc info listeners |
michael@0 | 94 | * are listening to. |
michael@0 | 95 | * |
michael@0 | 96 | * mClientId equals to number of total clients (array length of |
michael@0 | 97 | * mobile connection listeners) if there is no available client to listen. |
michael@0 | 98 | */ |
michael@0 | 99 | uint32_t mClientId; |
michael@0 | 100 | |
michael@0 | 101 | private: |
michael@0 | 102 | /** |
michael@0 | 103 | * Start/Stop listening of mobile connection and icc info. |
michael@0 | 104 | * |
michael@0 | 105 | * @param aStart [in] whether to start/stop listening |
michael@0 | 106 | */ |
michael@0 | 107 | bool ListenMobileConnAndIccInfo(bool aStart); |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * Select available client to listen and assign mClientId. |
michael@0 | 111 | * |
michael@0 | 112 | * mClientId is assigned to number of total clients (array length of |
michael@0 | 113 | * mobile connection listeners) if there is no available client to listen. |
michael@0 | 114 | */ |
michael@0 | 115 | void SelectClient(); |
michael@0 | 116 | |
michael@0 | 117 | /** |
michael@0 | 118 | * Array of mobile connection listeners. |
michael@0 | 119 | * |
michael@0 | 120 | * The length equals to number of total clients. |
michael@0 | 121 | */ |
michael@0 | 122 | nsTArray<nsRefPtr<MobileConnectionListener> > mMobileConnListeners; |
michael@0 | 123 | |
michael@0 | 124 | nsRefPtr<IccListener> mIccListener; |
michael@0 | 125 | nsRefPtr<TelephonyListener> mTelephonyListener; |
michael@0 | 126 | }; |
michael@0 | 127 | |
michael@0 | 128 | END_BLUETOOTH_NAMESPACE |
michael@0 | 129 | |
michael@0 | 130 | #endif |