mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1184017 - [MAP] Dispatch events to MAP event handlers, r=btian, sr=mrbkap
This commit is contained in:
parent
29ce7b84e2
commit
8cb7ad155e
@ -832,6 +832,12 @@ GK_ATOM(onMozMousePixelScroll, "onMozMousePixelScroll")
|
||||
GK_ATOM(onMozScrolledAreaChanged, "onMozScrolledAreaChanged")
|
||||
GK_ATOM(onmoznetworkupload, "onmoznetworkupload")
|
||||
GK_ATOM(onmoznetworkdownload, "onmoznetworkdownload")
|
||||
GK_ATOM(onmapfolderlistingreq, "onmapfolderlistingreq")
|
||||
GK_ATOM(onmapmessageslistingreq, "onmapmessageslistingreq")
|
||||
GK_ATOM(onmapgetmessagereq, "onmapgetmessagereq")
|
||||
GK_ATOM(onmapsetmessagestatusreq, "onmapsetmessagestatusreq")
|
||||
GK_ATOM(onmapsendmessagereq, "onmapsendmessagereq")
|
||||
GK_ATOM(onmapmessageupdatereq, "onmapmessageupdatereq")
|
||||
GK_ATOM(onnewrdsgroup, "onnewrdsgroup")
|
||||
GK_ATOM(onnotificationclick, "onnotificationclick")
|
||||
GK_ATOM(onnoupdate, "onnoupdate")
|
||||
|
@ -207,6 +207,10 @@ DOMInterfaces = {
|
||||
'nativeType': 'mozilla::dom::bluetooth::BluetoothPbapRequestHandle',
|
||||
},
|
||||
|
||||
'BluetoothMapRequestHandle': {
|
||||
'nativeType': 'mozilla::dom::bluetooth::BluetoothMapRequestHandle',
|
||||
},
|
||||
|
||||
'BoxObject': {
|
||||
'resultNotAddRefed': ['element'],
|
||||
},
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "BluetoothUuid.h"
|
||||
#include "ObexBase.h"
|
||||
|
||||
#include "mozilla/dom/BluetoothMapParametersBinding.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
@ -20,6 +21,11 @@
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#define FILTER_NO_SMS_GSM 0x01
|
||||
#define FILTER_NO_SMS_CDMA 0x02
|
||||
#define FILTER_NO_EMAIL 0x04
|
||||
#define FILTER_NO_MMS 0x08
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -711,7 +717,8 @@ BluetoothMapSmsManager::AppendBtNamedValueByTagId(
|
||||
// convert big endian to little endian
|
||||
maxListCount = (maxListCount >> 8) | (maxListCount << 8);
|
||||
BT_LOGR("max list count: %d", maxListCount);
|
||||
AppendNamedValue(aValues, "maxListCount", maxListCount);
|
||||
AppendNamedValue(aValues, "maxListCount",
|
||||
static_cast<uint32_t>(maxListCount));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::StartOffset: {
|
||||
@ -719,13 +726,14 @@ BluetoothMapSmsManager::AppendBtNamedValueByTagId(
|
||||
// convert big endian to little endian
|
||||
startOffset = (startOffset >> 8) | (startOffset << 8);
|
||||
BT_LOGR("start offset : %d", startOffset);
|
||||
AppendNamedValue(aValues, "startOffset", startOffset);
|
||||
AppendNamedValue(aValues, "startOffset",
|
||||
static_cast<uint32_t>(startOffset));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::SubjectLength: {
|
||||
uint8_t subLength = *((uint8_t *)buf);
|
||||
BT_LOGR("msg subLength : %d", subLength);
|
||||
AppendNamedValue(aValues, "subLength", subLength);
|
||||
AppendNamedValue(aValues, "subLength", static_cast<uint32_t>(subLength));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::ParameterMask: {
|
||||
@ -740,43 +748,81 @@ BluetoothMapSmsManager::AppendBtNamedValueByTagId(
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::FilterMessageType: {
|
||||
uint8_t filterMessageType = *((uint8_t *)buf);
|
||||
/* Follow MAP 1.2, 6.3.1
|
||||
* 0000xxx1 = "SMS_GSM"
|
||||
* 0000xx1x = "SMS_CDMA"
|
||||
* 0000x1xx = "EMAIL"
|
||||
* 00001xxx = "MMS"
|
||||
* Where
|
||||
* 0 = "no filtering, get this type"
|
||||
* 1 = "filter out this type"
|
||||
*/
|
||||
uint32_t filterMessageType = *((uint8_t *)buf);
|
||||
|
||||
if (filterMessageType == (FILTER_NO_EMAIL | FILTER_NO_MMS |
|
||||
FILTER_NO_SMS_GSM) ||
|
||||
filterMessageType == (FILTER_NO_EMAIL | FILTER_NO_MMS |
|
||||
FILTER_NO_SMS_CDMA)) {
|
||||
filterMessageType = static_cast<uint32_t>(MessageType::Sms);
|
||||
} else if (filterMessageType == (FILTER_NO_EMAIL | FILTER_NO_SMS_GSM |
|
||||
FILTER_NO_SMS_CDMA)) {
|
||||
filterMessageType = static_cast<uint32_t>(MessageType::Mms);
|
||||
} else if (filterMessageType == (FILTER_NO_MMS | FILTER_NO_SMS_GSM |
|
||||
FILTER_NO_SMS_CDMA)) {
|
||||
filterMessageType = static_cast<uint32_t>(MessageType::Email);
|
||||
} else {
|
||||
BT_LOGR("Unsupportted filter message type");
|
||||
filterMessageType = static_cast<uint32_t>(MessageType::Sms);
|
||||
}
|
||||
|
||||
BT_LOGR("msg filterMessageType : %d", filterMessageType);
|
||||
AppendNamedValue(aValues, "filterMessageType", filterMessageType);
|
||||
AppendNamedValue(aValues, "filterMessageType",
|
||||
static_cast<uint32_t>(filterMessageType));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::FilterPeriodBegin: {
|
||||
nsCString filterPeriodBegin((char *) buf);
|
||||
BT_LOGR("msg FilterPeriodBegin : %s", filterPeriodBegin.get());
|
||||
AppendNamedValue(aValues, "filterPeriodBegin", filterPeriodBegin);
|
||||
AppendNamedValue(aValues, "filterPeriodBegin",
|
||||
NS_ConvertUTF8toUTF16(filterPeriodBegin));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::FilterPeriodEnd: {
|
||||
nsCString filterPeriodEnd((char*)buf);
|
||||
BT_LOGR("msg filterPeriodEnd : %s", filterPeriodEnd.get());
|
||||
AppendNamedValue(aValues, "filterPeriodEnd", filterPeriodEnd);
|
||||
AppendNamedValue(aValues, "filterPeriodEnd",
|
||||
NS_ConvertUTF8toUTF16(filterPeriodEnd));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::FilterReadStatus: {
|
||||
uint8_t filterReadStatus = *((uint8_t *)buf);
|
||||
using namespace mozilla::dom::ReadStatusValues;
|
||||
uint32_t filterReadStatus =
|
||||
buf[0] < ArrayLength(strings) ? static_cast<uint32_t>(buf[0]) : 0;
|
||||
BT_LOGR("msg filter read status : %d", filterReadStatus);
|
||||
AppendNamedValue(aValues, "filterReadStatus", filterReadStatus);
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::FilterRecipient: {
|
||||
// FilterRecipient encodes as UTF-8
|
||||
nsCString filterRecipient((char*) buf);
|
||||
BT_LOGR("msg filterRecipient : %s", filterRecipient.get());
|
||||
AppendNamedValue(aValues, "filterRecipient", filterRecipient);
|
||||
AppendNamedValue(aValues, "filterRecipient",
|
||||
NS_ConvertUTF8toUTF16(filterRecipient));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::FilterOriginator: {
|
||||
// FilterOriginator encodes as UTF-8
|
||||
nsCString filterOriginator((char*) buf);
|
||||
BT_LOGR("msg filter Originator : %s", filterOriginator.get());
|
||||
AppendNamedValue(aValues, "filterOriginator", filterOriginator);
|
||||
AppendNamedValue(aValues, "filterOriginator",
|
||||
NS_ConvertUTF8toUTF16(filterOriginator));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::FilterPriority: {
|
||||
uint8_t filterPriority = *((uint8_t *)buf);
|
||||
using namespace mozilla::dom::PriorityValues;
|
||||
uint32_t filterPriority =
|
||||
buf[0] < ArrayLength(strings) ? static_cast<uint32_t>(buf[0]) : 0;
|
||||
|
||||
BT_LOGR("msg filter priority: %d", filterPriority);
|
||||
AppendNamedValue(aValues, "filterPriority", filterPriority);
|
||||
break;
|
||||
@ -784,20 +830,25 @@ BluetoothMapSmsManager::AppendBtNamedValueByTagId(
|
||||
case Map::AppParametersTagId::Attachment: {
|
||||
uint8_t attachment = *((uint8_t *)buf);
|
||||
BT_LOGR("msg filter attachment: %d", attachment);
|
||||
AppendNamedValue(aValues, "attachment", attachment);
|
||||
AppendNamedValue(aValues, "attachment", static_cast<uint32_t>(attachment));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::Charset: {
|
||||
uint8_t charset = *((uint8_t *)buf);
|
||||
BT_LOGR("msg filter charset: %d", charset);
|
||||
AppendNamedValue(aValues, "charset", charset);
|
||||
using namespace mozilla::dom::FilterCharsetValues;
|
||||
uint32_t filterCharset =
|
||||
buf[0] < ArrayLength(strings) ? static_cast<uint32_t>(buf[0]) : 0;
|
||||
|
||||
BT_LOGR("msg filter charset: %d", filterCharset);
|
||||
AppendNamedValue(aValues, "charset", filterCharset);
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::StatusIndicator: {
|
||||
uint8_t statusIndicator = *((uint8_t *)buf);
|
||||
BT_LOGR("msg filter statusIndicator: %d", statusIndicator);
|
||||
AppendNamedValue(aValues, "statusIndicator",
|
||||
static_cast<uint32_t>(statusIndicator));
|
||||
using namespace mozilla::dom::StatusIndicatorsValues;
|
||||
uint32_t filterStatusIndicator =
|
||||
buf[0] < ArrayLength(strings) ? static_cast<uint32_t>(buf[0]) : 0;
|
||||
|
||||
BT_LOGR("msg filter statusIndicator: %d", filterStatusIndicator);
|
||||
AppendNamedValue(aValues, "statusIndicator", filterStatusIndicator);
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::StatusValue: {
|
||||
|
@ -255,6 +255,8 @@ extern bool gBluetoothDebugFlag;
|
||||
#define MAP_GET_MESSAGE_REQ_ID "mapgetmessagereq"
|
||||
#define MAP_SET_MESSAGE_STATUS_REQ_ID "mapsetmessagestatusreq"
|
||||
#define MAP_PUSH_MESSAGE_REQ_ID "mappushmessagereq"
|
||||
#define MAP_FOLDER_LISTING_REQ_ID "mapfolderlistingreq"
|
||||
#define MAP_MESSAGE_UPDATE_REQ_ID "mapmessageupdatereq"
|
||||
|
||||
/**
|
||||
* When the value of a characteristic of a remote BLE device changes, we'll
|
||||
|
@ -16,6 +16,13 @@
|
||||
|
||||
#include "mozilla/dom/BluetoothAdapterBinding.h"
|
||||
#include "mozilla/dom/BluetoothAttributeEvent.h"
|
||||
#include "mozilla/dom/BluetoothMapFolderListingEvent.h"
|
||||
#include "mozilla/dom/BluetoothMapGetMessageEvent.h"
|
||||
#include "mozilla/dom/BluetoothMapMessagesListingEvent.h"
|
||||
#include "mozilla/dom/BluetoothMapMessageUpdateEvent.h"
|
||||
#include "mozilla/dom/BluetoothMapSetMessageStatusEvent.h"
|
||||
#include "mozilla/dom/BluetoothMapSendMessageEvent.h"
|
||||
|
||||
#include "mozilla/dom/BluetoothPhonebookPullingEvent.h"
|
||||
#include "mozilla/dom/BluetoothStatusChangedEvent.h"
|
||||
#include "mozilla/dom/BluetoothVCardListingEvent.h"
|
||||
@ -534,6 +541,18 @@ BluetoothAdapter::Notify(const BluetoothSignal& aData)
|
||||
HandlePullVCardEntryReq(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(PULL_VCARD_LISTING_REQ_ID)) {
|
||||
HandlePullVCardListingReq(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(MAP_MESSAGES_LISTING_REQ_ID)) {
|
||||
HandleMapMessagesListing(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(MAP_FOLDER_LISTING_REQ_ID)) {
|
||||
HandleMapFolderListing(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(MAP_GET_MESSAGE_REQ_ID)) {
|
||||
HandleMapGetMessage(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(MAP_SET_MESSAGE_STATUS_REQ_ID)) {
|
||||
HandleMapSetMessageStatus(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(MAP_PUSH_MESSAGE_REQ_ID)) {
|
||||
HandleMapSendMessage(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(MAP_MESSAGE_UPDATE_REQ_ID)) {
|
||||
HandleMapMessageUpdate(aData.value());
|
||||
} else {
|
||||
BT_WARNING("Not handling adapter signal: %s",
|
||||
NS_ConvertUTF16toUTF8(aData.name()).get());
|
||||
@ -1338,6 +1357,238 @@ BluetoothAdapter::getVCardProperties(const BluetoothValue &aValue)
|
||||
return propSelector;
|
||||
}
|
||||
|
||||
Sequence<ParameterMask>
|
||||
BluetoothAdapter::GetParameterMask(const BluetoothValue &aValue)
|
||||
{
|
||||
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfuint32_t);
|
||||
|
||||
Sequence<ParameterMask> parameterMask;
|
||||
|
||||
const InfallibleTArray<uint32_t>& parameterMaskArr =
|
||||
aValue.get_ArrayOfuint32_t();
|
||||
for (uint32_t i = 0; i < parameterMaskArr.Length(); ++i) {
|
||||
parameterMask.AppendElement(
|
||||
static_cast<ParameterMask>(parameterMaskArr[i]), mozilla::fallible);
|
||||
}
|
||||
|
||||
return parameterMask;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleMapFolderListing(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::Tuint32_t);
|
||||
|
||||
BluetoothMapFolderListingEventInit 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("maxListCount")) {
|
||||
init.mMaxListCount = value.get_uint32_t();
|
||||
} else if (name.EqualsLiteral("startOffset")) {
|
||||
init.mListStartOffset = value.get_uint32_t();
|
||||
}
|
||||
}
|
||||
|
||||
init.mHandle = BluetoothMapRequestHandle::Create(GetOwner());
|
||||
|
||||
nsRefPtr<BluetoothMapFolderListingEvent> event =
|
||||
BluetoothMapFolderListingEvent::Constructor(this,
|
||||
NS_LITERAL_STRING(MAP_FOLDER_LISTING_REQ_ID), init);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleMapMessagesListing(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::Tuint32_t);
|
||||
|
||||
BluetoothMapMessagesListingEventInit 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("maxListCount")) {
|
||||
init.mMaxListCount = value.get_uint32_t();
|
||||
} else if (name.EqualsLiteral("startOffset")) {
|
||||
init.mListStartOffset = value.get_uint32_t();
|
||||
} else if (name.EqualsLiteral("subLength")) {
|
||||
init.mSubjectLength = value.get_uint32_t();
|
||||
} else if (name.EqualsLiteral("parameterMask")) {
|
||||
init.mParameterMask = GetParameterMask(value);
|
||||
} else if (name.EqualsLiteral("filterMessageType")) {
|
||||
init.mFilterMessageType = static_cast<MessageType>(value.get_uint32_t());
|
||||
} else if (name.EqualsLiteral("filterPeriodBegin")) {
|
||||
init.mFilterPeriodBegin = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("filterPeriodEnd")) {
|
||||
init.mFilterPeriodEnd = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("filterReadStatus")) {
|
||||
init.mFilterReadStatus = static_cast<ReadStatus>(value.get_uint32_t());
|
||||
} else if (name.EqualsLiteral("filterRecipient")) {
|
||||
init.mFilterRecipient = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("filterOriginator")) {
|
||||
init.mFilterOriginator = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("filterPriority")) {
|
||||
init.mFilterPriority = static_cast<Priority>(value.get_uint32_t());
|
||||
}
|
||||
}
|
||||
|
||||
init.mHandle = BluetoothMapRequestHandle::Create(GetOwner());
|
||||
|
||||
nsRefPtr<BluetoothMapMessagesListingEvent> event =
|
||||
BluetoothMapMessagesListingEvent::Constructor(this,
|
||||
NS_LITERAL_STRING(MAP_MESSAGES_LISTING_REQ_ID), init);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleMapGetMessage(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::Tbool);
|
||||
|
||||
BluetoothMapGetMessageEventInit 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("hasAttachment")) {
|
||||
init.mHasAttachment = value.get_bool();
|
||||
} else if (name.EqualsLiteral("charset")) {
|
||||
if (value.get_uint32_t() == 0) {
|
||||
init.mCharset = FilterCharset::Native;
|
||||
} else {
|
||||
init.mCharset = FilterCharset::Utf_8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init.mHandle = BluetoothMapRequestHandle::Create(GetOwner());
|
||||
|
||||
nsRefPtr<BluetoothMapGetMessageEvent> event =
|
||||
BluetoothMapGetMessageEvent::Constructor(this,
|
||||
NS_LITERAL_STRING(MAP_GET_MESSAGE_REQ_ID), init);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleMapSetMessageStatus(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::Tuint32_t);
|
||||
|
||||
BluetoothMapSetMessageStatusEventInit 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("handleId")) {
|
||||
init.mHandleId = value.get_uint32_t();
|
||||
} else if (name.EqualsLiteral("statusIndicator")) {
|
||||
if (value.get_uint32_t()) {
|
||||
init.mStatusIndicator = StatusIndicators::Deletedstatus;
|
||||
} else {
|
||||
init.mStatusIndicator = StatusIndicators::Readstatus;
|
||||
}
|
||||
} else if (name.EqualsLiteral("statusValue")) {
|
||||
init.mStatusValue = static_cast<bool>(value.get_uint32_t());
|
||||
}
|
||||
}
|
||||
|
||||
init.mHandle = BluetoothMapRequestHandle::Create(GetOwner());
|
||||
|
||||
nsRefPtr<BluetoothMapSetMessageStatusEvent> event =
|
||||
BluetoothMapSetMessageStatusEvent::Constructor(this,
|
||||
NS_LITERAL_STRING(MAP_SET_MESSAGE_STATUS_REQ_ID), init);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleMapSendMessage(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);
|
||||
|
||||
BluetoothMapSendMessageEventInit 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("recipient")) {
|
||||
init.mRecipient = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("messageBody")) {
|
||||
init.mMessageBody = value.get_nsString();
|
||||
} else if (name.EqualsLiteral("retry")) {
|
||||
init.mRetry = value.get_uint32_t();
|
||||
}
|
||||
}
|
||||
|
||||
init.mHandle = BluetoothMapRequestHandle::Create(GetOwner());
|
||||
|
||||
nsRefPtr<BluetoothMapSendMessageEvent> event =
|
||||
BluetoothMapSendMessageEvent::Constructor(this,
|
||||
NS_LITERAL_STRING(MAP_PUSH_MESSAGE_REQ_ID), init);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleMapMessageUpdate(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);
|
||||
|
||||
BluetoothMapMessageUpdateEventInit 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("instanceId")) {
|
||||
init.mInstanceId = value.get_uint32_t();
|
||||
}
|
||||
}
|
||||
|
||||
init.mHandle = BluetoothMapRequestHandle::Create(GetOwner());
|
||||
|
||||
nsRefPtr<BluetoothMapMessageUpdateEvent> event =
|
||||
BluetoothMapMessageUpdateEvent::Constructor(this,
|
||||
NS_LITERAL_STRING(MAP_MESSAGE_UPDATE_REQ_ID), init);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BluetoothAdapter::DispatchAttributeEvent(const Sequence<nsString>& aTypes)
|
||||
{
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/BluetoothAdapterBinding.h"
|
||||
#include "mozilla/dom/BluetoothDeviceEvent.h"
|
||||
#include "mozilla/dom/BluetoothMapParametersBinding.h"
|
||||
#include "mozilla/dom/BluetoothPbapParametersBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -95,6 +96,12 @@ public:
|
||||
IMPL_EVENT_HANDLER(pullvcardlistingreq);
|
||||
IMPL_EVENT_HANDLER(requestmediaplaystatus);
|
||||
IMPL_EVENT_HANDLER(scostatuschanged);
|
||||
IMPL_EVENT_HANDLER(mapfolderlistingreq);
|
||||
IMPL_EVENT_HANDLER(mapmessageslistingreq);
|
||||
IMPL_EVENT_HANDLER(mapgetmessagereq);
|
||||
IMPL_EVENT_HANDLER(mapsetmessagestatusreq);
|
||||
IMPL_EVENT_HANDLER(mapsendmessagereq);
|
||||
IMPL_EVENT_HANDLER(mapmessageupdatereq);
|
||||
|
||||
/****************************************************************************
|
||||
* Methods (Web API Implementation)
|
||||
@ -342,6 +349,84 @@ private:
|
||||
*/
|
||||
Sequence<vCardProperties> getVCardProperties(const BluetoothValue &aValue);
|
||||
|
||||
/**
|
||||
* Handle "MapFolderListing" bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the MAP request.
|
||||
* The array should contain a few properties:
|
||||
* - uint32_t 'MaxListCount'
|
||||
* - uint32_t 'ListStartOffset'
|
||||
*/
|
||||
void HandleMapFolderListing(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Handle "MapMessageListing" bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the MAP request.
|
||||
* The array should contain a few properties:
|
||||
* - uint32_t 'MaxListCount'
|
||||
* - uint32_t 'ListStartOffset'
|
||||
* - uint32_t 'SubjectLength'
|
||||
* - uint32_t 'ParameterMask'
|
||||
* - uint32_t 'FilterMessageType'
|
||||
* - nsString 'FilterPeriodBegin'
|
||||
* - nsString 'FilterPeriodEnd'
|
||||
* - uint32_t 'FilterReadStatus'
|
||||
* - nsString 'FilterRecipient'
|
||||
* - nsString 'FilterOriginator'
|
||||
* - uint32_t 'FilterPriority'
|
||||
*/
|
||||
void HandleMapMessagesListing(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Handle "MapGetMessage" bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the MAP request.
|
||||
* The array should contain a few properties:
|
||||
* - bool 'Attachment'
|
||||
* - nsString 'Charset'
|
||||
*/
|
||||
void HandleMapGetMessage(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Handle "MapSetMessageStatus" bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the scanned device.
|
||||
* The array should contain a few properties:
|
||||
* - long 'HandleId'
|
||||
* - uint32_t 'StatusIndicator'
|
||||
* - bool 'StatusValue'
|
||||
*/
|
||||
void HandleMapSetMessageStatus(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Handle "MapSendMessage" bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the scanned device.
|
||||
* The array should contain a few properties:
|
||||
* - nsString 'Recipient'
|
||||
* - nsString 'MessageBody'
|
||||
* - uint32_t 'Retry'
|
||||
*/
|
||||
void HandleMapSendMessage(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Handle "MapMessageUpdate" bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the scanned device.
|
||||
* - nsString 'MASInstanceID'
|
||||
*/
|
||||
void HandleMapMessageUpdate(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Get a Sequence of ParameterMask from a BluetoothValue. The name of
|
||||
* BluetoothValue must be parameterMask.
|
||||
*
|
||||
* @param aValue [in] a BluetoothValue with 'TArrayOfuint32_t' type
|
||||
* The name of BluetoothValue must be 'parameterMask'.
|
||||
*/
|
||||
Sequence<ParameterMask> GetParameterMask(const BluetoothValue &aValue);
|
||||
|
||||
/**
|
||||
* Fire BluetoothAttributeEvent to trigger onattributechanged event handler.
|
||||
*
|
||||
|
109
dom/bluetooth/common/webapi/BluetoothMapRequestHandle.cpp
Normal file
109
dom/bluetooth/common/webapi/BluetoothMapRequestHandle.cpp
Normal file
@ -0,0 +1,109 @@
|
||||
/* -*- 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 "BluetoothMapRequestHandle.h"
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
#include "BluetoothService.h"
|
||||
|
||||
#include "mozilla/dom/BluetoothMapRequestHandleBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace dom;
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(BluetoothMapRequestHandle, mOwner)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothMapRequestHandle)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothMapRequestHandle)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothMapRequestHandle)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
BluetoothMapRequestHandle::BluetoothMapRequestHandle(nsPIDOMWindow* aOwner)
|
||||
: mOwner(aOwner)
|
||||
{
|
||||
MOZ_ASSERT(aOwner);
|
||||
}
|
||||
|
||||
BluetoothMapRequestHandle::~BluetoothMapRequestHandle()
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<BluetoothMapRequestHandle>
|
||||
BluetoothMapRequestHandle::Create(nsPIDOMWindow* aOwner)
|
||||
{
|
||||
MOZ_ASSERT(aOwner);
|
||||
|
||||
nsRefPtr<BluetoothMapRequestHandle> handle =
|
||||
new BluetoothMapRequestHandle(aOwner);
|
||||
|
||||
return handle.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
BluetoothMapRequestHandle::ReplyToFolderListing(long aMasId,
|
||||
const nsAString& aFolderlists, ErrorResult& aRv)
|
||||
{
|
||||
// TODO: Implement this fuction in Bug 1208492
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
BluetoothMapRequestHandle::ReplyToMessagesListing(long aMasId,
|
||||
Blob& aBlob,
|
||||
bool aNewMessage,
|
||||
const nsAString& aTimestamp,
|
||||
int aSize,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// TODO: Implement this fuction in Bug 1208492
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
BluetoothMapRequestHandle::ReplyToGetMessage(long aMasId, Blob& aBlob,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// TODO: Implement this fuction in Bug 1208492
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
BluetoothMapRequestHandle::ReplyToSetMessageStatus(long aMasId,
|
||||
bool aStatus,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// TODO: Implement this fuction in Bug 1208492
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
BluetoothMapRequestHandle::ReplyToSendMessage(long aMasId,
|
||||
bool aStatus,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// TODO: Implement this fuction in Bug 1208492
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
BluetoothMapRequestHandle::ReplyToMessageUpdate(long aMasId,
|
||||
bool aStatus,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// TODO: Implement this fuction in Bug 1208492
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
BluetoothMapRequestHandle::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return BluetoothMapRequestHandleBinding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
117
dom/bluetooth/common/webapi/BluetoothMapRequestHandle.h
Normal file
117
dom/bluetooth/common/webapi/BluetoothMapRequestHandle.h
Normal file
@ -0,0 +1,117 @@
|
||||
/* -*- 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_BluetoothMapRequestHandle_h
|
||||
#define mozilla_dom_bluetooth_BluetoothMapRequestHandle_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
namespace mozilla {
|
||||
class ErrorResult;
|
||||
namespace dom {
|
||||
class Promise;
|
||||
}
|
||||
}
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothMapRequestHandle final : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BluetoothMapRequestHandle)
|
||||
|
||||
static already_AddRefed<BluetoothMapRequestHandle>
|
||||
Create(nsPIDOMWindow* aOwner);
|
||||
|
||||
nsPIDOMWindow* GetParentObject() const
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
/**
|
||||
* Reply to folder listing
|
||||
*
|
||||
* @param aMasId [in] MAS ID.
|
||||
* @param aFolderlists [in] MAP folder Name.
|
||||
* @param aRv [out] Error result to set in case of error.
|
||||
*/
|
||||
already_AddRefed<Promise> ReplyToFolderListing(long aMasId,
|
||||
const nsAString& aFolderlists, ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Reply to messages listing
|
||||
*
|
||||
* @param aMasId [in] MAS ID.
|
||||
* @param aBlob [in] MAP messages listing content.
|
||||
* @param aNewMessage [in] Whether MSE has received a new message.
|
||||
* @param aTimestamp [in] The local time basis and UTC offset of the
|
||||
* MSE. MCE will interpret the timestamps of The
|
||||
* messages listing entries.
|
||||
* @param aSize [in] The number of accessible messages in the
|
||||
* corresponding folder fulfilling.
|
||||
* @param aRv [out] Error result to set in case of error.
|
||||
*/
|
||||
already_AddRefed<Promise> ReplyToMessagesListing(
|
||||
long aMasId, Blob& aBlob, bool aNewMessage, const nsAString& aTimestamp,
|
||||
int aSize, ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Reply to get-message request
|
||||
*
|
||||
* @param aMasId [in] MAS ID.
|
||||
* @param aBlob [in] MAP get messages content.
|
||||
* @param aRv [out] Error result to set in case of error.
|
||||
*/
|
||||
already_AddRefed<Promise> ReplyToGetMessage(long aMasId, Blob& aBlob,
|
||||
ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Reply to get-message request
|
||||
*
|
||||
* @param aMasId [in] MAS ID.
|
||||
* @param aStatus [in] MAP set message result.
|
||||
* @param aRv [out] Error result to set in case of error.
|
||||
*/
|
||||
already_AddRefed<Promise> ReplyToSetMessageStatus(long aMasId, bool aStatus,
|
||||
ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Reply to get-message request
|
||||
*
|
||||
* @param aMasId [in] MAS ID.
|
||||
* @param aStatus [in] MAP send message result.
|
||||
* @param aRv [out] Error result to set in case of error.
|
||||
*/
|
||||
already_AddRefed<Promise> ReplyToSendMessage(long aMasId, bool aStatus,
|
||||
ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Reply to message update request
|
||||
*
|
||||
* @param aMasId [in] MAS ID.
|
||||
* @param aStatus [in] Update inbox results.
|
||||
* @param aRv [out] Error result to set in case of error.
|
||||
*/
|
||||
already_AddRefed<Promise> ReplyToMessageUpdate(long aMasId, bool aStatus,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
BluetoothMapRequestHandle(nsPIDOMWindow* aOwner);
|
||||
~BluetoothMapRequestHandle();
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mOwner;
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_bluetooth_BluetoothMapRequestHandle_h
|
@ -59,4 +59,4 @@ private:
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_bluetooth_bluetoothpbaprequesthandle_h
|
||||
#endif // mozilla_dom_bluetooth_bluetoothpbaprequesthandle_h
|
||||
|
@ -37,6 +37,7 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
'common/webapi/BluetoothGattService.cpp',
|
||||
'common/webapi/BluetoothLeDeviceEvent.cpp',
|
||||
'common/webapi/BluetoothManager.cpp',
|
||||
'common/webapi/BluetoothMapRequestHandle.cpp',
|
||||
'common/webapi/BluetoothPairingHandle.cpp',
|
||||
'common/webapi/BluetoothPairingListener.cpp',
|
||||
'common/webapi/BluetoothPbapRequestHandle.cpp',
|
||||
@ -152,6 +153,7 @@ EXPORTS.mozilla.dom.bluetooth += [
|
||||
'common/webapi/BluetoothGattService.h',
|
||||
'common/webapi/BluetoothLeDeviceEvent.h',
|
||||
'common/webapi/BluetoothManager.h',
|
||||
'common/webapi/BluetoothMapRequestHandle.h',
|
||||
'common/webapi/BluetoothPairingHandle.h',
|
||||
'common/webapi/BluetoothPairingListener.h',
|
||||
'common/webapi/BluetoothPbapRequestHandle.h'
|
||||
|
@ -80,6 +80,30 @@ const kEventConstructors = {
|
||||
return new BluetoothPairingEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
BluetoothMapFolderListingEvent: { create: function (aName, aProps) {
|
||||
return new BluetoothMapFolderListingEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
BluetoothMapGetMessageEvent: { create: function (aName, aProps) {
|
||||
return new BluetoothMapGetMessageEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
BluetoothMapMessagesListingEvent: { create: function (aName, aProps) {
|
||||
return new BluetoothMapMessagesListingEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
BluetoothMapMessageUpdateEvent: { create: function (aName, aProps) {
|
||||
return new BluetoothMapMessageUpdateEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
BluetoothMapSendMessageEvent: { create: function (aName, aProps) {
|
||||
return new BluetoothMapSendMessageEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
BluetoothMapSetMessageStatusEvent: { create: function (aName, aProps) {
|
||||
return new BluetoothMapSetMessageStatusEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
BluetoothPhonebookPullingEvent: { create: function (aName, aProps) {
|
||||
return new BluetoothPhonebookPullingEvent(aName, aProps);
|
||||
},
|
||||
|
@ -219,6 +219,20 @@ var interfaceNamesInGlobalScope =
|
||||
{name: "BluetoothLeDeviceEvent", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothManager", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothMapFolderListingEvent", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothMapGetMessageEvent", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothMapMessagesListingEvent", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothMapMessageUpdateEvent", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothMapRequestHandle", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothMapSendMessageEvent", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothMapSetMessageStatusEvent", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "BluetoothPbapRequestHandle", b2g: true, permission: ["bluetooth"]},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
@ -78,6 +78,24 @@ interface BluetoothAdapter : EventTarget {
|
||||
// Fired when PBAP manager requests for 'pullvcardlisting'
|
||||
attribute EventHandler onpullvcardlistingreq;
|
||||
|
||||
// Fired when remote devices request to list SMS/MMS/Email folders
|
||||
attribute EventHandler onmapfolderlistingreq;
|
||||
|
||||
// Fired when remote devices request to list SMS/MMS/Email messages
|
||||
attribute EventHandler onmapmessageslistingreq;
|
||||
|
||||
// Fired when remote devices fetch the specific message
|
||||
attribute EventHandler onmapgetmessagereq;
|
||||
|
||||
// Fired when remote devices set message status
|
||||
attribute EventHandler onmapsetmessagestatusreq;
|
||||
|
||||
// Fired when remote devices send out SMS/MMS/Email message
|
||||
attribute EventHandler onmapsendmessagereq;
|
||||
|
||||
// Fired when remote devices download SMS/MMS/Email messages
|
||||
attribute EventHandler onmapmessageupdatereq;
|
||||
|
||||
/**
|
||||
* Enable/Disable a local bluetooth adapter by asynchronus methods and return
|
||||
* its result through a Promise.
|
||||
|
24
dom/webidl/BluetoothMapFolderListingEvent.webidl
Normal file
24
dom/webidl/BluetoothMapFolderListingEvent.webidl
Normal file
@ -0,0 +1,24 @@
|
||||
/* -*- 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 BluetoothMapFolderListingEventInit eventInitDict)]
|
||||
interface BluetoothMapFolderListingEvent : Event
|
||||
{
|
||||
readonly attribute unsigned long maxListCount;
|
||||
readonly attribute unsigned long listStartOffset;
|
||||
|
||||
readonly attribute BluetoothMapRequestHandle? handle;
|
||||
};
|
||||
|
||||
dictionary BluetoothMapFolderListingEventInit : EventInit
|
||||
{
|
||||
unsigned long maxListCount = 0;
|
||||
unsigned long listStartOffset = 0;
|
||||
|
||||
BluetoothMapRequestHandle? handle = null;
|
||||
};
|
24
dom/webidl/BluetoothMapGetMessageEvent.webidl
Normal file
24
dom/webidl/BluetoothMapGetMessageEvent.webidl
Normal file
@ -0,0 +1,24 @@
|
||||
/* -*- 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 BluetoothMapGetMessageEventInit eventInitDict)]
|
||||
interface BluetoothMapGetMessageEvent : Event
|
||||
{
|
||||
readonly attribute boolean hasAttachment;
|
||||
readonly attribute FilterCharset charset;
|
||||
|
||||
readonly attribute BluetoothMapRequestHandle? handle;
|
||||
};
|
||||
|
||||
dictionary BluetoothMapGetMessageEventInit : EventInit
|
||||
{
|
||||
boolean hasAttachment = false;
|
||||
FilterCharset charset = "utf-8";
|
||||
|
||||
BluetoothMapRequestHandle? handle = null;
|
||||
};
|
22
dom/webidl/BluetoothMapMessageUpdateEvent.webidl
Normal file
22
dom/webidl/BluetoothMapMessageUpdateEvent.webidl
Normal file
@ -0,0 +1,22 @@
|
||||
/* -*- 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 BluetoothMapMessageUpdateEventInit eventInitDict)]
|
||||
interface BluetoothMapMessageUpdateEvent : Event
|
||||
{
|
||||
readonly attribute unsigned long instanceId;
|
||||
|
||||
readonly attribute BluetoothMapRequestHandle? handle;
|
||||
};
|
||||
|
||||
dictionary BluetoothMapMessageUpdateEventInit : EventInit
|
||||
{
|
||||
unsigned long instanceId = 0;
|
||||
|
||||
BluetoothMapRequestHandle? handle = null;
|
||||
};
|
43
dom/webidl/BluetoothMapMessagesListingEvent.webidl
Normal file
43
dom/webidl/BluetoothMapMessagesListingEvent.webidl
Normal file
@ -0,0 +1,43 @@
|
||||
/* -*- 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 BluetoothMapMessagesListingEventInit eventInitDict)]
|
||||
interface BluetoothMapMessagesListingEvent : Event
|
||||
{
|
||||
readonly attribute unsigned long maxListCount;
|
||||
readonly attribute unsigned long listStartOffset;
|
||||
readonly attribute unsigned long subjectLength;
|
||||
[Cached, Constant]
|
||||
readonly attribute sequence<ParameterMask> parameterMask;
|
||||
readonly attribute MessageType filterMessageType;
|
||||
readonly attribute DOMString filterPeriodBegin;
|
||||
readonly attribute DOMString filterPeriodEnd;
|
||||
readonly attribute ReadStatus filterReadStatus;
|
||||
readonly attribute DOMString filterRecipient;
|
||||
readonly attribute DOMString filterOriginator;
|
||||
readonly attribute Priority filterPriority;
|
||||
|
||||
readonly attribute BluetoothMapRequestHandle? handle;
|
||||
};
|
||||
|
||||
dictionary BluetoothMapMessagesListingEventInit : EventInit
|
||||
{
|
||||
unsigned long maxListCount = 0;
|
||||
unsigned long listStartOffset = 0;
|
||||
unsigned long subjectLength = 0;
|
||||
sequence<ParameterMask> parameterMask = [];
|
||||
MessageType filterMessageType = "no-filtering";
|
||||
DOMString filterPeriodBegin = "";
|
||||
DOMString filterPeriodEnd = "";
|
||||
ReadStatus filterReadStatus = "no-filtering";
|
||||
DOMString filterRecipient = "";
|
||||
DOMString filterOriginator = "";
|
||||
Priority filterPriority = "no-filtering";
|
||||
|
||||
BluetoothMapRequestHandle? handle = null;
|
||||
};
|
62
dom/webidl/BluetoothMapParameters.webidl
Normal file
62
dom/webidl/BluetoothMapParameters.webidl
Normal file
@ -0,0 +1,62 @@
|
||||
/* -*- 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/.
|
||||
*/
|
||||
|
||||
/**
|
||||
* MAP Application Parameters
|
||||
*/
|
||||
enum MessageType
|
||||
{
|
||||
"no-filtering",
|
||||
"sms",
|
||||
"email",
|
||||
"mms"
|
||||
};
|
||||
|
||||
enum ReadStatus
|
||||
{
|
||||
"no-filtering",
|
||||
"unread",
|
||||
"read"
|
||||
};
|
||||
|
||||
enum Priority
|
||||
{
|
||||
"no-filtering",
|
||||
"high-priority",
|
||||
"non-priority"
|
||||
};
|
||||
|
||||
enum ParameterMask
|
||||
{
|
||||
"subject",
|
||||
"datetime",
|
||||
"sender_name",
|
||||
"sender_addressing",
|
||||
"recipient_name",
|
||||
"recipient_addressing",
|
||||
"type",
|
||||
"size",
|
||||
"reception_status",
|
||||
"text",
|
||||
"attachment_size",
|
||||
"priority",
|
||||
"read",
|
||||
"sent",
|
||||
"protected",
|
||||
"replyto_addressing",
|
||||
};
|
||||
|
||||
enum FilterCharset
|
||||
{
|
||||
"native",
|
||||
"utf-8"
|
||||
};
|
||||
|
||||
enum StatusIndicators
|
||||
{
|
||||
"readstatus",
|
||||
"deletedstatus"
|
||||
};
|
55
dom/webidl/BluetoothMapRequestHandle.webidl
Normal file
55
dom/webidl/BluetoothMapRequestHandle.webidl
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- 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 BluetoothMapRequestHandle
|
||||
{
|
||||
/**
|
||||
* Reply to Folder-Listing object for MAP request. The Promise will be
|
||||
* rejected if the MAP request operation fails.
|
||||
*/
|
||||
[NewObject, Throws, AvailableIn=CertifiedApps]
|
||||
Promise<void> replyToFolderListing(long masId, DOMString folders);
|
||||
|
||||
/**
|
||||
* Reply the Messages-Listing object to the MAP request. The Promise will
|
||||
* be rejected if the MAP request operation fails.
|
||||
*/
|
||||
[NewObject, Throws, AvailableIn=CertifiedApps]
|
||||
Promise<void> replyToMessagesListing(
|
||||
long masId,
|
||||
Blob messageslisting,
|
||||
boolean newmessage,
|
||||
DOMString timestamp,
|
||||
unsigned long size);
|
||||
|
||||
/**
|
||||
* Reply GetMessage object to the MAP request. The Promise will be rejected
|
||||
* if the MAP request operation fails.
|
||||
*/
|
||||
[NewObject, Throws, AvailableIn=CertifiedApps]
|
||||
Promise<void> replyToGetMessage(long masId, Blob bmessage);
|
||||
|
||||
/**
|
||||
* Reply SetMessage object to the MAP request. The Promise will be rejected
|
||||
* if the MAP request operation fails.
|
||||
*/
|
||||
[NewObject, Throws, AvailableIn=CertifiedApps]
|
||||
Promise<void> replyToSetMessageStatus(long masId, boolean status);
|
||||
|
||||
/**
|
||||
* Reply SendMessage request to the MAP request. The Promise will be rejected
|
||||
* if the MAP request operation fails.
|
||||
*/
|
||||
[NewObject, Throws, AvailableIn=CertifiedApps]
|
||||
Promise<void> replyToSendMessage(long masId, boolean status);
|
||||
|
||||
/**
|
||||
* Reply Message-Update object to the MAP request. The Promise will be
|
||||
* rejected if the MAP request operation fails.
|
||||
*/
|
||||
[NewObject, Throws, AvailableIn=CertifiedApps]
|
||||
Promise<void> replyToMessageUpdate(long masId, boolean status);
|
||||
};
|
26
dom/webidl/BluetoothMapSendMessageEvent.webidl
Normal file
26
dom/webidl/BluetoothMapSendMessageEvent.webidl
Normal file
@ -0,0 +1,26 @@
|
||||
/* -*- 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 BluetoothMapSendMessageEventInit eventInitDict)]
|
||||
interface BluetoothMapSendMessageEvent : Event
|
||||
{
|
||||
readonly attribute DOMString recipient;
|
||||
readonly attribute DOMString messageBody;
|
||||
readonly attribute unsigned long retry;
|
||||
|
||||
readonly attribute BluetoothMapRequestHandle? handle;
|
||||
};
|
||||
|
||||
dictionary BluetoothMapSendMessageEventInit : EventInit
|
||||
{
|
||||
DOMString recipient = "";
|
||||
DOMString messageBody = "";
|
||||
unsigned long retry = 0;
|
||||
|
||||
BluetoothMapRequestHandle? handle = null;
|
||||
};
|
26
dom/webidl/BluetoothMapSetMessageStatusEvent.webidl
Normal file
26
dom/webidl/BluetoothMapSetMessageStatusEvent.webidl
Normal file
@ -0,0 +1,26 @@
|
||||
/* -*- 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 BluetoothMapSetMessageStatusEventInit eventInitDict)]
|
||||
interface BluetoothMapSetMessageStatusEvent : Event
|
||||
{
|
||||
readonly attribute unsigned long handleId;
|
||||
readonly attribute StatusIndicators statusIndicator;
|
||||
readonly attribute boolean statusValue;
|
||||
|
||||
readonly attribute BluetoothMapRequestHandle? handle;
|
||||
};
|
||||
|
||||
dictionary BluetoothMapSetMessageStatusEventInit : EventInit
|
||||
{
|
||||
unsigned long handleId = 0;
|
||||
StatusIndicators statusIndicator = "readstatus";
|
||||
boolean statusValue = false;
|
||||
|
||||
BluetoothMapRequestHandle? handle = null;
|
||||
};
|
@ -694,6 +694,8 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
'BluetoothGattService.webidl',
|
||||
'BluetoothLeDeviceEvent.webidl',
|
||||
'BluetoothManager.webidl',
|
||||
'BluetoothMapParameters.webidl',
|
||||
'BluetoothMapRequestHandle.webidl',
|
||||
'BluetoothPairingHandle.webidl',
|
||||
'BluetoothPairingListener.webidl',
|
||||
'BluetoothPbapParameters.webidl',
|
||||
@ -846,6 +848,12 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
'BluetoothAttributeEvent.webidl',
|
||||
'BluetoothDeviceEvent.webidl',
|
||||
'BluetoothGattCharacteristicEvent.webidl',
|
||||
'BluetoothMapFolderListingEvent.webidl',
|
||||
'BluetoothMapGetMessageEvent.webidl',
|
||||
'BluetoothMapMessagesListingEvent.webidl',
|
||||
'BluetoothMapMessageUpdateEvent.webidl',
|
||||
'BluetoothMapSendMessageEvent.webidl',
|
||||
'BluetoothMapSetMessageStatusEvent.webidl',
|
||||
'BluetoothPairingEvent.webidl',
|
||||
'BluetoothPhonebookPullingEvent.webidl',
|
||||
'BluetoothStatusChangedEvent.webidl',
|
||||
|
Loading…
Reference in New Issue
Block a user