mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
1dfd83ddde
- Bug 1225603. Codegen ToJSValue overloads for Web IDL enums. r=smaug,jib (8c21e0b148) - Bug 1194978 - Renable RequestSync tests in b2g, r=nsm (e99a2fb4f5) - Bug 1182358 - patch 2 - RequestSyncService.jsm should not write debug messages (1fcc99d65c) - Bug 1147804 - Facebook auto sync will not happen if you change the time 24 hours later. r=fabrice (936b25f586) - Bug 1181489 - Enable debug for AlarmService.jsm. r=fabrice (a92673c2f4) - Bug 1181489 - Adding sanity checks into the alarm service for preventing from the alarm works erroneously. r=fabrice (dd75f12425) - Bug 1213169 - requestsync assumes all in-memory mozAlarms will never be purged (and these alarms get persisted anyways), but they are purged on timezone/clock changes, r=asuth (00924ed778) - Bug 1147804 followup: Add missing 'override' annotation to AlarmHalService::Notify declaration. rs=ehsan (8e797f2a9a) - Bug 1211469 - JavaScript error: resource://gre/modules/RequestSyncService.jsm, line 104: TypeError: this.addRegistration is not a function. r=baku (bbcefdb093) - Bug 1216002 - "JavaScript error: resource://gre/modules/RequestSyncService.jsm, line 228: TypeError: 'continue' called on an object that does not implement interface IDBCursor." r=bz (153d8a610b) - Bug 1226708 - part 1 - Use importInMainProcess in requestsync tests. r=baku (7638d77db3) - Bug 1140275 - System messages shouldn't be sent to app pages not registered in manifests. r=fabrice (3e0d7ae440) - var-let (e74f0b4a2c) - Bug 1174683 - [Secure Element] Fix TypeError in UiccConnector.unregisterListener. r=allstars.chh (9dd333d909) - Bug 1156710 - [Secure Element] Allow SE access without full ACE checks if certified apps debug is enabled. r=allstars.chh (f1d0b8d5b0) - Bug 1216822 - Make sure that using an invalid Content-Type when constructing a Response object doesn't throw; r=bkelly (232af6f665) - Bug 1227030 - Change log module to LazyLogModule with a more self-explantory name. r=seanlin (17f85691fb) - Bug 1225873 - micro-optimize creating event target chains; r=smaug (a38d507a61) - Bug 1194525 - Gecko should ignore |postResult| calls for WebActivities with no returnValue. r=fabrice,sicking (1549718723) - Bug 1174071 - Remove 'required' keyword for Bluetooth*EventInit dictionary members. r=btian, r=bz (f8c02ed9e3) - Bug 1181483: Implement GATT server characteristic notification; r=jocelyn, r=mrbkap (d5170b650e) - Bug 1215525: Replace strings with Bluetooth addresses and UUIDs in GATT mid-layer, r=joliu (5949fa2a39) - Bug 1223720: Support UUIDs and addresses for Bluetooth signal paths, r=joliu (1d98490eac) - Bug 1217778 - Ensure sBluetoothGattService is not null before accessing GattInterface in GattManager. r=jocelyn (40c4cde2b3) - Bug 1146355: Update Bluetooth backend interface for bluetooth2, r=brsun (f384d2f1dc) - Bug 1211948: Introduce |enum BluetoothSetupServiceId|, r=brsun (2c96581c45) - fix (3de8d6c033) - Bug 1211948: Register Bluetooth GATT module in GATT manager, r=joliu (491d1e0408) - Bug 1209469: Expose |BluetoothPropertyType| in Bluetooth backend interface, r=brsun (027a57df73) - Bug 1209469: Replace |BluetoothNamedValue| with |BluetoothProperty| in Bluetooth backend, r=brsun (c14311d277) - Bug 1207649: Convert Bluetooth AVRCP backend to |BluetoothAddress|, r=shuang (0acc2e7f51) - Bug 1223806: Add Bluetooth Core interface, notification and result handler, r=btian (d6ca2c4beb) - Bug1209085: Replace simple init ops by |UnpackInitOp| in Bluetooth Core backend, r=joliu (a37e6cc579) - Bug 1223806: Convert Bluetooth to |BluetoothCoreNotificationHandler|, r=btian (a85b9302f5) - Bug 1220121: Convert IPDL of Bluetooth Core API to |BluetoothAddress|, r=brsun (d105f3eab0) - Bug 1220121: Convert IPDL of Bluetooth Core API to |BluetoothPinCode|, r=brsun (c3a2b4f30a) - Bug 1220121: Convert IPDL of Bluetooth OPP API to |BluetoothAddress|, r=btian (560c056efc) - Bug 1220121: Convert IPDL of Bluetooth AVRCP API to |ControlPlayStatus|, r=shuang (0aaac4c9c8) - Bug 1215525: Use strong typing in Bluetooth GATT mid-layer interfaces, r=joliu (7ad219094f) - Bug 1223806: Convert Bluetooth to |BluetoothCoreResultHandler|, r=btian (e2c96b7f90) - Bug 1220121: Convert IPDL of Bluetooth GATT API to |BluetoothAddress|, r=joliu (a426ffd63d) - Bug 1220121: Convert IPDL of Bluetooth GATT API to |BluetoothUuid|, r=joliu (2343063b18) - Bug 1225787: Fix wrong arguments of BluetoothGattInterface::AddCharacteristic; r=jocelyn (b19bb89fb3) - Bug 1228519 - Fix RequestReadNotification for GATT Server API. r=brsun (25cc876d88) - Bug 1225785: Fix WriteRequested mismatch; r=jocelyn (89d9b243a3) - Bug 1223806: Add |BluetoothDaemonCoreInterface|, r=btian (c6b2cd9fba) - Bug 1220121: Prepare IPDL support for additional Bluetooth types, r=brsun (8cb996570b) - Bug 1211948: Register Bluetooth Handsfree module in Handsfree manager, r=btian (af91aa226d) - Bug 1211435: Rename some internal classes of Bluetooth's A2DP manager, r=shuang (e834e2ee87) - Bug 1211948: Register Bluetooth A2DP module in A2DP manager, r=brsun (f9fcb0115f) - Bug 1211435: Rename some internal classes of Bluetooth's AVRCP manager, r=shuang (15a23ffe31) - Bug 1211948: Register Bluetooth AVRCP module in AVRCP manager, r=brsun (68e51afcca) - Bug 1223806: Convert Bluetooth to |BluetoothCoreInterface|, r=btian (7bff6267e1) - Bug 1186840 - [MAP] Implement MessageUpdate function, r=btian (6439c7497b) - Bug 1207998 - Convert nsCString to nsString for BluetoothVCardListingEvent.mSearchValue, r=shuang (37effbf4d2) - cleanup (721fb92ec3) - fix misspatch (5e94030fcd) - Bug 1230066 - Add missing STATUS_AUTH_REJECTED into enum BluetoothStatus,r=tzimmermann (17b45140a5) - Bug 1225340 - Refine nullity check macros in BluetoothServiceBluedroid, r=tzimmermann (5175c6eacf) - Bug 1227440 - Reject pin reply by cancelling bond to trigger BondStateChangedNotification, in order to inform gaia setting app, r=shuang (772401f943) - Bug1209085: Replace simple init ops by |UnpackPDUInitOp| in Bluetooth GATT backend, r=joliu (392d81748c) - Bug 1229290 - Pack/unpack UUIDs in a reverse order when adding characteristics and descriptors in GATT server API. r=brsun (850fb0eeb9) - Bug 1197815: Add missing |BluetoothHfpManager::IsNrecEnabled|, r=shuang (968089bef0) - Bug 1216179: Fix broken interface of fall-back Bluetooth HFP manager, r=btian (13b602a861) - Bug 1166469 - Add HandleBackendError for hfp-fallback product, r=btian (309dd1a92b) - Bug 1224240 - fix memory leak in Bluetooth*Manager::CompareHeaderTarget; r=btian (c6cfc95bac) - Bug 1224166: Build BluetoothCommon.cpp unconditionally, r=shuang (8efa02b83d) - Bug1209085: Replace trivial init ops by |UnpackPDUInitOP| in Bluetooth A2DP backend, r=joliu (4ccaab6bd6) - Bug 1142408 - Add data length parameter for Register Notification Response Command. r=tzimmermann (28706dcc16) - Bug 1228521 - Fix PDU packing in |ServerSendResponseCmd| for GATT Server API. r=brsun (290c3739c3) - Bug1209085: Replace trivial init ops by |UnpackPDUInitOp| in Bluetooth AVRCP backend, r=joliu (639f5b6143) - Bug 1199653 - Correctly set |sInShutdown| in BluetoothService for content processes. f=tzimmermann, r=shuang (5fed461709) - Bug 1224166: Define Bluetooth debug flag in BluetoothCommon.cpp, r=shuang (9602455405)
861 lines
24 KiB
C++
861 lines
24 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "base/basictypes.h"
|
|
|
|
#include "BluetoothServiceChildProcess.h"
|
|
|
|
#include "mozilla/Assertions.h"
|
|
#include "mozilla/dom/ContentChild.h"
|
|
#include "mozilla/dom/ipc/BlobChild.h"
|
|
|
|
#include "BluetoothChild.h"
|
|
#include "MainThreadUtils.h"
|
|
|
|
USING_BLUETOOTH_NAMESPACE
|
|
|
|
namespace {
|
|
|
|
BluetoothChild* sBluetoothChild;
|
|
|
|
inline
|
|
void
|
|
SendRequest(BluetoothReplyRunnable* aRunnable, const Request& aRequest)
|
|
{
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
MOZ_ASSERT(aRunnable);
|
|
|
|
NS_WARN_IF_FALSE(sBluetoothChild,
|
|
"Calling methods on BluetoothServiceChildProcess during "
|
|
"shutdown!");
|
|
|
|
if (sBluetoothChild) {
|
|
BluetoothRequestChild* actor = new BluetoothRequestChild(aRunnable);
|
|
sBluetoothChild->SendPBluetoothRequestConstructor(actor, aRequest);
|
|
}
|
|
}
|
|
|
|
} // namespace
|
|
|
|
// static
|
|
BluetoothServiceChildProcess*
|
|
BluetoothServiceChildProcess::Create()
|
|
{
|
|
MOZ_ASSERT(!sBluetoothChild);
|
|
|
|
mozilla::dom::ContentChild* contentChild =
|
|
mozilla::dom::ContentChild::GetSingleton();
|
|
MOZ_ASSERT(contentChild);
|
|
|
|
BluetoothServiceChildProcess* btService = new BluetoothServiceChildProcess();
|
|
|
|
sBluetoothChild = new BluetoothChild(btService);
|
|
contentChild->SendPBluetoothConstructor(sBluetoothChild);
|
|
|
|
return btService;
|
|
}
|
|
|
|
BluetoothServiceChildProcess::BluetoothServiceChildProcess()
|
|
{
|
|
}
|
|
|
|
BluetoothServiceChildProcess::~BluetoothServiceChildProcess()
|
|
{
|
|
sBluetoothChild = nullptr;
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::NoteDeadActor()
|
|
{
|
|
MOZ_ASSERT(sBluetoothChild);
|
|
sBluetoothChild = nullptr;
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::RegisterBluetoothSignalHandler(
|
|
const nsAString& aNodeName,
|
|
BluetoothSignalObserver* aHandler)
|
|
{
|
|
if (sBluetoothChild && !IsSignalRegistered(aNodeName)) {
|
|
sBluetoothChild->SendRegisterSignalHandler(nsString(aNodeName));
|
|
}
|
|
BluetoothService::RegisterBluetoothSignalHandler(aNodeName, aHandler);
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::UnregisterBluetoothSignalHandler(
|
|
const nsAString& aNodeName,
|
|
BluetoothSignalObserver* aHandler)
|
|
{
|
|
BluetoothService::UnregisterBluetoothSignalHandler(aNodeName, aHandler);
|
|
if (sBluetoothChild && !IsSignalRegistered(aNodeName)) {
|
|
sBluetoothChild->SendUnregisterSignalHandler(nsString(aNodeName));
|
|
}
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::GetAdaptersInternal(
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, GetAdaptersRequest());
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::StartInternal(BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, StartBluetoothRequest());
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::StopInternal(BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, StopBluetoothRequest());
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::GetConnectedDevicePropertiesInternal(
|
|
uint16_t aServiceUuid,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, ConnectedDevicePropertiesRequest(aServiceUuid));
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::GetPairedDevicePropertiesInternal(
|
|
const nsTArray<BluetoothAddress>& aDeviceAddresses,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
PairedDevicePropertiesRequest request;
|
|
request.addresses().AppendElements(aDeviceAddresses);
|
|
|
|
SendRequest(aRunnable, request);
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::FetchUuidsInternal(
|
|
const BluetoothAddress& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, FetchUuidsRequest(aDeviceAddress));
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::StopDiscoveryInternal(
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, StopDiscoveryRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::StartDiscoveryInternal(
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, StartDiscoveryRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::StopLeScanInternal(
|
|
const BluetoothUuid& aScanUuid,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, StopLeScanRequest(aScanUuid));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::StartLeScanInternal(
|
|
const nsTArray<BluetoothUuid>& aServiceUuids,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, StartLeScanRequest(aServiceUuids));
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::SetProperty(BluetoothObjectType aType,
|
|
const BluetoothNamedValue& aValue,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, SetPropertyRequest(aType, aValue));
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::CreatePairedDeviceInternal(
|
|
const BluetoothAddress& aDeviceAddress, int aTimeout,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, PairRequest(aDeviceAddress, aTimeout));
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::RemoveDeviceInternal(
|
|
const BluetoothAddress& aDeviceAddress, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, UnpairRequest(aDeviceAddress));
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::GetServiceChannel(const BluetoothAddress& aDeviceAddress,
|
|
const BluetoothUuid& aServiceUuid,
|
|
BluetoothProfileManagerBase* aManager)
|
|
{
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
bool
|
|
BluetoothServiceChildProcess::UpdateSdpRecords(const BluetoothAddress& aDeviceAddress,
|
|
BluetoothProfileManagerBase* aManager)
|
|
{
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::PinReplyInternal(
|
|
const BluetoothAddress& aDeviceAddress, bool aAccept,
|
|
const BluetoothPinCode& aPinCode, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, PinReplyRequest(aDeviceAddress, aAccept, aPinCode));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SspReplyInternal(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
BluetoothSspVariant aVariant, bool aAccept,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, SspReplyRequest(aDeviceAddress, aVariant, aAccept));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SetPinCodeInternal(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
const BluetoothPinCode& aPinCode,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, SetPinCodeRequest(aDeviceAddress, aPinCode));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SetPasskeyInternal(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
uint32_t aPasskey,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, SetPasskeyRequest(aDeviceAddress, aPasskey));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SetPairingConfirmationInternal(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
bool aConfirm,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
if (aConfirm) {
|
|
SendRequest(aRunnable, ConfirmPairingConfirmationRequest(aDeviceAddress));
|
|
} else {
|
|
SendRequest(aRunnable, DenyPairingConfirmationRequest(aDeviceAddress));
|
|
}
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::Connect(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
uint32_t aCod, uint16_t aServiceUuid,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, ConnectRequest(aDeviceAddress, aCod, aServiceUuid));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::Disconnect(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
uint16_t aServiceUuid,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, DisconnectRequest(aDeviceAddress, aServiceUuid));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SendFile(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
BlobParent* aBlobParent,
|
|
BlobChild* aBlobChild,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, SendFileRequest(aDeviceAddress, nullptr, aBlobChild));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SendFile(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
Blob* aBlobChild,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
// Parent-process-only method
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::StopSendingFile(
|
|
const BluetoothAddress& aDeviceAddress,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, StopSendingFileRequest(aDeviceAddress));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ConfirmReceivingFile(
|
|
const BluetoothAddress& aDeviceAddress, bool aConfirm,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
if(aConfirm) {
|
|
SendRequest(aRunnable, ConfirmReceivingFileRequest(aDeviceAddress));
|
|
return;
|
|
}
|
|
|
|
SendRequest(aRunnable, DenyReceivingFileRequest(aDeviceAddress));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ConnectSco(BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, ConnectScoRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::DisconnectSco(BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, DisconnectScoRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::IsScoConnected(BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, IsScoConnectedRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SetObexPassword(
|
|
const nsAString& aPassword,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, SetObexPasswordRequest(nsString(aPassword)));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::RejectObexAuth(BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, RejectObexAuthRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyTovCardPulling(
|
|
BlobParent* aBlobParent,
|
|
BlobChild* aBlobChild,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, ReplyTovCardPullingRequest(nullptr, aBlobChild));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyTovCardPulling(
|
|
Blob* aBlobChild,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
// Parent-process-only method
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToPhonebookPulling(
|
|
BlobParent* aBlobParent,
|
|
BlobChild* aBlobChild,
|
|
uint16_t aPhonebookSize,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyToPhonebookPullingRequest(nullptr, aBlobChild, aPhonebookSize));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToPhonebookPulling(
|
|
Blob* aBlobChild,
|
|
uint16_t aPhonebookSize,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
// Parent-process-only method
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyTovCardListing(
|
|
BlobParent* aBlobParent,
|
|
BlobChild* aBlobChild,
|
|
uint16_t aPhonebookSize,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyTovCardListingRequest(nullptr, aBlobChild, aPhonebookSize));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyTovCardListing(
|
|
Blob* aBlobChild,
|
|
uint16_t aPhonebookSize,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
// Parent-process-only method
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapFolderListing(long aMasId,
|
|
const nsAString& aFolderList,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyToFolderListingRequest(aMasId, nsString(aFolderList)));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapMessagesListing(BlobParent* aBlobParent,
|
|
BlobChild* aBlobChild,
|
|
long aMasId,
|
|
bool aNewMessage,
|
|
const nsAString& aTimestamp,
|
|
int aSize,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyToMessagesListingRequest(aMasId, nullptr, aBlobChild,
|
|
aNewMessage, nsString(aTimestamp), aSize));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapMessagesListing(long aMasId,
|
|
Blob* aBlob,
|
|
bool aNewMessage,
|
|
const nsAString& aTimestamp,
|
|
int aSize,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
// Parent-process-only method
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapGetMessage(BlobParent* aBlobParent,
|
|
BlobChild* aBlobChild,
|
|
long aMasId,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyToGetMessageRequest(aMasId, nullptr, aBlobChild));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapGetMessage(Blob* aBlob,
|
|
long aMasId,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
// Parent-process-only method
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapSetMessageStatus(long aMasId,
|
|
bool aStatus,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyToSetMessageStatusRequest(aMasId, aStatus));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapSendMessage(long aMasId,
|
|
const nsAString& aHandleId,
|
|
bool aStatus,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyToSendMessageRequest(aMasId, nsString(aHandleId), aStatus));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ReplyToMapMessageUpdate(long aMasId,
|
|
bool aStatus,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
ReplyToMessageUpdateRequest(aMasId, aStatus));
|
|
}
|
|
|
|
#ifdef MOZ_B2G_RIL
|
|
void
|
|
BluetoothServiceChildProcess::AnswerWaitingCall(
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, AnswerWaitingCallRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::IgnoreWaitingCall(
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, IgnoreWaitingCallRequest());
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ToggleCalls(
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, ToggleCallsRequest());
|
|
}
|
|
#endif // MOZ_B2G_RIL
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SendMetaData(const nsAString& aTitle,
|
|
const nsAString& aArtist,
|
|
const nsAString& aAlbum,
|
|
int64_t aMediaNumber,
|
|
int64_t aTotalMediaCount,
|
|
int64_t aDuration,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
SendMetaDataRequest(nsString(aTitle), nsString(aArtist),
|
|
nsString(aAlbum), aMediaNumber,
|
|
aTotalMediaCount, aDuration));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::SendPlayStatus(int64_t aDuration,
|
|
int64_t aPosition,
|
|
ControlPlayStatus aPlayStatus,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
SendPlayStatusRequest(aDuration, aPosition, aPlayStatus));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::ConnectGattClientInternal(
|
|
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, ConnectGattClientRequest(aAppUuid, aDeviceAddress));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::DisconnectGattClientInternal(
|
|
const BluetoothUuid& aAppUuid, const BluetoothAddress& aDeviceAddress,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
DisconnectGattClientRequest(aAppUuid, aDeviceAddress));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::DiscoverGattServicesInternal(
|
|
const BluetoothUuid& aAppUuid, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, DiscoverGattServicesRequest(aAppUuid));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattClientStartNotificationsInternal(
|
|
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
|
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattClientStartNotificationsRequest(aAppUuid, aServId, aCharId));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattClientStopNotificationsInternal(
|
|
const BluetoothUuid& aAppUuid, const BluetoothGattServiceId& aServId,
|
|
const BluetoothGattId& aCharId, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattClientStopNotificationsRequest(aAppUuid, aServId, aCharId));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::UnregisterGattClientInternal(
|
|
int aClientIf, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, UnregisterGattClientRequest(aClientIf));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattClientReadRemoteRssiInternal(
|
|
int aClientIf, const BluetoothAddress& aDeviceAddress,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattClientReadRemoteRssiRequest(aClientIf, aDeviceAddress));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattClientReadCharacteristicValueInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothGattServiceId& aServiceId,
|
|
const BluetoothGattId& aCharacteristicId,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattClientReadCharacteristicValueRequest(aAppUuid,
|
|
aServiceId,
|
|
aCharacteristicId));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattClientWriteCharacteristicValueInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothGattServiceId& aServiceId,
|
|
const BluetoothGattId& aCharacteristicId,
|
|
const BluetoothGattWriteType& aWriteType,
|
|
const nsTArray<uint8_t>& aValue,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattClientWriteCharacteristicValueRequest(aAppUuid,
|
|
aServiceId,
|
|
aCharacteristicId,
|
|
aWriteType,
|
|
aValue));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattClientReadDescriptorValueInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothGattServiceId& aServiceId,
|
|
const BluetoothGattId& aCharacteristicId,
|
|
const BluetoothGattId& aDescriptorId,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattClientReadDescriptorValueRequest(aAppUuid,
|
|
aServiceId,
|
|
aCharacteristicId,
|
|
aDescriptorId));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattClientWriteDescriptorValueInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothGattServiceId& aServiceId,
|
|
const BluetoothGattId& aCharacteristicId,
|
|
const BluetoothGattId& aDescriptorId,
|
|
const nsTArray<uint8_t>& aValue,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattClientWriteDescriptorValueRequest(aAppUuid,
|
|
aServiceId,
|
|
aCharacteristicId,
|
|
aDescriptorId,
|
|
aValue));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerConnectPeripheralInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAddress& aAddress,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerConnectPeripheralRequest(aAppUuid, aAddress));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerDisconnectPeripheralInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAddress& aAddress,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerDisconnectPeripheralRequest(aAppUuid, aAddress));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::UnregisterGattServerInternal(
|
|
int aServerIf, BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable, UnregisterGattServerRequest(aServerIf));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerAddServiceInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothGattServiceId& aServiceId,
|
|
uint16_t aHandleCount,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerAddServiceRequest(aAppUuid, aServiceId, aHandleCount));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerAddIncludedServiceInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAttributeHandle& aServiceHandle,
|
|
const BluetoothAttributeHandle& aIncludedServiceHandle,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerAddIncludedServiceRequest(aAppUuid,
|
|
aServiceHandle,
|
|
aIncludedServiceHandle));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerAddCharacteristicInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAttributeHandle& aServiceHandle,
|
|
const BluetoothUuid& aCharacteristicUuid,
|
|
BluetoothGattAttrPerm aPermissions,
|
|
BluetoothGattCharProp aProperties,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerAddCharacteristicRequest(aAppUuid,
|
|
aServiceHandle,
|
|
aCharacteristicUuid,
|
|
aPermissions,
|
|
aProperties));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerAddDescriptorInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAttributeHandle& aServiceHandle,
|
|
const BluetoothAttributeHandle& aCharacteristicHandle,
|
|
const BluetoothUuid& aDescriptorUuid,
|
|
BluetoothGattAttrPerm aPermissions,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerAddDescriptorRequest(aAppUuid,
|
|
aServiceHandle,
|
|
aCharacteristicHandle,
|
|
aDescriptorUuid,
|
|
aPermissions));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerRemoveServiceInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAttributeHandle& aServiceHandle,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerRemoveServiceRequest(aAppUuid, aServiceHandle));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerStartServiceInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAttributeHandle& aServiceHandle,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerStartServiceRequest(aAppUuid, aServiceHandle));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerStopServiceInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAttributeHandle& aServiceHandle,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerStopServiceRequest(aAppUuid, aServiceHandle));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerSendResponseInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAddress& aAddress,
|
|
uint16_t aStatus,
|
|
int32_t aRequestId,
|
|
const BluetoothGattResponse& aRsp,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerSendResponseRequest(aAppUuid,
|
|
aAddress,
|
|
aStatus,
|
|
aRequestId,
|
|
aRsp));
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::GattServerSendIndicationInternal(
|
|
const BluetoothUuid& aAppUuid,
|
|
const BluetoothAddress& aAddress,
|
|
const BluetoothAttributeHandle& aCharacteristicHandle,
|
|
bool aConfirm,
|
|
const nsTArray<uint8_t>& aValue,
|
|
BluetoothReplyRunnable* aRunnable)
|
|
{
|
|
SendRequest(aRunnable,
|
|
GattServerSendIndicationRequest(aAppUuid,
|
|
aAddress,
|
|
aCharacteristicHandle,
|
|
aConfirm,
|
|
aValue));
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::HandleStartup()
|
|
{
|
|
// Don't need to do anything here for startup since our Create function takes
|
|
// care of the actor machinery.
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::HandleShutdown()
|
|
{
|
|
// If this process is shutting down then we need to disconnect ourselves from
|
|
// the parent.
|
|
if (sBluetoothChild) {
|
|
sBluetoothChild->BeginShutdown();
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::SendSinkMessage(const nsAString& aDeviceAddresses,
|
|
const nsAString& aMessage)
|
|
{
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
nsresult
|
|
BluetoothServiceChildProcess::SendInputMessage(const nsAString& aDeviceAddresses,
|
|
const nsAString& aMessage)
|
|
{
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|
|
void
|
|
BluetoothServiceChildProcess::UpdatePlayStatus(uint32_t aDuration,
|
|
uint32_t aPosition,
|
|
ControlPlayStatus aPlayStatus)
|
|
{
|
|
MOZ_CRASH("This should never be called!");
|
|
}
|
|
|