Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Construction of the HCI ACL Packet wrong? #3

Open
mx0c opened this issue Aug 30, 2020 · 0 comments · May be fixed by #5
Open

Construction of the HCI ACL Packet wrong? #3

mx0c opened this issue Aug 30, 2020 · 0 comments · May be fixed by #5

Comments

@mx0c
Copy link

mx0c commented Aug 30, 2020

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.

@mx0c mx0c changed the title Question about construction of the HCI ACL Packet Construction of the HCI ACL Packet wrong? Aug 30, 2020
@mx0c mx0c linked a pull request Oct 1, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant