Skip to content

Commit

Permalink
clarify msd
Browse files Browse the repository at this point in the history
  • Loading branch information
chipweinberger committed Nov 8, 2024
1 parent 6cb16f4 commit eb1ae84
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/src/flutter_blue_plus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -788,13 +788,17 @@ class AdvertisementData {
final Map<Guid, List<int>> serviceData; // key: service guid
final List<Guid> serviceUuids;

/// raw manufacturer specific data
/// for convenience, raw msd data
/// * interprets the first two byte as raw data,
/// as opposed to a `manufacturerId`
List<List<int>> get msd {
List<List<int>> out = [];
manufacturerData.forEach((key, value) {
out.add([key & 0xFF, (key >> 8) & 0xFF] + value);
List<List<int>> output = [];
manufacturerData.forEach((manufacturerId, bytes) {
int low = manufacturerId & 0xFF;
int high = (manufacturerId >> 8) & 0xFF;
output.add([low, high] + bytes);
});
return out;
return output;
}

AdvertisementData({
Expand Down

0 comments on commit eb1ae84

Please sign in to comment.