Transmiting acl data Packets |
In order to transmit a acl data packet one have to use the function billotooth_send_acl. Which is called, in our model, on the client module.
handle_event_send - this function prepares the data to be sent using billotooth_send_acl.
billotooth_send_acl - this function requires a hci_conn structure, the actual data to transmit and its length. It then sets up a hci data packet setting this fields in the sk_buffer frame: dev receives the mydev structure, the pkt_type is set to HCI_ACLDATA_PKT(0x02). It also sets the hci_acl_hdr struture with, handle as the packing of the connection's handle, and the flags (PB flag as ACL_START (0x02) and BC flag zeroed). Sets the data length field as actual length provided. With the sk_buffer frame set it sends it to billotooth_send_frame.
billotooth_send_frame - this function takes out the owner field of the skb frame and passes to the hci_usb layer.
on the other side the receiving end of the acl data transmission receives an acl data packet on the billotooth_recv_frame.
billotooth_recv_frame - this function receives an incoming frame in the form of a sk_buffer. It then look in the packet type field of the skb frame and switches to the appropriate function.
In this case the frame is an HCI ACL DATA PACKET, so the billotooth_recv_frame calls the hci_acldata_packet function.
hci_acldata_packet - what this function does is take the data packet and send it to each receptor on the list of receptor that was set during the module registering. It passes the packet on the function registered, like so: list_receptors[i](skb->data+HCI_ACL_HDR_SIZE) where, skb->data is the data received and the HCI_ACL_HDR_SIZE is just so it offsets the data right.
handle_ event_ recv - this the function saved on the billotooth_register_mod. It receives the data field from the transmission and handles it accordingly.
And this is how we send a acl data packet. To send larger data, one have to fragmentize the original data into smaller packets and reassemble it back together on the other end. |