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_bluetoothrillistener_h__ michael@0: #define mozilla_dom_bluetooth_bluetoothrillistener_h__ michael@0: michael@0: #include "BluetoothCommon.h" michael@0: michael@0: #include "nsAutoPtr.h" michael@0: michael@0: #include "nsIIccProvider.h" michael@0: #include "nsIMobileConnectionProvider.h" michael@0: #include "nsITelephonyProvider.h" michael@0: michael@0: BEGIN_BLUETOOTH_NAMESPACE michael@0: michael@0: class BluetoothRilListener; michael@0: michael@0: class IccListener : public nsIIccListener michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIICCLISTENER michael@0: michael@0: IccListener() { } michael@0: virtual ~IccListener() { } michael@0: michael@0: bool Listen(bool aStart); michael@0: void SetOwner(BluetoothRilListener *aOwner); michael@0: michael@0: private: michael@0: BluetoothRilListener* mOwner; michael@0: }; michael@0: michael@0: class MobileConnectionListener : public nsIMobileConnectionListener michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIMOBILECONNECTIONLISTENER michael@0: michael@0: MobileConnectionListener(uint32_t aClientId) michael@0: : mClientId(aClientId) { } michael@0: virtual ~MobileConnectionListener() { } michael@0: michael@0: bool Listen(bool aStart); michael@0: michael@0: private: michael@0: uint32_t mClientId; michael@0: }; michael@0: michael@0: class TelephonyListener : public nsITelephonyListener michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSITELEPHONYLISTENER michael@0: michael@0: TelephonyListener() { } michael@0: virtual ~TelephonyListener() { } michael@0: michael@0: bool Listen(bool aStart); michael@0: }; michael@0: michael@0: class BluetoothRilListener michael@0: { michael@0: public: michael@0: BluetoothRilListener(); michael@0: ~BluetoothRilListener(); michael@0: michael@0: /** michael@0: * Start/Stop listening. michael@0: * michael@0: * @param aStart [in] whether to start/stop listening michael@0: */ michael@0: bool Listen(bool aStart); michael@0: michael@0: /** michael@0: * Be informed that certain client's service has changed. michael@0: * michael@0: * @param aClientId [in] the client id with service change michael@0: * @param aRegistered [in] whether changed service is registered michael@0: */ michael@0: void ServiceChanged(uint32_t aClientId, bool aRegistered); michael@0: michael@0: /** michael@0: * Enumerate current calls. michael@0: */ michael@0: void EnumerateCalls(); michael@0: michael@0: /** michael@0: * The id of client that mobile connection and icc info listeners michael@0: * are listening to. michael@0: * michael@0: * mClientId equals to number of total clients (array length of michael@0: * mobile connection listeners) if there is no available client to listen. michael@0: */ michael@0: uint32_t mClientId; michael@0: michael@0: private: michael@0: /** michael@0: * Start/Stop listening of mobile connection and icc info. michael@0: * michael@0: * @param aStart [in] whether to start/stop listening michael@0: */ michael@0: bool ListenMobileConnAndIccInfo(bool aStart); michael@0: michael@0: /** michael@0: * Select available client to listen and assign mClientId. michael@0: * michael@0: * mClientId is assigned to number of total clients (array length of michael@0: * mobile connection listeners) if there is no available client to listen. michael@0: */ michael@0: void SelectClient(); michael@0: michael@0: /** michael@0: * Array of mobile connection listeners. michael@0: * michael@0: * The length equals to number of total clients. michael@0: */ michael@0: nsTArray > mMobileConnListeners; michael@0: michael@0: nsRefPtr mIccListener; michael@0: nsRefPtr mTelephonyListener; michael@0: }; michael@0: michael@0: END_BLUETOOTH_NAMESPACE michael@0: michael@0: #endif