mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1186836 - Implement SetMessageStatus function, r=btian
This commit is contained in:
parent
72803bd36c
commit
55be2eae10
@ -333,7 +333,7 @@ BluetoothMapSmsManager::MasDataHandler(UnixSocketBuffer* aMessage)
|
||||
} else if (type.EqualsLiteral("x-bt/MAP-event-report")) {
|
||||
HandleEventReport(pktHeaders);
|
||||
} else if (type.EqualsLiteral("x-bt/messageStatus")) {
|
||||
HandleMessageStatus(pktHeaders);
|
||||
HandleSetMessageStatus(pktHeaders);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -801,6 +801,24 @@ BluetoothMapSmsManager::AppendBtNamedValueByTagId(
|
||||
AppendNamedValue(aValues, "charset", charset);
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::StatusIndicator: {
|
||||
uint8_t statusIndicator = *((uint8_t *)buf);
|
||||
// convert big endian to little endian
|
||||
statusIndicator = (statusIndicator >> 8) | (statusIndicator << 8);
|
||||
BT_LOGR("msg filter statusIndicator: %d", statusIndicator);
|
||||
AppendNamedValue(aValues, "statusIndicator",
|
||||
static_cast<uint32_t>(statusIndicator));
|
||||
break;
|
||||
}
|
||||
case Map::AppParametersTagId::StatusValue: {
|
||||
uint8_t statusValue = *((uint8_t *)buf);
|
||||
// convert big endian to little endian
|
||||
statusValue = (statusValue >> 8) | (statusValue << 8);
|
||||
BT_LOGR("msg filter statusvalue: %d", statusValue);
|
||||
AppendNamedValue(aValues, "statusValue",
|
||||
static_cast<uint32_t>(statusValue));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_LOGR("Unsupported AppParameterTag: %x", aTagId);
|
||||
break;
|
||||
@ -937,9 +955,29 @@ BluetoothMapSmsManager::HandleEventReport(const ObexHeaderSet& aHeader)
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothMapSmsManager::HandleMessageStatus(const ObexHeaderSet& aHeader)
|
||||
BluetoothMapSmsManager::HandleSetMessageStatus(const ObexHeaderSet& aHeader)
|
||||
{
|
||||
// TODO: Handle MessageStatus update in Bug 1186836
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> data;
|
||||
nsString name;
|
||||
aHeader.GetName(name);
|
||||
/* The Name header shall contain the handle of the message the status of which
|
||||
* shall be modified. The handle shall be represented by a null-terminated
|
||||
* Unicode text string with 16 hexadecimal digits.
|
||||
*/
|
||||
AppendNamedValue(data, "handle", name);
|
||||
|
||||
AppendBtNamedValueByTagId(aHeader, data,
|
||||
Map::AppParametersTagId::StatusIndicator);
|
||||
AppendBtNamedValueByTagId(aHeader, data,
|
||||
Map::AppParametersTagId::StatusValue);
|
||||
|
||||
bs->DistributeSignal(NS_LITERAL_STRING(MAP_SET_MESSAGE_STATUS_REQ_ID),
|
||||
NS_LITERAL_STRING(KEY_ADAPTER), data);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -94,7 +94,7 @@ private:
|
||||
|
||||
void HandleNotificationRegistration(const ObexHeaderSet& aHeader);
|
||||
void HandleEventReport(const ObexHeaderSet& aHeader);
|
||||
void HandleMessageStatus(const ObexHeaderSet& aHeader);
|
||||
void HandleSetMessageStatus(const ObexHeaderSet& aHeader);
|
||||
void HandleSmsMmsFolderListing(const ObexHeaderSet& aHeader);
|
||||
void HandleSmsMmsMsgListing(const ObexHeaderSet& aHeader);
|
||||
void HandleSmsMmsGetMessage(const ObexHeaderSet& aHeader);
|
||||
|
@ -197,6 +197,12 @@ extern bool gBluetoothDebugFlag;
|
||||
*/
|
||||
#define MAP_GET_MESSAGE_REQ_ID "mapgetmessagereq"
|
||||
|
||||
/**
|
||||
* When receiving a MAP request of 'set message' from a remote device,
|
||||
* we'll dispatch an event.
|
||||
*/
|
||||
#define MAP_SET_MESSAGE_STATUS_REQ_ID "mapsetmessagestatusreq"
|
||||
|
||||
/**
|
||||
* When the value of a characteristic of a remote BLE device changes, we'll
|
||||
* dispatch an event
|
||||
|
Loading…
Reference in New Issue
Block a user