/// <summary> /// Parse <c>advD</c> payload data from advertising packet. You should never need to call this from client code, platform /// libraries should handle it. /// </summary> public static IEnumerable<AdvertisingDataItem> ParseAdvertisingPayloadData( Byte[] advD ) { var records = new List<AdvertisingDataItem>(); var index = 0; while(index < advD?.Length) { var length = advD[index]; index++; if(length > 0) { var type = advD[index]; var data = advD.Slice( index + 1, index + length ); index += length; records.Add( new AdvertisingDataItem( (AdvertisingDataType)type, data ) ); } } return records; }