|
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/. */ |
|
6 |
|
7 #ifndef mozilla_dom_bluetooth_bluetoothservicebluedroid_h__ |
|
8 #define mozilla_dom_bluetooth_bluetoothservicebluedroid_h__ |
|
9 |
|
10 #include <hardware/bluetooth.h> |
|
11 |
|
12 #include "BluetoothCommon.h" |
|
13 #include "BluetoothService.h" |
|
14 |
|
15 BEGIN_BLUETOOTH_NAMESPACE |
|
16 |
|
17 class BluetoothServiceBluedroid : public BluetoothService |
|
18 { |
|
19 public: |
|
20 static const bt_interface_t* GetBluetoothInterface(); |
|
21 |
|
22 BluetoothServiceBluedroid(); |
|
23 ~BluetoothServiceBluedroid(); |
|
24 |
|
25 virtual nsresult StartInternal(); |
|
26 virtual nsresult StopInternal(); |
|
27 |
|
28 virtual nsresult GetDefaultAdapterPathInternal( |
|
29 BluetoothReplyRunnable* aRunnable); |
|
30 |
|
31 virtual nsresult GetConnectedDevicePropertiesInternal(uint16_t aProfileId, |
|
32 BluetoothReplyRunnable* aRunnable); |
|
33 |
|
34 virtual nsresult GetPairedDevicePropertiesInternal( |
|
35 const nsTArray<nsString>& aDeviceAddress, |
|
36 BluetoothReplyRunnable* aRunnable); |
|
37 |
|
38 virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable); |
|
39 virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable); |
|
40 |
|
41 virtual nsresult |
|
42 SetProperty(BluetoothObjectType aType, |
|
43 const BluetoothNamedValue& aValue, |
|
44 BluetoothReplyRunnable* aRunnable); |
|
45 |
|
46 virtual nsresult |
|
47 GetServiceChannel(const nsAString& aDeviceAddress, |
|
48 const nsAString& aServiceUuid, |
|
49 BluetoothProfileManagerBase* aManager); |
|
50 |
|
51 virtual bool |
|
52 UpdateSdpRecords(const nsAString& aDeviceAddress, |
|
53 BluetoothProfileManagerBase* aManager); |
|
54 |
|
55 virtual nsresult |
|
56 CreatePairedDeviceInternal(const nsAString& aDeviceAddress, |
|
57 int aTimeout, |
|
58 BluetoothReplyRunnable* aRunnable); |
|
59 |
|
60 virtual nsresult |
|
61 RemoveDeviceInternal(const nsAString& aDeviceObjectPath, |
|
62 BluetoothReplyRunnable* aRunnable); |
|
63 |
|
64 virtual bool |
|
65 SetPinCodeInternal(const nsAString& aDeviceAddress, const nsAString& aPinCode, |
|
66 BluetoothReplyRunnable* aRunnable); |
|
67 |
|
68 virtual bool |
|
69 SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey, |
|
70 BluetoothReplyRunnable* aRunnable); |
|
71 |
|
72 virtual bool |
|
73 SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm, |
|
74 BluetoothReplyRunnable* aRunnable); |
|
75 |
|
76 virtual bool |
|
77 SetAuthorizationInternal(const nsAString& aDeviceAddress, bool aAllow, |
|
78 BluetoothReplyRunnable* aRunnable); |
|
79 |
|
80 virtual nsresult |
|
81 PrepareAdapterInternal(); |
|
82 |
|
83 virtual void |
|
84 Connect(const nsAString& aDeviceAddress, |
|
85 uint32_t aCod, |
|
86 uint16_t aServiceUuid, |
|
87 BluetoothReplyRunnable* aRunnable); |
|
88 |
|
89 virtual bool |
|
90 IsConnected(uint16_t aProfileId); |
|
91 |
|
92 virtual void |
|
93 Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid, |
|
94 BluetoothReplyRunnable* aRunnable); |
|
95 |
|
96 virtual void |
|
97 SendFile(const nsAString& aDeviceAddress, |
|
98 BlobParent* aBlobParent, |
|
99 BlobChild* aBlobChild, |
|
100 BluetoothReplyRunnable* aRunnable); |
|
101 |
|
102 virtual void |
|
103 SendFile(const nsAString& aDeviceAddress, |
|
104 nsIDOMBlob* aBlob, |
|
105 BluetoothReplyRunnable* aRunnable); |
|
106 |
|
107 virtual void |
|
108 StopSendingFile(const nsAString& aDeviceAddress, |
|
109 BluetoothReplyRunnable* aRunnable); |
|
110 |
|
111 virtual void |
|
112 ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm, |
|
113 BluetoothReplyRunnable* aRunnable); |
|
114 |
|
115 virtual void |
|
116 ConnectSco(BluetoothReplyRunnable* aRunnable); |
|
117 |
|
118 virtual void |
|
119 DisconnectSco(BluetoothReplyRunnable* aRunnable); |
|
120 |
|
121 virtual void |
|
122 IsScoConnected(BluetoothReplyRunnable* aRunnable); |
|
123 |
|
124 virtual void |
|
125 AnswerWaitingCall(BluetoothReplyRunnable* aRunnable); |
|
126 |
|
127 virtual void |
|
128 IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable); |
|
129 |
|
130 virtual void |
|
131 ToggleCalls(BluetoothReplyRunnable* aRunnable); |
|
132 |
|
133 virtual void |
|
134 SendMetaData(const nsAString& aTitle, |
|
135 const nsAString& aArtist, |
|
136 const nsAString& aAlbum, |
|
137 int64_t aMediaNumber, |
|
138 int64_t aTotalMediaCount, |
|
139 int64_t aDuration, |
|
140 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
141 |
|
142 virtual void |
|
143 SendPlayStatus(int64_t aDuration, |
|
144 int64_t aPosition, |
|
145 const nsAString& aPlayStatus, |
|
146 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
147 |
|
148 virtual void |
|
149 UpdatePlayStatus(uint32_t aDuration, |
|
150 uint32_t aPosition, |
|
151 ControlPlayStatus aPlayStatus) MOZ_OVERRIDE; |
|
152 |
|
153 virtual nsresult |
|
154 SendSinkMessage(const nsAString& aDeviceAddresses, |
|
155 const nsAString& aMessage) MOZ_OVERRIDE; |
|
156 |
|
157 virtual nsresult |
|
158 SendInputMessage(const nsAString& aDeviceAddresses, |
|
159 const nsAString& aMessage) MOZ_OVERRIDE; |
|
160 }; |
|
161 |
|
162 END_BLUETOOTH_NAMESPACE |
|
163 |
|
164 #endif |
|
165 |