Bumping manifests a=b2g-bump
[gecko.git] / dom / bluetooth2 / BluetoothRilListener.h
blob7cc6e52f0176d93d770cef27adbb5d045547117b
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_bluetoothrillistener_h__
8 #define mozilla_dom_bluetooth_bluetoothrillistener_h__
10 #include "BluetoothCommon.h"
12 #include "nsAutoPtr.h"
14 #include "nsIIccProvider.h"
15 #include "nsIMobileConnectionService.h"
16 #include "nsITelephonyService.h"
18 BEGIN_BLUETOOTH_NAMESPACE
20 class BluetoothRilListener;
22 class IccListener : public nsIIccListener
24 public:
25 NS_DECL_ISUPPORTS
26 NS_DECL_NSIICCLISTENER
28 IccListener() { }
29 virtual ~IccListener() { }
31 bool Listen(bool aStart);
32 void SetOwner(BluetoothRilListener *aOwner);
34 private:
35 BluetoothRilListener* mOwner;
38 class MobileConnectionListener : public nsIMobileConnectionListener
40 public:
41 NS_DECL_ISUPPORTS
42 NS_DECL_NSIMOBILECONNECTIONLISTENER
44 MobileConnectionListener(uint32_t aClientId)
45 : mClientId(aClientId) { }
46 virtual ~MobileConnectionListener() { }
48 bool Listen(bool aStart);
50 private:
51 uint32_t mClientId;
54 class TelephonyListener : public nsITelephonyListener
56 public:
57 NS_DECL_ISUPPORTS
58 NS_DECL_NSITELEPHONYLISTENER
60 TelephonyListener() { }
61 virtual ~TelephonyListener() { }
63 bool Listen(bool aStart);
65 private:
66 nsresult HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend);
69 class BluetoothRilListener
71 public:
72 BluetoothRilListener();
73 ~BluetoothRilListener();
75 /**
76 * Start/Stop listening.
78 * @param aStart [in] whether to start/stop listening
80 bool Listen(bool aStart);
82 /**
83 * Be informed that certain client's service has changed.
85 * @param aClientId [in] the client id with service change
86 * @param aRegistered [in] whether changed service is registered
88 void ServiceChanged(uint32_t aClientId, bool aRegistered);
90 /**
91 * Enumerate current calls.
93 void EnumerateCalls();
95 /**
96 * The id of client that mobile connection and icc info listeners
97 * are listening to.
99 * mClientId equals to number of total clients (array length of
100 * mobile connection listeners) if there is no available client to listen.
102 uint32_t mClientId;
104 private:
106 * Start/Stop listening of mobile connection and icc info.
108 * @param aStart [in] whether to start/stop listening
110 bool ListenMobileConnAndIccInfo(bool aStart);
113 * Select available client to listen and assign mClientId.
115 * mClientId is assigned to number of total clients (array length of
116 * mobile connection listeners) if there is no available client to listen.
118 void SelectClient();
121 * Array of mobile connection listeners.
123 * The length equals to number of total clients.
125 nsTArray<nsRefPtr<MobileConnectionListener> > mMobileConnListeners;
127 nsRefPtr<IccListener> mIccListener;
128 nsRefPtr<TelephonyListener> mTelephonyListener;
131 END_BLUETOOTH_NAMESPACE
133 #endif