|
|
|
@ -387,7 +387,7 @@ func (buf *rawAdvertisementPayload) addServiceUUID(uuid UUID) (ok bool) {
|
|
|
|
|
// Don't bother with 32-bit UUID support, it doesn't seem to be used in
|
|
|
|
|
// practice.
|
|
|
|
|
if uuid.Is16Bit() {
|
|
|
|
|
if int(buf.len)+4 > len(buf.data) {
|
|
|
|
|
if int(buf.scanlen)+4 > len(buf.scandata) {
|
|
|
|
|
return false // UUID doesn't fit.
|
|
|
|
|
}
|
|
|
|
|
shortUUID := uuid.Get16Bit()
|
|
|
|
@ -395,7 +395,7 @@ func (buf *rawAdvertisementPayload) addServiceUUID(uuid UUID) (ok bool) {
|
|
|
|
|
buf.scandata[buf.scanlen+1] = 0x03 // type, 0x03 means "Complete List of 16-bit Service Class UUIDs"
|
|
|
|
|
buf.scandata[buf.scanlen+2] = byte(shortUUID)
|
|
|
|
|
buf.scandata[buf.scanlen+3] = byte(shortUUID >> 8)
|
|
|
|
|
buf.len += 4
|
|
|
|
|
buf.scanlen += 4
|
|
|
|
|
return true
|
|
|
|
|
} else {
|
|
|
|
|
if int(buf.len)+18 > len(buf.data) {
|
|
|
|
@ -405,7 +405,7 @@ func (buf *rawAdvertisementPayload) addServiceUUID(uuid UUID) (ok bool) {
|
|
|
|
|
buf.scandata[buf.scanlen+1] = 0x07 // type, 0x07 means "Complete List of 128-bit Service Class UUIDs"
|
|
|
|
|
rawUUID := uuid.Bytes()
|
|
|
|
|
copy(buf.scandata[buf.scanlen+2:], rawUUID[:])
|
|
|
|
|
buf.len += 18
|
|
|
|
|
buf.scanlen += 18
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|