bluetooth-hci-decoder
bluetooth-hci-decoder copied to clipboard
Construction of the HCI ACL Packet wrong?
First of all thanks for providing this great library. I've however run into a problem with it. When constructing a ACL Packet you use the following code:
hci_acl(const std::vector<char> &data){
connection_handle = ((data[ACL_FRAME_OFFSET] & 0x0F)<<8) + (data[ACL_FRAME_OFFSET+1]);
packet_boundary_flag = (data[ACL_FRAME_OFFSET+1] & 0x30)>>4;
broadcast_flag = (data[ACL_FRAME_OFFSET+1] & 0xC0)>>6;
data_total_length = data[ACL_FRAME_OFFSET+2] + (data[ACL_FRAME_OFFSET+3]<<8);
for (unsigned int i = 0; i < data_total_length;i++){
acl_data.push_back(data[i]+ACL_FRAME_OFFSET+4);
}
}
When looking at the HCI ACL Spec the handle is 12 bits, the PB Flag is 2 bits, the Broadcast Flag is 2 bits and the total data length is 2 byte. I don't completly understand your provided code. Could you explain why you use the ACL_FRAME_OFFSET and how this bit manipulation works. Could it be that the calculation of the payload data is wrong because i've ran into some issues in my Application where im trying to reconstruct L2CAP Packets from these ACL Packets.