1212 errNotYetImplmented = errors .New ("bluetooth: not implemented" )
1313)
1414
15+ const (
16+ // Public address
17+ GAPAddressTypePublic = 0x00
18+ // Random Static address
19+ GAPAddressTypeRandomStatic = 0x01
20+ // Private Resolvable address
21+ GAPAddressTypeRandomPrivateResolvable = 0x02
22+ // Private Non-Resolvable address
23+ GAPAddressTypeRandomPrivateNonResolvable = 0x03
24+ )
25+
1526// MACAddress contains a Bluetooth address which is a MAC address.
1627type MACAddress struct {
1728 // MAC address of the Bluetooth device.
@@ -313,7 +324,7 @@ func (buf *rawAdvertisementPayload) HasServiceUUID(uuid UUID) bool {
313324// ManufacturerData returns the manufacturer data in the advertisement payload.
314325func (buf * rawAdvertisementPayload ) ManufacturerData () []ManufacturerDataElement {
315326 var manufacturerData []ManufacturerDataElement
316- for index := 0 ; index < int (buf .len )+ 4 ; index += int (buf .data [index ]) + 1 {
327+ for index := 0 ; index < int (buf .len ); index += int (buf .data [index ]) + 1 {
317328 fieldLength := int (buf .data [index + 0 ])
318329 if fieldLength < 3 {
319330 continue
@@ -334,7 +345,7 @@ func (buf *rawAdvertisementPayload) ManufacturerData() []ManufacturerDataElement
334345// ServiceData returns the service data in the advertisment payload
335346func (buf * rawAdvertisementPayload ) ServiceData () []ServiceDataElement {
336347 var serviceData []ServiceDataElement
337- for index := 0 ; index < int (buf .len )+ 4 ; index += int (buf .data [index ]) + 1 {
348+ for index := 0 ; index < int (buf .len ); index += int (buf .data [index ]) + 1 {
338349 fieldLength := int (buf .data [index + 0 ])
339350 if fieldLength < 3 { // field has only length and type and no data
340351 continue
0 commit comments