Skip to content

Commit

Permalink
ninafw: can retrieve list of services
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Dec 28, 2023
1 parent cf57477 commit f1cc7b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 0 additions & 1 deletion att_ninafw.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ func (a *att) handleData(handle uint16, buf []byte) error {
a.responded = true

lengthPerService := int(buf[1])
//uuidLen := lengthPerService - 4

for i := 2; i < len(buf); i += lengthPerService {
service := rawService{
Expand Down
17 changes: 14 additions & 3 deletions hci_ninafw.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ func (h *hci) sendAclPkt(handle uint16, cid uint8, data []byte) error {

copy(h.buf[9:], data)

if _debug {
println("hci send acl data", handle, cid, hex.EncodeToString(h.buf[:9+len(data)]))
}

if _, err := h.uart.Write(h.buf[:9+len(data)]); err != nil {
return err
}
Expand Down Expand Up @@ -380,10 +384,16 @@ func (h *hci) handleACLData(buf []byte) error {
case attCID:
if aclFlags == 0x01 {
// TODO: use buffered packet
h.att.handleData(aclHdr.handle&0x0fff, buf[9:aclHdr.len+9])
if _debug {
println("WARNING: att.handleACLData needs buffered packet")
}
h.att.handleData(aclHdr.handle&0x0fff, buf[8:aclHdr.len+8])
} else {
// use the recv buffer
h.att.handleData(aclHdr.handle&0x0fff, buf[9:aclHdr.len+9])
h.att.handleData(aclHdr.handle&0x0fff, buf[8:aclHdr.len+8])
}
default:
if _debug {
println("unknown acl data cid", aclHdr.cid)
}
}

Expand Down Expand Up @@ -453,6 +463,7 @@ func (h *hci) handleEventData(buf []byte) error {
if _debug {
println("leMetaEventConnComplete")
}

h.connectData.connected = true
h.connectData.status = buf[3]
h.connectData.handle = binary.LittleEndian.Uint16(buf[4:])
Expand Down

0 comments on commit f1cc7b8

Please sign in to comment.