Skip to content

Commit

Permalink
Bug 828837:Fix COD equals 0x20080c cause icon empty, r=echou
Browse files Browse the repository at this point in the history
  • Loading branch information
shuangMoz committed Feb 1, 2013
1 parent dd69c28 commit 3ae6821
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions dom/bluetooth/linux/BluetoothDBusService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,23 @@ GetPropertyIndex(Properties* prop, const char* propertyName,
return -1;
}

bool
HasAudioService(uint32_t aCodValue)
{
return ((aCodValue & 0x200000) == 0x200000);
}

bool
ContainsIcon(const InfallibleTArray<BluetoothNamedValue>& aProperties)
{
for (uint8_t i = 0; i < aProperties.Length(); i++) {
if (aProperties[i].name().EqualsLiteral("Icon")) {
return true;
}
}
return false;
}

bool
GetProperty(DBusMessageIter aIter, Properties* aPropertyTypes,
int aPropertyTypeLen, int* aPropIndex,
Expand Down Expand Up @@ -1375,6 +1392,26 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
v.get_ArrayOfBluetoothNamedValue()
.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("Path"),
path));
const InfallibleTArray<BluetoothNamedValue>& properties =
v.get_ArrayOfBluetoothNamedValue();
if (!ContainsIcon(properties)) {
for (uint8_t i = 0; i < properties.Length(); i++) {
// It is possible that property Icon missed due to CoD of major
// class is TOY but service class is "Audio", we need to assign
// Icon as audio-card. This is for PTS test TC_AG_COD_BV_02_I.
// As HFP specification defined that
// service class is "Audio" can be considered as HFP AG.
if (properties[i].name().EqualsLiteral("Class")) {
if (HasAudioService(properties[i].value().get_uint32_t())) {
v.get_ArrayOfBluetoothNamedValue()
.AppendElement(
BluetoothNamedValue(NS_LITERAL_STRING("Icon"),
NS_LITERAL_STRING("audio-card")));
}
break;
}
}
}
}
} else {
errorStr.AssignLiteral("DBus device found message structure not as expected!");
Expand Down

0 comments on commit 3ae6821

Please sign in to comment.