Backed out 3 changesets (bug 1180556, bug 1180555, bug 1180554) for test_interfaces.html failures.

Backed out changeset 3210b4a21f50 (bug 1180556)
Backed out changeset d08f41259fb9 (bug 1180555)
Backed out changeset ad74716bf6e7 (bug 1180554)
This commit is contained in:
Ryan VanderMeulen 2015-08-19 07:26:50 -04:00
Родитель 46761574a4
Коммит a10daa3bd6
31 изменённых файлов: 41 добавлений и 1880 удалений

Просмотреть файл

@ -851,9 +851,6 @@ GK_ATOM(onpopuphiding, "onpopuphiding")
GK_ATOM(onpopupshowing, "onpopupshowing")
GK_ATOM(onpopupshown, "onpopupshown")
GK_ATOM(onpreviewstatechange, "onpreviewstatechange")
GK_ATOM(onpullphonebookreq, "onpullphonebookreq")
GK_ATOM(onpullvcardentryreq, "onpullvcardentryreq")
GK_ATOM(onpullvcardlistingreq, "onpullvcardlistingreq")
GK_ATOM(onpush, "onpush")
GK_ATOM(onpushsubscriptionchange, "onpushsubscriptionchange")
GK_ATOM(onpschange, "onpschange")

Просмотреть файл

@ -199,10 +199,6 @@ DOMInterfaces = {
'mozilla::dom::bluetooth::BluetoothPairingListener',
},
'BluetoothPbapRequestHandle': {
'nativeType': 'mozilla::dom::bluetooth::BluetoothPbapRequestHandle',
},
'BoxObject': {
'resultNotAddRefed': ['element'],
},

Просмотреть файл

@ -213,13 +213,6 @@ extern bool gBluetoothDebugFlag;
*/
#define REQUEST_MEDIA_PLAYSTATUS_ID "requestmediaplaystatus"
/**
* When receiving a PBAP request from a remote device, we'll dispatch an event.
*/
#define PULL_PHONEBOOK_REQ_ID "pullphonebookreq"
#define PULL_VCARD_ENTRY_REQ_ID "pullvcardentryreq"
#define PULL_VCARD_LISTING_REQ_ID "pullvcardlistingreq"
/**
* When the value of a characteristic of a remote BLE device changes, we'll
* dispatch an event

Просмотреть файл

@ -1,182 +0,0 @@
/* -*- 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 "BluetoothCommon.h"
#include "BluetoothPbapRequestHandle.h"
#include "BluetoothReplyRunnable.h"
#include "BluetoothService.h"
#include "mozilla/dom/BluetoothPbapRequestHandleBinding.h"
#include "mozilla/dom/ContentChild.h"
using namespace mozilla;
using namespace dom;
USING_BLUETOOTH_NAMESPACE
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(BluetoothPbapRequestHandle, mOwner)
NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothPbapRequestHandle)
NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothPbapRequestHandle)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothPbapRequestHandle)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
BluetoothPbapRequestHandle::BluetoothPbapRequestHandle(nsPIDOMWindow* aOwner)
: mOwner(aOwner)
{
MOZ_ASSERT(aOwner);
}
BluetoothPbapRequestHandle::~BluetoothPbapRequestHandle()
{
}
already_AddRefed<BluetoothPbapRequestHandle>
BluetoothPbapRequestHandle::Create(nsPIDOMWindow* aOwner)
{
MOZ_ASSERT(aOwner);
nsRefPtr<BluetoothPbapRequestHandle> handle =
new BluetoothPbapRequestHandle(aOwner);
return handle.forget();
}
already_AddRefed<DOMRequest>
BluetoothPbapRequestHandle::ReplyTovCardPulling(Blob& aBlob,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> win = GetParentObject();
if (!win) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsRefPtr<DOMRequest> request = new DOMRequest(win);
nsRefPtr<BluetoothVoidReplyRunnable> result =
new BluetoothVoidReplyRunnable(request);
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// In-process reply
bs->ReplyTovCardPulling(&aBlob, result);
} else {
ContentChild *cc = ContentChild::GetSingleton();
if (!cc) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
BlobChild* actor = cc->GetOrCreateActorForBlob(&aBlob);
if (!actor) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
bs->ReplyTovCardPulling(nullptr, actor, result);
}
return request.forget();
}
already_AddRefed<DOMRequest>
BluetoothPbapRequestHandle::ReplyToPhonebookPulling(Blob& aBlob,
uint16_t phonebookSize,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> win = GetParentObject();
if (!win) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsRefPtr<DOMRequest> request = new DOMRequest(win);
nsRefPtr<BluetoothVoidReplyRunnable> result =
new BluetoothVoidReplyRunnable(request);
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// In-process reply
bs->ReplyToPhonebookPulling(&aBlob, phonebookSize, result);
} else {
ContentChild *cc = ContentChild::GetSingleton();
if (!cc) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
BlobChild* actor = cc->GetOrCreateActorForBlob(&aBlob);
if (!actor) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
bs->ReplyToPhonebookPulling(nullptr, actor, phonebookSize, result);
}
return request.forget();
}
already_AddRefed<DOMRequest>
BluetoothPbapRequestHandle::ReplyTovCardListing(Blob& aBlob,
uint16_t phonebookSize,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> win = GetParentObject();
if (!win) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsRefPtr<DOMRequest> request = new DOMRequest(win);
nsRefPtr<BluetoothVoidReplyRunnable> result =
new BluetoothVoidReplyRunnable(request);
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// In-process reply
bs->ReplyTovCardListing(&aBlob, phonebookSize, result);
} else {
ContentChild *cc = ContentChild::GetSingleton();
if (!cc) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
BlobChild* actor = cc->GetOrCreateActorForBlob(&aBlob);
if (!actor) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
bs->ReplyTovCardListing(nullptr, actor, phonebookSize, result);
}
return request.forget();
}
JSObject*
BluetoothPbapRequestHandle::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return BluetoothPbapRequestHandleBinding::Wrap(aCx, this, aGivenProto);
}

Просмотреть файл

@ -1,62 +0,0 @@
/* -*- 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/. */
#ifndef mozilla_dom_bluetooth_bluetoothpbaprequesthandle_h
#define mozilla_dom_bluetooth_bluetoothpbaprequesthandle_h
#include "nsCOMPtr.h"
#include "mozilla/dom/DOMRequest.h"
#include "mozilla/dom/BlobSet.h"
namespace mozilla {
class ErrorResult;
namespace dom {
class Blob;
class DOMRequest;
}
}
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothPbapRequestHandle final : public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BluetoothPbapRequestHandle)
static already_AddRefed<BluetoothPbapRequestHandle>
Create(nsPIDOMWindow* aOwner);
nsPIDOMWindow* GetParentObject() const
{
return mOwner;
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
already_AddRefed<DOMRequest> ReplyTovCardPulling(Blob& aBlob,
ErrorResult& aRv);
already_AddRefed<DOMRequest> ReplyToPhonebookPulling(Blob& aBlob,
uint16_t phonebookSize,
ErrorResult& aRv);
already_AddRefed<DOMRequest> ReplyTovCardListing(Blob& aBlob,
uint16_t phonebookSize,
ErrorResult& aRv);
private:
BluetoothPbapRequestHandle(nsPIDOMWindow* aOwner);
~BluetoothPbapRequestHandle();
nsCOMPtr<nsPIDOMWindow> mOwner;
};
END_BLUETOOTH_NAMESPACE
#endif // mozilla_dom_bluetooth_bluetoothpbaprequesthandle_h

Просмотреть файл

@ -20,14 +20,14 @@ AppendHeader(uint8_t aHeaderId, uint8_t* aRetBuf, int aBufferSize,
const uint8_t* aData, int aLength)
{
int headerLength = aLength + 3;
int writtenLength = (headerLength < aBufferSize) ? headerLength : aBufferSize;
aRetBuf[0] = aHeaderId;
aRetBuf[1] = (headerLength & 0xFF00) >> 8;
aRetBuf[2] = headerLength & 0x00FF;
memcpy(&aRetBuf[3], aData, writtenLength - 3);
memcpy(&aRetBuf[3], aData, (aLength < aBufferSize - 3) ? aLength
: aBufferSize - 3);
return writtenLength;
return headerLength;
}
/**
@ -73,34 +73,6 @@ AppendHeaderWho(uint8_t* aRetBuf, int aBufferSize, const uint8_t* aWho,
aWho, aLength);
}
int
AppendHeaderAppParameters(uint8_t* aRetBuf, int aBufferSize,
const uint8_t* aAppParameters, int aLength)
{
return AppendHeader(ObexHeaderId::AppParameters, aRetBuf, aBufferSize,
aAppParameters, aLength);
}
int
AppendAppParameter(uint8_t* aRetBuf, int aBufferSize, const uint8_t aTagId,
const uint8_t* aValue, int aLength)
{
// An application parameter is a [tag]-[length]-[value] triplet. The [tag] and
// [length] fields are 1-byte length each.
if (aBufferSize < aLength + 2) {
// aBufferSize should be larger than size of AppParameter + header.
BT_WARNING("Return buffer size is too small for the AppParameter");
return 0;
}
aRetBuf[0] = aTagId;
aRetBuf[1] = aLength;
memcpy(&aRetBuf[2], aValue, aLength);
return aLength + 2;
}
int
AppendHeaderLength(uint8_t* aRetBuf, int aObjectLength)
{

Просмотреть файл

@ -15,27 +15,6 @@ BEGIN_BLUETOOTH_NAMESPACE
const char FINAL_BIT = 0x80;
/**
* Section 3.2 "Response format", IrOBEX ver 1.2
* The format of an OBEX response header is
* [response code:1][response length:2]
*/
static const uint32_t kObexRespHeaderSize = 3;
/**
* Section 2.2.9 "Body, End-of-Body", IrOBEX ver 1.2
* The format of an OBEX Body header is
* [headerId:1][header length:2]
*/
static const uint32_t kObexBodyHeaderSize = 3;
/**
* Section 3.3.1.4 "Minimum OBEX Packet Length", IrOBEX ver 1.2
* The minimum size of the OBEX Maximum packet length allowed for negotiation is
* 255 bytes.
*/
static const uint32_t kObexLeastMaxSize = 255;
/*
* Defined in section 2.1 "OBEX Headers", IrOBEX ver 1.2
*/
@ -272,8 +251,7 @@ public:
}
/**
* Get a specified parameter from the 'Application Parameters' header with
* big-endian byte ordering.
* Get a specified parameter from the 'Application Parameters' header.
*
* @param aTagId [in] The tag ID of parameter which is defined by
* applications or upper protocol layer.
@ -345,10 +323,6 @@ int AppendHeaderBody(uint8_t* aRetBuf, int aBufferSize, const uint8_t* aBody,
int aLength);
int AppendHeaderWho(uint8_t* aRetBuf, int aBufferSize, const uint8_t* aWho,
int aLength);
int AppendHeaderAppParameters(uint8_t* aRetBuf, int aBufferSize,
const uint8_t* aAppParameters, int aLength);
int AppendAppParameter(uint8_t* aRetBuf, int aBufferSize, const uint8_t aTagId,
const uint8_t* aValue, int aLength);
int AppendHeaderLength(uint8_t* aRetBuf, int aObjectLength);
int AppendHeaderConnectionId(uint8_t* aRetBuf, int aConnectionId);
int AppendHeaderEndOfBody(uint8_t* aRetBuf);

Просмотреть файл

@ -12,12 +12,10 @@
#include "BluetoothUuid.h"
#include "ObexBase.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "nsAutoPtr.h"
#include "nsIInputStream.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
@ -76,8 +74,6 @@ BluetoothPbapManager::HandleShutdown()
}
BluetoothPbapManager::BluetoothPbapManager() : mConnected(false)
, mRemoteMaxPacketLength(0)
, mRequirePhonebookSize(false)
{
mDeviceAddress.AssignLiteral(BLUETOOTH_ADDRESS_NONE);
mCurrentPath.AssignLiteral("");
@ -221,17 +217,6 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
return;
}
// Save the max packet length from remote information
mRemoteMaxPacketLength = ((static_cast<int>(data[5]) << 8) | data[6]);
if (mRemoteMaxPacketLength < kObexLeastMaxSize) {
BT_LOGR("Remote maximum packet length %d is smaller than %d bytes",
mRemoteMaxPacketLength, kObexLeastMaxSize);
mRemoteMaxPacketLength = 0;
ReplyError(ObexResponseCode::BadRequest);
return;
}
ReplyToConnect();
AfterPbapConnected();
break;
@ -250,80 +235,29 @@ BluetoothPbapManager::ReceiveSocketData(BluetoothSocket* aSocket,
AfterPbapDisconnected();
break;
case ObexRequestCode::SetPath: {
// Section 3.3.6 "SetPath", IrOBEX 1.2
// [opcode:1][length:2][flags:1][contants:1][Headers:var]
if (receivedLength < 5 ||
!ParseHeaders(&data[5], receivedLength - 5, &pktHeaders)) {
ReplyError(ObexResponseCode::BadRequest);
return;
}
uint8_t response = SetPhoneBookPath(data[3], pktHeaders);
if (response != ObexResponseCode::Success) {
ReplyError(response);
return;
}
ReplyToSetPath();
break;
}
case ObexRequestCode::Get:
// Section 6.2.2 "OBEX Headers in Multi-Packet Responses", IrOBEX 1.2
// All OBEX request messages shall be sent as one OBEX packet containing
// all of the headers. I.e. OBEX GET with opcode 0x83 shall always be
// used. OBEX GET with opcode 0x03 shall never be used.
BT_WARNING("PBAP shall always uses OBEX GetFinal instead of Get.");
// no break. Treat 'Get' as 'GetFinal' for error tolerance.
case ObexRequestCode::GetFinal: {
// As long as 'mVCardDataStream' requires multiple response packets to
// complete, the client should continue to issue GET requests until the
// final body information (in an End-of-Body header) arrives, along with
// the response code 0xA0 Success.
if (mVCardDataStream) {
if (!ReplyToGet(mVCardDataStream)) {
BT_WARNING("Failed to reply to PBAP GET request.");
ReplyError(ObexResponseCode::InternalServerError);
// Section 3.3.6 "SetPath", IrOBEX 1.2
// [opcode:1][length:2][flags:1][contants:1][Headers:var]
if (receivedLength < 5 ||
!ParseHeaders(&data[5], receivedLength - 5, &pktHeaders)) {
ReplyError(ObexResponseCode::BadRequest);
return;
}
return;
}
// Section 3.1 "Request format", IrOBEX 1.2
// The format of an OBEX request is
// [opcode:1][length:2][Headers:var]
if (receivedLength < 3 ||
!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
ReplyError(ObexResponseCode::BadRequest);
return;
}
uint8_t response = SetPhoneBookPath(data[3], pktHeaders);
if (response != ObexResponseCode::Success) {
ReplyError(response);
return;
}
nsString type;
pktHeaders.GetContentType(type);
uint8_t response;
if (type.EqualsLiteral("x-bt/vcard-listing")) {
response = PullvCardListing(pktHeaders);
} else if (type.EqualsLiteral("x-bt/vcard")) {
response = PullvCardEntry(pktHeaders);
} else if (type.EqualsLiteral("x-bt/phonebook")) {
response = PullPhonebook(pktHeaders);
} else {
response = ObexResponseCode::BadRequest;
BT_LOGR("Unknown PBAP request type: %s",
NS_ConvertUTF16toUTF8(type).get());
}
// The OBEX success response will be sent after Gaia replies the PBAP
// request.
if (response != ObexResponseCode::Success) {
ReplyError(response);
return;
ReplyToSetPath();
}
break;
}
case ObexRequestCode::Put:
case ObexRequestCode::PutFinal:
case ObexRequestCode::Get:
case ObexRequestCode::GetFinal:
ReplyError(ObexResponseCode::BadRequest);
BT_LOGR("Unsupported ObexRequestCode %x", opCode);
break;
default:
ReplyError(ObexResponseCode::NotImplemented);
@ -413,246 +347,6 @@ BluetoothPbapManager::SetPhoneBookPath(uint8_t flags,
return ObexResponseCode::Success;
}
uint8_t
BluetoothPbapManager::PullPhonebook(const ObexHeaderSet& aHeader)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
return ObexResponseCode::PreconditionFailed;
}
InfallibleTArray<BluetoothNamedValue> data;
nsString name;
aHeader.GetName(name);
BT_APPEND_NAMED_VALUE(data, "name", name);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::Format);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::PropertySelector);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::MaxListCount);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::ListStartOffset);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::vCardSelector);
#ifdef MOZ_B2G_BT_API_V1
bs->DistributeSignal(
BluetoothSignal(NS_LITERAL_STRING(PULL_PHONEBOOK_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data));
#else
bs->DistributeSignal(NS_LITERAL_STRING(PULL_PHONEBOOK_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data);
#endif
return ObexResponseCode::Success;
}
uint8_t
BluetoothPbapManager::PullvCardListing(const ObexHeaderSet& aHeader)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
return ObexResponseCode::PreconditionFailed;
}
InfallibleTArray<BluetoothNamedValue> data;
nsString name;
aHeader.GetName(name);
BT_APPEND_NAMED_VALUE(data, "name", name);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::Order);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::SearchValue);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::SearchProperty);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::MaxListCount);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::ListStartOffset);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::vCardSelector);
#ifdef MOZ_B2G_BT_API_V1
bs->DistributeSignal(
BluetoothSignal(NS_LITERAL_STRING(PULL_VCARD_LISTING_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data));
#else
bs->DistributeSignal(NS_LITERAL_STRING(PULL_VCARD_LISTING_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data);
#endif
return ObexResponseCode::Success;
}
uint8_t
BluetoothPbapManager::PullvCardEntry(const ObexHeaderSet& aHeader)
{
MOZ_ASSERT(NS_IsMainThread());
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
return ObexResponseCode::PreconditionFailed;
}
InfallibleTArray<BluetoothNamedValue> data;
nsString name;
aHeader.GetName(name);
BT_APPEND_NAMED_VALUE(data, "name", name);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::Format);
AppendBtNamedValueByTagId(aHeader, data, AppParameterTag::PropertySelector);
#ifdef MOZ_B2G_BT_API_V1
bs->DistributeSignal(
BluetoothSignal(NS_LITERAL_STRING(PULL_VCARD_ENTRY_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data));
#else
bs->DistributeSignal(NS_LITERAL_STRING(PULL_VCARD_ENTRY_REQ_ID),
NS_LITERAL_STRING(KEY_ADAPTER),
data);
#endif
return ObexResponseCode::Success;
}
void
BluetoothPbapManager::AppendBtNamedValueByTagId(
const ObexHeaderSet& aHeader,
InfallibleTArray<BluetoothNamedValue>& aValues,
const AppParameterTag aTagId)
{
uint8_t buf[64];
switch (aTagId) {
case AppParameterTag::Order: {
if (!aHeader.GetAppParameter(AppParameterTag::Order, buf, 64)) {
break;
}
static const nsString sOrderStr[] = {NS_LITERAL_STRING("alphanumeric"),
NS_LITERAL_STRING("indexed"),
NS_LITERAL_STRING("phonetical")};
uint8_t order = buf[0];
if (order < MOZ_ARRAY_LENGTH(sOrderStr)) {
BT_APPEND_NAMED_VALUE(aValues, "order", sOrderStr[order]);
} else {
BT_WARNING("%s: Unexpected value '%d' of 'Order'", __FUNCTION__, order);
}
break;
}
case AppParameterTag::SearchValue: {
if (!aHeader.GetAppParameter(AppParameterTag::SearchValue, buf, 64)) {
break;
}
// Section 5.3.4.3 "SearchValue {<text string>}", PBAP 1.2
// The UTF-8 character set shall be used for <text string>.
// Use nsCString to store UTF-8 string here to follow the suggestion of
// 'MDN:Internal_strings'.
nsCString text((char *) buf);
BT_APPEND_NAMED_VALUE(aValues, "searchText", text);
break;
}
case AppParameterTag::SearchProperty: {
if (!aHeader.GetAppParameter(AppParameterTag::SearchProperty, buf, 64)) {
break;
}
static const nsString sSearchKeyStr[] = {NS_LITERAL_STRING("name"),
NS_LITERAL_STRING("number"),
NS_LITERAL_STRING("sound")};
uint8_t searchKey = buf[0];
if (searchKey < MOZ_ARRAY_LENGTH(sSearchKeyStr)) {
BT_APPEND_NAMED_VALUE(aValues, "searchKey", sSearchKeyStr[searchKey]);
} else {
BT_WARNING("%s: Unexpected value '%d' of 'SearchProperty'",
__FUNCTION__, searchKey);
}
break;
}
case AppParameterTag::MaxListCount: {
if (!aHeader.GetAppParameter(AppParameterTag::MaxListCount, buf, 64)) {
break;
}
uint16_t maxListCount = *((uint16_t *)buf);
// convert big endian to little endian
maxListCount = (maxListCount >> 8) | (maxListCount << 8);
// Section 5 "Phone Book Access Profile Functions", PBAP 1.2
// Replying 'PhonebookSize' is mandatory if 'MaxListCount' parameter is
// present in the request with a value of 0, else it is excluded.
mRequirePhonebookSize = !maxListCount;
BT_APPEND_NAMED_VALUE(aValues, "maxListCount", (uint32_t) maxListCount);
break;
}
case AppParameterTag::ListStartOffset: {
if (!aHeader.GetAppParameter(AppParameterTag::ListStartOffset, buf, 64)) {
break;
}
uint16_t listStartOffset = *((uint16_t *)buf);
// convert big endian to little endian
listStartOffset = (listStartOffset >> 8) | (listStartOffset << 8);
BT_APPEND_NAMED_VALUE(aValues, "listStartOffset",
(uint32_t) listStartOffset);
break;
}
case AppParameterTag::PropertySelector: {
if (!aHeader.GetAppParameter(
AppParameterTag::PropertySelector, buf, 64)) {
break;
}
InfallibleTArray<uint32_t> props = PackPropertiesMask(buf, 64);
BT_APPEND_NAMED_VALUE(aValues, "propSelector", props);
break;
}
case AppParameterTag::Format: {
if (!aHeader.GetAppParameter(AppParameterTag::Format, buf, 64)) {
break;
}
bool usevCard3 = buf[0];
BT_APPEND_NAMED_VALUE(aValues, "format", usevCard3);
break;
}
case AppParameterTag::vCardSelector: {
if (!aHeader.GetAppParameter(AppParameterTag::vCardSelector, buf, 64)) {
break;
}
InfallibleTArray<uint32_t> props = PackPropertiesMask(buf, 64);
bool hasVCardSelectorOperator = aHeader.GetAppParameter(
AppParameterTag::vCardSelectorOperator, buf, 64);
if (hasVCardSelectorOperator && buf[0]) {
BT_APPEND_NAMED_VALUE(aValues, "vCardSelector_AND",
BluetoothValue(props));
} else {
BT_APPEND_NAMED_VALUE(aValues, "vCardSelector_OR",
BluetoothValue(props));
}
break;
}
default:
BT_LOGR("Unsupported AppParameterTag: %x", aTagId);
break;
}
}
bool
BluetoothPbapManager::IsLegalPath(const nsAString& aPath)
{
@ -694,14 +388,6 @@ void
BluetoothPbapManager::AfterPbapDisconnected()
{
mConnected = false;
mRemoteMaxPacketLength = 0;
mRequirePhonebookSize = false;
if (mVCardDataStream) {
mVCardDataStream->Close();
mVCardDataStream = nullptr;
}
}
bool
@ -726,21 +412,21 @@ BluetoothPbapManager::ReplyToConnect()
// Section 3.3.1 "Connect", IrOBEX 1.2
// [opcode:1][length:2][version:1][flags:1][MaxPktSizeWeCanReceive:2]
// [Headers:var]
uint8_t res[kObexLeastMaxSize];
uint8_t req[255];
int index = 7;
res[3] = 0x10; // version=1.0
res[4] = 0x00; // flag=0x00
res[5] = BluetoothPbapManager::MAX_PACKET_LENGTH >> 8;
res[6] = (uint8_t)BluetoothPbapManager::MAX_PACKET_LENGTH;
req[3] = 0x10; // version=1.0
req[4] = 0x00; // flag=0x00
req[5] = BluetoothPbapManager::MAX_PACKET_LENGTH >> 8;
req[6] = (uint8_t)BluetoothPbapManager::MAX_PACKET_LENGTH;
// Section 6.4 "Establishing an OBEX Session", PBAP 1.2
// Headers: [Who:16][Connection ID]
index += AppendHeaderWho(&res[index], kObexLeastMaxSize,
kPbapObexTarget.mUuid, sizeof(BluetoothUuid));
index += AppendHeaderConnectionId(&res[index], 0x01);
index += AppendHeaderWho(&req[index], 255, kPbapObexTarget.mUuid,
sizeof(BluetoothUuid));
index += AppendHeaderConnectionId(&req[index], 0x01);
SendObexData(res, ObexResponseCode::Success, index);
SendObexData(req, ObexResponseCode::Success, index);
}
void
@ -753,10 +439,10 @@ BluetoothPbapManager::ReplyToDisconnectOrAbort()
// Section 3.3.2 "Disconnect" and Section 3.3.5 "Abort", IrOBEX 1.2
// The format of response packet of "Disconnect" and "Abort" are the same
// [opcode:1][length:2][Headers:var]
uint8_t res[kObexLeastMaxSize];
int index = kObexRespHeaderSize;
uint8_t req[255];
int index = 3;
SendObexData(res, ObexResponseCode::Success, index);
SendObexData(req, ObexResponseCode::Success, index);
}
void
@ -768,216 +454,10 @@ BluetoothPbapManager::ReplyToSetPath()
// Section 3.3.6 "SetPath", IrOBEX 1.2
// [opcode:1][length:2][Headers:var]
uint8_t res[kObexLeastMaxSize];
int index = kObexRespHeaderSize;
uint8_t req[255];
int index = 3;
SendObexData(res, ObexResponseCode::Success, index);
}
InfallibleTArray<uint32_t>
BluetoothPbapManager::PackPropertiesMask(uint8_t* aData, int aSize)
{
InfallibleTArray<uint32_t> propSelector;
// Table 5.1 "Property Mask", PBAP 1.2
// PropertyMask is a 64-bit mask that indicates the properties contained in
// the requested vCard objects. We only support bit 0~31 since the rest are
// reserved for future use or vendor specific properties.
// convert big endian to little endian
uint32_t x = (aData[7] << 0) | (aData[6] << 8) |
(aData[5] << 16) | (aData[4] << 24);
uint32_t count = 0;
while (!x) {
if (x & 1) {
propSelector.AppendElement(count);
}
++count;
x >>= 1;
}
return propSelector;
}
bool
BluetoothPbapManager::ReplyToPullPhonebook(BlobParent* aActor,
uint16_t aPhonebookSize)
{
nsRefPtr<BlobImpl> impl = aActor->GetBlobImpl();
nsRefPtr<Blob> blob = Blob::Create(nullptr, impl);
return ReplyToPullPhonebook(blob.get(), aPhonebookSize);
}
bool
BluetoothPbapManager::ReplyToPullPhonebook(Blob* aBlob, uint16_t aPhonebookSize)
{
if (!mConnected) {
return false;
}
if (!GetInputStreamFromBlob(mVCardDataStream, aBlob)) {
ReplyError(ObexResponseCode::InternalServerError);
return false;
}
return ReplyToGet(mVCardDataStream, aPhonebookSize);
}
bool
BluetoothPbapManager::ReplyToPullvCardListing(BlobParent* aActor,
uint16_t aPhonebookSize)
{
nsRefPtr<BlobImpl> impl = aActor->GetBlobImpl();
nsRefPtr<Blob> blob = Blob::Create(nullptr, impl);
return ReplyToPullvCardListing(blob.get(), aPhonebookSize);
}
bool
BluetoothPbapManager::ReplyToPullvCardListing(Blob* aBlob,
uint16_t aPhonebookSize)
{
if (!mConnected) {
return false;
}
if (!GetInputStreamFromBlob(mVCardDataStream, aBlob)) {
ReplyError(ObexResponseCode::InternalServerError);
return false;
}
return ReplyToGet(mVCardDataStream, aPhonebookSize);
}
bool
BluetoothPbapManager::ReplyToPullvCardEntry(BlobParent* aActor)
{
nsRefPtr<BlobImpl> impl = aActor->GetBlobImpl();
nsRefPtr<Blob> blob = Blob::Create(nullptr, impl);
return ReplyToPullvCardEntry(blob.get());
}
bool
BluetoothPbapManager::ReplyToPullvCardEntry(Blob* aBlob)
{
if (!mConnected) {
return false;
}
if (!GetInputStreamFromBlob(mVCardDataStream, aBlob)) {
ReplyError(ObexResponseCode::InternalServerError);
return false;
}
return ReplyToGet(mVCardDataStream);
}
bool
BluetoothPbapManager::ReplyToGet(nsIInputStream* aStream,
uint16_t aPhonebookSize)
{
MOZ_ASSERT(aStream);
MOZ_ASSERT(mRemoteMaxPacketLength >= kObexLeastMaxSize);
// This response will be composed by these four parts.
// Part 1: [response code:1][length:2]
// Part 2: [headerId:1][length:2][PhonebookSize:4] (optional)
// Part 3: [headerId:1][length:2][Body:var]
// Part 4: [headerId:1][length:2][EndOfBody:0] (optional)
uint8_t* res = new uint8_t[mRemoteMaxPacketLength];
// ---- Part 1, move index for [response code:1][length:2] ---- //
// res[0~2] will be set in SendObexData()
unsigned int index = kObexRespHeaderSize;
// ---- Part 2, add [response code:1][length:2] to response ---- //
if (mRequirePhonebookSize) {
// convert little endian to big endian
uint8_t phonebookSize[2];
phonebookSize[0] = (aPhonebookSize & 0xFF00) >> 8;
phonebookSize[1] = aPhonebookSize & 0x00FF;
// Section 6.2.1 "Application Parameters Header", PBAP 1.2
// appParameters: [headerId:1][length:2][PhonebookSize:4], where
// [PhonebookSize:4] = [tagId:1][length:1][value:2]
uint8_t appParameters[4];
AppendAppParameter(appParameters,
sizeof(appParameters),
(uint8_t) AppParameterTag::PhonebookSize,
phonebookSize,
sizeof(phonebookSize));
index += AppendHeaderAppParameters(&res[index],
mRemoteMaxPacketLength,
appParameters,
sizeof(appParameters));
mRequirePhonebookSize = false;
}
// ---- Part 3, add [headerId:1][length:2][Body:var] to response ---- //
// Remaining packet size to append Body, excluding Body's header
uint32_t remainingPacketSize = mRemoteMaxPacketLength - kObexBodyHeaderSize
- index;
// Read vCard data from input stream
uint32_t numRead = 0;
nsAutoArrayPtr<char> buffer(new char[remainingPacketSize]);
nsresult rv = aStream->Read(buffer, remainingPacketSize, &numRead);
if (NS_FAILED(rv)) {
BT_WARNING("Failed to read from input stream.");
return false;
}
if (numRead) {
index += AppendHeaderBody(&res[index],
remainingPacketSize,
(uint8_t*) buffer.forget(),
numRead);
}
// More GET requests are required if remaining packet size isn't
// enough for 1) number of bytes read and 2) one EndOfBody's header
uint8_t opcode;
if (numRead + kObexBodyHeaderSize > remainingPacketSize) {
opcode = ObexResponseCode::Continue;
} else {
// ---- Part 4, add [headerId:1][length:2][EndOfBody:var] to response --- //
opcode = ObexResponseCode::Success;
index += AppendHeaderEndOfBody(&res[index]);
aStream->Close();
aStream = nullptr;
}
SendObexData(res, opcode, index);
delete [] res;
return true;
}
bool
BluetoothPbapManager::GetInputStreamFromBlob(nsIInputStream* aStream,
Blob* aBlob)
{
// PBAP can only handle one OBEX BODY transfer at the same time.
if (mVCardDataStream) {
BT_WARNING("Shouldn't handle multiple PBAP responses at the same time");
mVCardDataStream->Close();
mVCardDataStream = nullptr;
}
ErrorResult rv;
aBlob->GetInternalStream(getter_AddRefs(mVCardDataStream), rv);
if (NS_WARN_IF(rv.Failed())) {
return false;
}
return true;
SendObexData(req, ObexResponseCode::Success, index);
}
void
@ -986,9 +466,11 @@ BluetoothPbapManager::ReplyError(uint8_t aError)
BT_LOGR("[0x%x]", aError);
// Section 3.2 "Response Format", IrOBEX 1.2
// [response code:1][length:2][data:var]
uint8_t res[kObexLeastMaxSize];
SendObexData(res, aError, kObexBodyHeaderSize);
// [opcode:1][length:2][Headers:var]
uint8_t req[255];
int index = 3;
SendObexData(req, aError, index);
}
void

Просмотреть файл

@ -10,18 +10,8 @@
#include "BluetoothCommon.h"
#include "BluetoothProfileManagerBase.h"
#include "BluetoothSocketObserver.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/ipc/SocketBase.h"
class nsIInputStream;
namespace mozilla {
namespace dom {
class Blob;
class BlobParent;
}
}
BEGIN_BLUETOOTH_NAMESPACE
/*
@ -37,7 +27,6 @@ enum AppParameterTag {
Format = 0x07,
PhonebookSize = 0x08,
NewMissedCalls = 0x09,
// ----- enumerators below are supported since PBAP 1.2 ----- //
PrimaryVersionCounter = 0x0A,
SecondaryVersionCounter = 0x0B,
vCardSelector = 0x0C,
@ -51,7 +40,7 @@ class BluetoothSocket;
class ObexHeaderSet;
class BluetoothPbapManager : public BluetoothSocketObserver
, public BluetoothProfileManagerBase
, public BluetoothProfileManagerBase
{
public:
BT_DECL_PROFILE_MGR_BASE
@ -66,70 +55,6 @@ public:
static BluetoothPbapManager* Get();
bool Listen();
/**
* Reply vCard object to the *IPC* 'pullphonebook' request.
*
* @param aActor [in] a blob actor containing the vCard objects
* @param aPhonebookSize [in] the number of vCard indexes in the blob
*
* @return true if the response packet has been packed correctly and started
* to be sent to the remote device; false otherwise.
*/
bool ReplyToPullPhonebook(BlobParent* aActor, uint16_t aPhonebookSize);
/**
* Reply vCard object to the *in-process* 'pullphonebook' request.
*
* @param aBlob [in] a blob contained the vCard objects
* @param aPhonebookSize [in] the number of vCard indexes in the blob
*
* @return true if the response packet has been packed correctly and started
* to be sent to the remote device; false otherwise.
*/
bool ReplyToPullPhonebook(Blob* aBlob, uint16_t aPhonebookSize);
/**
* Reply vCard object to the *IPC* 'pullvcardlisting' request.
*
* @param aActor [in] a blob actor containing the vCard objects
* @param aPhonebookSize [in] the number of vCard indexes in the blob
*
* @return true if the response packet has been packed correctly and started
* to be sent to the remote device; false otherwise.
*/
bool ReplyToPullvCardListing(BlobParent* aActor, uint16_t aPhonebookSize);
/**
* Reply vCard object to the *in-process* 'pullvcardlisting' request.
*
* @param aBlob [in] a blob contained the vCard objects
* @param aPhonebookSize [in] the number of vCard indexes in the blob
*
* @return true if the response packet has been packed correctly and started
* to be sent to the remote device; false otherwise.
*/
bool ReplyToPullvCardListing(Blob* aBlob, uint16_t aPhonebookSize);
/**
* Reply vCard object to the *IPC* 'pullvcardentry' request.
*
* @param aActor [in] a blob actor containing the vCard objects
*
* @return true if the response packet has been packed correctly and started
* to be sent to the remote device; false otherwise.
*/
bool ReplyToPullvCardEntry(BlobParent* aActor);
/**
* Reply vCard object to the *in-process* 'pullvcardentry' request.
*
* @param aBlob [in] a blob contained the vCard objects
*
* @return true if the response packet has been packed correctly and started
* to be sent to the remote device; false otherwise.
*/
bool ReplyToPullvCardEntry(Blob* aBlob);
protected:
virtual ~BluetoothPbapManager();
@ -143,19 +68,8 @@ private:
void ReplyToSetPath();
void ReplyError(uint8_t aError);
void SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize);
bool ReplyToGet(nsIInputStream* aStream, uint16_t aPhonebookSize = 0);
bool GetInputStreamFromBlob(nsIInputStream* aStream, Blob* aBlob);
uint8_t SetPhoneBookPath(uint8_t flags, const ObexHeaderSet& aHeader);
uint8_t PullPhonebook(const ObexHeaderSet& aHeader);
uint8_t PullvCardListing(const ObexHeaderSet& aHeader);
uint8_t PullvCardEntry(const ObexHeaderSet& aHeader);
void AppendBtNamedValueByTagId(
const ObexHeaderSet& aHeader,
InfallibleTArray<BluetoothNamedValue>& aValues,
const AppParameterTag aTagId);
InfallibleTArray<uint32_t> PackPropertiesMask(uint8_t* aData, int aSize);
bool CompareHeaderTarget(const ObexHeaderSet& aHeader);
bool IsLegalPath(const nsAString& aPath);
void AfterPbapConnected();
@ -172,11 +86,6 @@ private:
bool mConnected;
nsString mDeviceAddress;
/**
* Maximum packet length that remote device can receive
*/
unsigned int mRemoteMaxPacketLength;
// If a connection has been established, mSocket will be the socket
// communicating with the remote socket. We maintain the invariant that if
// mSocket is non-null, mServerSocket must be null (and vice versa).
@ -186,17 +95,6 @@ private:
// over the ownership to mSocket, and get a new server socket while Listen()
// is called.
nsRefPtr<BluetoothSocket> mServerSocket;
/**
* The data stream of vCards which is used in current processing response.
*/
nsCOMPtr<nsIInputStream> mVCardDataStream;
/**
* A flag to indicate whether 'PhonebookSize' is mandatory for next OBEX
* response
*/
bool mRequirePhonebookSize;
};
END_BLUETOOTH_NAMESPACE

Просмотреть файл

@ -1125,109 +1125,6 @@ BluetoothServiceBluedroid::IsScoConnected(BluetoothReplyRunnable* aRunnable)
DispatchReplySuccess(aRunnable, BluetoothValue(hfp->IsScoConnected()));
}
void
BluetoothServiceBluedroid::ReplyTovCardPulling(
BlobParent* aBlobParent,
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable)
{
BluetoothPbapManager* pbap = BluetoothPbapManager::Get();
if (!pbap) {
DispatchReplyError(aRunnable,
NS_LITERAL_STRING("Reply to vCardPulling failed"));
return;
}
pbap->ReplyToPullvCardEntry(aBlobParent);
DispatchReplySuccess(aRunnable);
}
void
BluetoothServiceBluedroid::ReplyTovCardPulling(
Blob* aBlob,
BluetoothReplyRunnable* aRunnable)
{
BluetoothPbapManager* pbap = BluetoothPbapManager::Get();
if (!pbap) {
DispatchReplyError(aRunnable,
NS_LITERAL_STRING("Reply to vCardPulling failed"));
return;
}
pbap->ReplyToPullvCardEntry(aBlob);
DispatchReplySuccess(aRunnable);
}
void
BluetoothServiceBluedroid::ReplyToPhonebookPulling(
BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
BluetoothPbapManager* pbap = BluetoothPbapManager::Get();
if (!pbap) {
DispatchReplyError(aRunnable,
NS_LITERAL_STRING("Reply to Phonebook Pulling failed"));
return;
}
pbap->ReplyToPullPhonebook(aBlobParent, aPhonebookSize);
DispatchReplySuccess(aRunnable);
}
void
BluetoothServiceBluedroid::ReplyToPhonebookPulling(
Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
BluetoothPbapManager* pbap = BluetoothPbapManager::Get();
if (!pbap) {
DispatchReplyError(aRunnable,
NS_LITERAL_STRING("Reply to Phonebook Pulling failed"));
return;
}
pbap->ReplyToPullPhonebook(aBlob, aPhonebookSize);
DispatchReplySuccess(aRunnable);
}
void
BluetoothServiceBluedroid::ReplyTovCardListing(
BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
BluetoothPbapManager* pbap = BluetoothPbapManager::Get();
if (!pbap) {
DispatchReplyError(aRunnable,
NS_LITERAL_STRING("Reply to vCard Listing failed"));
return;
}
pbap->ReplyToPullvCardListing(aBlobParent, aPhonebookSize);
DispatchReplySuccess(aRunnable);
}
void
BluetoothServiceBluedroid::ReplyTovCardListing(
Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
BluetoothPbapManager* pbap = BluetoothPbapManager::Get();
if (!pbap) {
DispatchReplyError(aRunnable,
NS_LITERAL_STRING("Reply to vCard Listing failed"));
return;
}
pbap->ReplyToPullvCardListing(aBlob, aPhonebookSize);
DispatchReplySuccess(aRunnable);
}
void
BluetoothServiceBluedroid::SendMetaData(const nsAString& aTitle,
const nsAString& aArtist,

Просмотреть файл

@ -142,37 +142,6 @@ public:
virtual void
IsScoConnected(BluetoothReplyRunnable* aRunnable);
virtual void
ReplyTovCardPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable);
virtual void
ReplyTovCardPulling(Blob* aBlob,
BluetoothReplyRunnable* aRunnable);
virtual void
ReplyToPhonebookPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable);
virtual void
ReplyToPhonebookPulling(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable);
virtual void
ReplyTovCardListing(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable);
virtual void
ReplyTovCardListing(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable);
virtual void
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable);

Просмотреть файл

@ -16,10 +16,7 @@
#include "mozilla/dom/BluetoothAdapterBinding.h"
#include "mozilla/dom/BluetoothAttributeEvent.h"
#include "mozilla/dom/BluetoothPhonebookPullingEvent.h"
#include "mozilla/dom/BluetoothStatusChangedEvent.h"
#include "mozilla/dom/BluetoothVCardListingEvent.h"
#include "mozilla/dom/BluetoothVCardPullingEvent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/File.h"
@ -30,7 +27,6 @@
#include "mozilla/dom/bluetooth/BluetoothDiscoveryHandle.h"
#include "mozilla/dom/bluetooth/BluetoothGattServer.h"
#include "mozilla/dom/bluetooth/BluetoothPairingListener.h"
#include "mozilla/dom/bluetooth/BluetoothPbapRequestHandle.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
using namespace mozilla;
@ -528,12 +524,6 @@ BluetoothAdapter::Notify(const BluetoothSignal& aData)
} else if (aData.name().EqualsLiteral(PAIRING_ABORTED_ID) ||
aData.name().EqualsLiteral(REQUEST_MEDIA_PLAYSTATUS_ID)) {
DispatchEmptyEvent(aData.name());
} else if (aData.name().EqualsLiteral(PULL_PHONEBOOK_REQ_ID)) {
HandlePullPhonebookReq(aData.value());
} else if (aData.name().EqualsLiteral(PULL_VCARD_ENTRY_REQ_ID)) {
HandlePullVCardEntryReq(aData.value());
} else if (aData.name().EqualsLiteral(PULL_VCARD_LISTING_REQ_ID)) {
HandlePullVCardListingReq(aData.value());
} else {
BT_WARNING("Not handling adapter signal: %s",
NS_ConvertUTF16toUTF8(aData.name()).get());
@ -1200,178 +1190,6 @@ BluetoothAdapter::HandleDeviceUnpaired(const BluetoothValue& aValue)
DispatchDeviceEvent(NS_LITERAL_STRING(DEVICE_UNPAIRED_ID), init);
}
void
BluetoothAdapter::HandlePullPhonebookReq(const BluetoothValue& aValue)
{
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
const InfallibleTArray<BluetoothNamedValue>& arr =
aValue.get_ArrayOfBluetoothNamedValue();
MOZ_ASSERT(arr.Length() >= 1 &&
arr[0].value().type() == BluetoothValue::TnsString);
BluetoothPhonebookPullingEventInit init;
for (uint32_t i = 0, propCount = arr.Length(); i < propCount; ++i) {
const nsString& name = arr[i].name();
const BluetoothValue& value = arr[i].value();
if (name.EqualsLiteral("name")) {
init.mName = value.get_nsString();
} else if (name.EqualsLiteral("format")) {
init.mFormat = value.get_bool() ? vCardVersion::VCard30
: vCardVersion::VCard21;
} else if (name.EqualsLiteral("propSelector")) {
init.mPropSelector = getVCardProperties(value);
} else if (name.EqualsLiteral("maxListCount")) {
init.mMaxListCount = value.get_uint32_t();
} else if (name.EqualsLiteral("listStartOffset")) {
init.mListStartOffset = value.get_uint32_t();
} else if (name.EqualsLiteral("vCardSelector_AND")) {
init.mVcardSelector = getVCardProperties(value);
init.mVcardSelectorOperator = vCardSelectorOp::AND;
} else if (name.EqualsLiteral("vCardSelector_OR")) {
init.mVcardSelector = getVCardProperties(value);
init.mVcardSelectorOperator = vCardSelectorOp::OR;
}
}
init.mHandle = BluetoothPbapRequestHandle::Create(GetOwner());
nsRefPtr<BluetoothPhonebookPullingEvent> event =
BluetoothPhonebookPullingEvent::Constructor(this,
NS_LITERAL_STRING(PULL_PHONEBOOK_REQ_ID), init);
DispatchTrustedEvent(event);
}
void
BluetoothAdapter::HandlePullVCardEntryReq(const BluetoothValue& aValue)
{
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
const InfallibleTArray<BluetoothNamedValue>& arr =
aValue.get_ArrayOfBluetoothNamedValue();
MOZ_ASSERT(arr.Length() >= 1 &&
arr[0].value().type() == BluetoothValue::TnsString);
BluetoothVCardPullingEventInit init;
Sequence<vCardProperties> propSelector;
for (uint32_t i = 0, propCount = arr.Length(); i < propCount; ++i) {
const nsString& name = arr[i].name();
const BluetoothValue& value = arr[i].value();
if (name.EqualsLiteral("name")) {
init.mName = value.get_nsString();
} else if (name.EqualsLiteral("format")) {
init.mFormat = value.get_bool() ? vCardVersion::VCard30
: vCardVersion::VCard21;
} else if (name.EqualsLiteral("propSelector")) {
init.mPropSelector = getVCardProperties(value);
}
}
init.mHandle = BluetoothPbapRequestHandle::Create(GetOwner());
nsRefPtr<BluetoothVCardPullingEvent> event =
BluetoothVCardPullingEvent::Constructor(this,
NS_LITERAL_STRING(PULL_VCARD_ENTRY_REQ_ID), init);
DispatchTrustedEvent(event);
}
void
BluetoothAdapter::HandlePullVCardListingReq(const BluetoothValue& aValue)
{
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
const InfallibleTArray<BluetoothNamedValue>& arr =
aValue.get_ArrayOfBluetoothNamedValue();
MOZ_ASSERT(arr.Length() >= 1 &&
arr[0].value().type() == BluetoothValue::TnsString);
BluetoothVCardListingEventInit init;
for (uint32_t i = 0, propCount = arr.Length(); i < propCount; ++i) {
const nsString& name = arr[i].name();
const BluetoothValue& value = arr[i].value();
if (name.EqualsLiteral("name")) {
init.mName = value.get_nsString();
} else if (name.EqualsLiteral("order")) {
init.mOrder = ConvertStringToVCardOrderType(value.get_nsString());
} else if (name.EqualsLiteral("searchText")) {
init.mSearchValue = value.get_nsString();
} else if (name.EqualsLiteral("searchKey")) {
init.mSearchKey = ConvertStringToVCardSearchKeyType(value.get_nsString());
} else if (name.EqualsLiteral("maxListCount")) {
init.mMaxListCount = value.get_uint32_t();
} else if (name.EqualsLiteral("listStartOffset")) {
init.mListStartOffset = value.get_uint32_t();
} else if (name.EqualsLiteral("vCardSelector_AND")) {
init.mVcardSelector = getVCardProperties(value);
init.mVcardSelectorOperator = vCardSelectorOp::AND;
} else if (name.EqualsLiteral("vCardSelector_OR")) {
init.mVcardSelector = getVCardProperties(value);
init.mVcardSelectorOperator = vCardSelectorOp::OR;
}
}
init.mHandle = BluetoothPbapRequestHandle::Create(GetOwner());
nsRefPtr<BluetoothVCardListingEvent> event =
BluetoothVCardListingEvent::Constructor(this,
NS_LITERAL_STRING(PULL_VCARD_LISTING_REQ_ID), init);
DispatchTrustedEvent(event);
}
Sequence<vCardProperties>
BluetoothAdapter::getVCardProperties(const BluetoothValue &aValue)
{
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfuint32_t);
Sequence<vCardProperties> propSelector;
const InfallibleTArray<uint32_t>& propSelectorArr =
aValue.get_ArrayOfuint32_t();
for (uint32_t i = 0; i < propSelectorArr.Length(); ++i) {
propSelector.AppendElement(
static_cast<vCardProperties>(propSelectorArr[i]), mozilla::fallible);
}
return propSelector;
}
vCardOrderType
BluetoothAdapter::ConvertStringToVCardOrderType(const nsAString& aString)
{
using namespace mozilla::dom::vCardOrderTypeValues;
for (size_t index = 0; index < ArrayLength(strings) - 1; index++) {
if (aString.LowerCaseEqualsASCII(strings[index].value,
strings[index].length)) {
return static_cast<vCardOrderType>(index);
}
}
BT_WARNING("Treat the unexpected string '%s' as vCardOrderType::Indexed",
NS_ConvertUTF16toUTF8(aString).get());
return vCardOrderType::Indexed; // The default value is 'Indexed'.
}
vCardSearchKeyType
BluetoothAdapter::ConvertStringToVCardSearchKeyType(const nsAString& aString)
{
using namespace mozilla::dom::vCardSearchKeyTypeValues;
for (size_t index = 0; index < ArrayLength(strings) - 1; index++) {
if (aString.LowerCaseEqualsASCII(strings[index].value,
strings[index].length)) {
return static_cast<vCardSearchKeyType>(index);
}
}
BT_WARNING("Treat the unexpected string '%s' as vCardSearchKeyType::Name",
NS_ConvertUTF16toUTF8(aString).get());
return vCardSearchKeyType::Name; // The default value is 'Name'.
}
void
BluetoothAdapter::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
{

Просмотреть файл

@ -12,7 +12,6 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/BluetoothAdapterBinding.h"
#include "mozilla/dom/BluetoothDeviceEvent.h"
#include "mozilla/dom/BluetoothPbapParametersBinding.h"
#include "mozilla/dom/Promise.h"
#include "nsCOMPtr.h"
@ -90,9 +89,6 @@ public:
IMPL_EVENT_HANDLER(pairingaborted);
IMPL_EVENT_HANDLER(a2dpstatuschanged);
IMPL_EVENT_HANDLER(hfpstatuschanged);
IMPL_EVENT_HANDLER(pullphonebookreq);
IMPL_EVENT_HANDLER(pullvcardentryreq);
IMPL_EVENT_HANDLER(pullvcardlistingreq);
IMPL_EVENT_HANDLER(requestmediaplaystatus);
IMPL_EVENT_HANDLER(scostatuschanged);
@ -290,73 +286,6 @@ private:
*/
void HandleLeDeviceFound(const BluetoothValue& aValue);
/**
* Handle PULL_PHONEBOOK_REQ_ID bluetooth signal.
*
* @param aValue [in] Properties array of the PBAP request.
* The array should contain few properties:
* - nsString 'name'
* - bool 'format'
* - uint32_t[] 'propSelector'
* - uint32_t 'maxListCount'
* - uint32_t 'listStartOffset'
* - uint32_t[] 'vCardSelector_AND'
* - uint32_t[] 'vCardSelector_AND'
*/
void HandlePullPhonebookReq(const BluetoothValue& aValue);
/**
* Handle PULL_VCARD_ENTRY_REQ_ID bluetooth signal.
*
* @param aValue [in] Properties array of the PBAP request.
* The array should contain few properties:
* - nsString 'name'
* - bool 'format'
* - uint32_t[] 'propSelector'
*/
void HandlePullVCardEntryReq(const BluetoothValue& aValue);
/**
* Handle PULL_VCARD_LISTING_REQ_ID bluetooth signal.
*
* @param aValue [in] Properties array of the PBAP request.
* The array should contain few properties:
* - nsString 'name'
* - nsString 'order'
* - nsString 'searchText'
* - nsString 'searchKey'
* - uint32_t 'maxListCount'
* - uint32_t 'listStartOffset'
* - uint32_t[] 'vCardSelector_AND'
* - uint32_t[] 'vCardSelector_AND'
*/
void HandlePullVCardListingReq(const BluetoothValue& aValue);
/**
* Get a Sequence of vCard properies from a BluetoothValue. The name of
* BluetoothValue must be propSelector, vCardSelector_OR or vCardSelector_AND.
*
* @param aValue [in] a BluetoothValue with 'TArrayOfuint32_t' type
* The name of BluetoothValue must be 'propSelector',
* 'vCardSelector_OR' or 'vCardSelector_AND'.
*/
Sequence<vCardProperties> getVCardProperties(const BluetoothValue &aValue);
/**
* Convert string to vCardOrderType.
*
* @param aString [in] String to convert
*/
vCardOrderType ConvertStringToVCardOrderType(const nsAString& aString);
/**
* Convert string to vCardSearchKeyType.
*
* @param aString [in] String to convert
*/
vCardSearchKeyType ConvertStringToVCardSearchKeyType(
const nsAString& aString);
/**
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
*

Просмотреть файл

@ -9,7 +9,6 @@
#include "BluetoothCommon.h"
#include "BluetoothInterface.h"
#include "BluetoothPbapRequestHandle.h"
#include "BluetoothProfileManagerBase.h"
#include "nsAutoPtr.h"
#include "nsClassHashtable.h"
@ -311,37 +310,6 @@ public:
virtual void
IsScoConnected(BluetoothReplyRunnable* aRunnable) = 0;
virtual void
ReplyTovCardPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
ReplyTovCardPulling(Blob* aBlob,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
ReplyToPhonebookPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
ReplyToPhonebookPulling(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
ReplyTovCardListing(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) = 0;
virtual void
ReplyTovCardListing(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) = 0;
#ifdef MOZ_B2G_RIL
virtual void
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) = 0;

Просмотреть файл

@ -246,12 +246,6 @@ BluetoothParent::RecvPBluetoothRequestConstructor(
return actor->DoRequest(aRequest.get_DisconnectScoRequest());
case Request::TIsScoConnectedRequest:
return actor->DoRequest(aRequest.get_IsScoConnectedRequest());
case Request::TReplyTovCardPullingRequest:
return actor->DoRequest(aRequest.get_ReplyTovCardPullingRequest());
case Request::TReplyToPhonebookPullingRequest:
return actor->DoRequest(aRequest.get_ReplyToPhonebookPullingRequest());
case Request::TReplyTovCardListingRequest:
return actor->DoRequest(aRequest.get_ReplyTovCardListingRequest());
#ifdef MOZ_B2G_RIL
case Request::TAnswerWaitingCallRequest:
return actor->DoRequest(aRequest.get_AnswerWaitingCallRequest());
@ -709,44 +703,6 @@ BluetoothRequestParent::DoRequest(const IsScoConnectedRequest& aRequest)
return true;
}
bool
BluetoothRequestParent::DoRequest(const ReplyTovCardPullingRequest& aRequest)
{
MOZ_ASSERT(mService);
MOZ_ASSERT(mRequestType == Request::TReplyTovCardPullingRequest);
mService->ReplyTovCardPulling((BlobParent*)aRequest.blobParent(),
(BlobChild*)aRequest.blobChild(),
mReplyRunnable.get());
return true;
}
bool
BluetoothRequestParent::DoRequest(const ReplyToPhonebookPullingRequest& aRequest)
{
MOZ_ASSERT(mService);
MOZ_ASSERT(mRequestType == Request::TReplyToPhonebookPullingRequest);
mService->ReplyToPhonebookPulling((BlobParent*)aRequest.blobParent(),
(BlobChild*)aRequest.blobChild(),
aRequest.phonebookSize(),
mReplyRunnable.get());
return true;
}
bool
BluetoothRequestParent::DoRequest(const ReplyTovCardListingRequest& aRequest)
{
MOZ_ASSERT(mService);
MOZ_ASSERT(mRequestType == Request::TReplyTovCardListingRequest);
mService->ReplyTovCardListing((BlobParent*)aRequest.blobParent(),
(BlobChild*)aRequest.blobChild(),
aRequest.phonebookSize(),
mReplyRunnable.get());
return true;
}
#ifdef MOZ_B2G_RIL
bool
BluetoothRequestParent::DoRequest(const AnswerWaitingCallRequest& aRequest)

Просмотреть файл

@ -212,15 +212,6 @@ protected:
bool
DoRequest(const IsScoConnectedRequest& aRequest);
bool
DoRequest(const ReplyTovCardPullingRequest& aRequest);
bool
DoRequest(const ReplyToPhonebookPullingRequest& aRequest);
bool
DoRequest(const ReplyTovCardListingRequest& aRequest);
#ifdef MOZ_B2G_RIL
bool
DoRequest(const AnswerWaitingCallRequest& aRequest);

Просмотреть файл

@ -366,66 +366,6 @@ BluetoothServiceChildProcess::IsScoConnected(BluetoothReplyRunnable* aRunnable)
SendRequest(aRunnable, IsScoConnectedRequest());
}
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!");
}
#ifdef MOZ_B2G_RIL
void
BluetoothServiceChildProcess::AnswerWaitingCall(

Просмотреть файл

@ -158,37 +158,6 @@ public:
virtual void
IsScoConnected(BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardPulling(Blob* aBlob,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyToPhonebookPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyToPhonebookPulling(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardListing(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardListing(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) override;
#ifdef MOZ_B2G_RIL
virtual void
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) override;

Просмотреть файл

@ -30,12 +30,10 @@ union BluetoothValue
{
int32_t;
uint32_t;
nsCString;
nsString;
bool;
nsString[];
uint8_t[];
uint32_t[];
BluetoothNamedValue[];
BluetoothGattId;
BluetoothGattId[];

Просмотреть файл

@ -171,23 +171,6 @@ struct IsScoConnectedRequest
{
};
struct ReplyTovCardPullingRequest
{
PBlob blob;
};
struct ReplyToPhonebookPullingRequest
{
PBlob blob;
uint16_t phonebookSize;
};
struct ReplyTovCardListingRequest
{
PBlob blob;
uint16_t phonebookSize;
};
struct AnswerWaitingCallRequest
{
};
@ -323,9 +306,6 @@ union Request
ConnectScoRequest;
DisconnectScoRequest;
IsScoConnectedRequest;
ReplyTovCardPullingRequest;
ReplyToPhonebookPullingRequest;
ReplyTovCardListingRequest;
AnswerWaitingCallRequest;
IgnoreWaitingCallRequest;
ToggleCallsRequest;

Просмотреть файл

@ -4378,52 +4378,3 @@ BluetoothDBusService::GattClientWriteDescriptorValueInternal(
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::ReplyTovCardPulling(
BlobParent* aBlobParent,
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::ReplyTovCardPulling(
Blob* aBlob,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::ReplyToPhonebookPulling(
BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::ReplyToPhonebookPulling(
Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::ReplyTovCardListing(
BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
}
void
BluetoothDBusService::ReplyTovCardListing(
Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable)
{
}

Просмотреть файл

@ -157,37 +157,6 @@ public:
virtual void
IsScoConnected(BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardPulling(Blob* aBlob,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyToPhonebookPulling(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyToPhonebookPulling(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardListing(BlobParent* aBlobParent,
BlobChild* aBlobChild,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable) override;
virtual void
ReplyTovCardListing(Blob* aBlob,
uint16_t aPhonebookSize,
BluetoothReplyRunnable* aRunnable);
#ifdef MOZ_B2G_RIL
virtual void
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable);

Просмотреть файл

@ -13,7 +13,6 @@ if CONFIG['MOZ_B2G_BT']:
SOURCES += [
'BluetoothHidManager.cpp',
'BluetoothInterface.cpp',
'BluetoothPbapRequestHandle.cpp',
'BluetoothUtils.cpp',
'BluetoothUuid.cpp',
'ObexBase.cpp'
@ -145,8 +144,7 @@ EXPORTS.mozilla.dom.bluetooth += [
'bluetooth2/BluetoothManager.h',
'bluetooth2/BluetoothPairingHandle.h',
'bluetooth2/BluetoothPairingListener.h',
'BluetoothCommon.h',
'BluetoothPbapRequestHandle.h',
'BluetoothCommon.h'
]
IPDL_SOURCES += [
'bluetooth2/ipc/BluetoothTypes.ipdlh',

Просмотреть файл

@ -76,22 +76,10 @@ const kEventConstructors = {
return new BluetoothPairingEvent(aName, aProps);
},
},
BluetoothPhonebookPullingEvent: { create: function (aName, aProps) {
return new BluetoothPhonebookPullingEvent(aName, aProps);
},
},
BluetoothStatusChangedEvent: { create: function (aName, aProps) {
return new BluetoothStatusChangedEvent(aName, aProps);
},
},
BluetoothVCardListingEvent: { create: function (aName, aProps) {
return new BluetoothVCardListingEvent(aName, aProps);
},
},
BluetoothVCardPullingEvent: { create: function (aName, aProps) {
return new BluetoothVCardPullingEvent(aName, aProps);
},
},
CallEvent: { create: function (aName, aProps) {
return new CallEvent(aName, aProps);
},

Просмотреть файл

@ -69,15 +69,6 @@ interface BluetoothAdapter : EventTarget {
// Fired when remote devices query current media play status
attribute EventHandler onrequestmediaplaystatus;
// Fired when PBAP manager requests for 'pullphonebook'
attribute EventHandler onpullphonebookreq;
// Fired when PBAP manager requests for 'pullvcardentry'
attribute EventHandler onpullvcardentryreq;
// Fired when PBAP manager requests for 'pullvcardlisting'
attribute EventHandler onpullvcardlistingreq;
/**
* Enable/Disable a local bluetooth adapter by asynchronus methods and return
* its result through a Promise.

Просмотреть файл

@ -1,81 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
/**
* This enum holds the parameters to indicate the properties contained in the
* requested vCard objects.
*/
enum vCardProperties
{
"version",
"fn",
"n",
"photo",
"bday",
"adr",
"label",
"tel",
"email",
"mailer",
"tz",
"geo",
"title",
"role",
"logo",
"agent",
"org",
"note",
"rev",
"sound",
"url",
"uid",
"key",
"nickname",
"categories",
"proid",
"class",
"sort-string",
"x-irmc-call-datetime",
"x-bt-speeddialkey",
"x-bt-uci",
"x-bt-uid"
};
/**
* This enum holds the parameters to indicate the sorting order of vCard
* objects.
*/
enum vCardOrderType {
"alphabetical",
"indexed", // default
"phonetical"
};
/**
* This enum holds the parameters to indicate the search key of the search
* operation.
*/
enum vCardSearchKeyType {
"name", // default
"number",
"sound"
};
/**
* This enum holds the parameters to indicate the vCard version.
*/
enum vCardVersion {
"vCard21", // default
"vCard30"
};
/**
* This enum holds the parameters to indicate the type of vCard selector.
*/
enum vCardSelectorOp {
"OR", // default
"AND"
};

Просмотреть файл

@ -1,33 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
[CheckAnyPermissions="bluetooth"]
interface BluetoothPbapRequestHandle
{
/**
* Reply vCard object to the PBAP request. The DOMRequest will get onerror
* callback if the PBAP request type is not 'pullvcardentryreq' or operation
* fails.
*/
[NewObject, Throws, AvailableIn=CertifiedApps]
DOMRequest replyTovCardPulling(Blob vcardObject);
/**
* Reply vCard object to the PBAP request. The DOMRequest will get onerror
* callback if the PBAP request type is not 'pullphonebookreq' or operation
* fails.
*/
[NewObject, Throws, AvailableIn=CertifiedApps]
DOMRequest replyToPhonebookPulling(Blob vcardObject,
unsigned long long phonebookSize);
/**
* Reply vCard object to the PBAP request. The DOMRequest will get onerror
* callback if the PBAP request type is not 'pullvcardlistingreq' or operation
* fails.
*/
[NewObject, Throws, AvailableIn=CertifiedApps]
DOMRequest replyTovCardListing(Blob vcardObject,
unsigned long long phonebookSize);
};

Просмотреть файл

@ -1,36 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
[CheckAnyPermissions="bluetooth",
Constructor(DOMString type,
optional BluetoothPhonebookPullingEventInit eventInitDict)]
interface BluetoothPhonebookPullingEvent : Event
{
readonly attribute DOMString name;
readonly attribute vCardVersion format;
[Cached, Constant]
readonly attribute sequence<vCardProperties> propSelector;
readonly attribute unsigned long maxListCount;
readonly attribute unsigned long listStartOffset;
[Cached, Constant]
readonly attribute sequence<vCardProperties> vcardSelector;
readonly attribute vCardSelectorOp vcardSelectorOperator;
readonly attribute BluetoothPbapRequestHandle? handle;
};
dictionary BluetoothPhonebookPullingEventInit : EventInit
{
DOMString name = "";
vCardVersion format = "vCard21";
sequence<vCardProperties> propSelector = [];
unsigned long maxListCount = 0;
unsigned long listStartOffset = 0;
sequence<vCardProperties> vcardSelector = [];
vCardSelectorOp vcardSelectorOperator = "OR";
BluetoothPbapRequestHandle? handle = null;
};

Просмотреть файл

@ -1,37 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
[CheckAnyPermissions="bluetooth",
Constructor(DOMString type,
optional BluetoothVCardListingEventInit eventInitDict)]
interface BluetoothVCardListingEvent : Event
{
readonly attribute DOMString name;
readonly attribute vCardOrderType order;
readonly attribute DOMString searchValue;
readonly attribute vCardSearchKeyType searchKey;
readonly attribute unsigned long maxListCount;
readonly attribute unsigned long listStartOffset;
[Cached, Constant]
readonly attribute sequence<vCardProperties> vcardSelector;
readonly attribute vCardSelectorOp vcardSelectorOperator;
readonly attribute BluetoothPbapRequestHandle? handle;
};
dictionary BluetoothVCardListingEventInit : EventInit
{
DOMString name = "";
vCardOrderType order = "indexed";
DOMString searchValue = "";
vCardSearchKeyType searchKey = "name";
unsigned long maxListCount = 0;
unsigned long listStartOffset = 0;
sequence<vCardProperties> vcardSelector = [];
vCardSelectorOp vcardSelectorOperator = "OR";
BluetoothPbapRequestHandle? handle = null;
};

Просмотреть файл

@ -1,27 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
[CheckAnyPermissions="bluetooth",
Constructor(DOMString type,
optional BluetoothVCardPullingEventInit eventInitDict)]
interface BluetoothVCardPullingEvent : Event
{
readonly attribute DOMString name;
readonly attribute vCardVersion format;
[Cached, Constant]
readonly attribute sequence<vCardProperties> propSelector;
readonly attribute BluetoothPbapRequestHandle? handle;
};
dictionary BluetoothVCardPullingEventInit : EventInit
{
DOMString name = "";
vCardVersion format = "vCard21";
sequence<vCardProperties> propSelector = [];
BluetoothPbapRequestHandle? handle = null;
};

Просмотреть файл

@ -681,8 +681,6 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothManager.webidl',
'BluetoothPairingHandle.webidl',
'BluetoothPairingListener.webidl',
'BluetoothPbapParameters.webidl',
'BluetoothPbapRequestHandle.webidl',
]
if CONFIG['MOZ_SIMPLEPUSH']:
@ -829,10 +827,7 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothDeviceEvent.webidl',
'BluetoothGattCharacteristicEvent.webidl',
'BluetoothPairingEvent.webidl',
'BluetoothPhonebookPullingEvent.webidl',
'BluetoothStatusChangedEvent.webidl',
'BluetoothVCardListingEvent.webidl',
'BluetoothVCardPullingEvent.webidl'
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':