Link Controller:
The link controller implements the Blutooth baseband protocol.
In the Bluetooth system, the link manager uses the services of the link controller to implement the LMP(link Manger protocol).
CONCEPT:
1. Addresses:
Each BT device is assigned a 48-bit address consisting of three parts: a 24-bit lower address part (LAP) and 8-bit uppder address part(UPA), and a 16-bit so called non-significant address part(NAP).LAP and UAP address parts are used in several places in the Baseband protocol. The 32-bit concatenation of the upper and lower address parts is also used and abbreviated as ULAP.
2. Channels:
The BT standerd uses a number of of diffeerent channels, located at different radio frequencies, to communicate data. Channel hopping, i.e. periodic switching between channels, is used to reduce the impact of other radio sources disturbing particular channels, and to enable the existence of multiple BT network in one area.
3. Clocks and slots:
The BT clock is a 28-bit counter with a clock cycle of 312us.BT communicate at the Baseband level is organised into time slot. Each slot has length of two clock cycle.
4. PACKETS:
BT communicateion at the Baseband level is packet-oriented. Anumber of different packet types of varying lengh and with varying error correction and detection facilites are defined. Packets occupy one, three, or five time slots.
5. PICONETS:
The master in a piconet determines slot timing, the channel hopping sequence, and slot allocation. Slave have to adjust to the master's parameters.
6. INQUIRY Procedure: The inquiry procedure enables devices to locate other devices in its vicinity. The inquiring device build up a list of neighbouring devices.
7. PAGE Procedure: It enables devices to establish connection b/w each other. A device page scan mode to listen for packets. On hearing a page packet addressd to itself, the scanning device send a page response. Two more packets are exchanged before a link is fully set up.
NOTE: As the result of the page procedure, the scanning device becomes a slave in the paging device's piconet.
*** Master/slave switch: Sometimes it may be necessary to switch roles in an existing connection, i.e a master may need to join a slave's piconet. Instead of using the page procedure again, they can agree (at the LMP level) to use the Baseband master/slave switch procedure.
8. ACL Links:
Packets on an Asynchronous connection -less link are sent in the next availabel slot. Since there can be contention for slots and transmission errors, they are not guaranteed to arrive within a certain time. Error correction adn detecetion together with flow control ensure though, that packets are eventually delivered, and that happens in the oreder they were sent. ACL links can therfore be compared to TCP internet connection.
An ACL link b/w two devices is established through using the page or master/slave switch procedure. Normally there will only be one ACL link b/w two devices, but there might be a second with exchanged master/slave roles.
Each device can maintain up to fourteen ACL links: up to seven links to slaves in its own piconet, and up to seven links to master of the other piconets
9. SCO links:
Synchronuous connection-orinted links reserved time slot at regular interval. Packets are guaranteed to be sent in the next reserved slot. Error correcction and detection can be used, but flow control is not provided. If an uncorrected transmission error occurs, the packet is lost. SCO link are therfore best suited to real-time data link audio or video where a continous data flow is more important tath data correctness. SCO link might best be compared to ISDN connections.
Two devices can use an existing ACL link to agree on the parameters for the establishment of an SCO link. Each SCO link is associated with an underlying ACL link. there can be multiple SCO links per ACL, i.e. multiple SCO links b/w two devices. Each devices can have up to Three SCO links altogether.
10. Broadcast:
The master of a piconet has the ability to broadcast ACL packets to all its connected slaves, whereby flow control is not provided.
Broadcast is implemented as an additional ACL link, which is availabe by default and over which packets can only be sent but not received. As a slave, broadcast packets are received on the same ACL link as other packets from the current master.
11. Link timeouts:
According to the Baseband specification, a newly established ACL link needs to be verified by the exchange of initial (possibly empty) packets. If that does not happen within a timeout period of 32 slots, the link is removed and the link manager is notified through the new_connection_timeout callback
Also, if no packet is received from a device within a timeout period of 16000 slots (i.e. 20 seconds), the ACL link to that device is removed and the link manager is notified through the supervision_timeout callback
12. Receive buffers:
As there are only one ACL and one SCO receive buffer, no link identifiers are needed here.
An incoming packet is signalled through a rx_reg_loaded c
After a packet has been read and, if necessary, the payload has been copied, it can be removed from the buffer using a clear_rx_reg command.
13. Transmit buffers
Transmit buffer commands take as their second argument the ID of the ACL or SCO link that the targeted buffer is associated with.
To load a packet into a SCO or ACL transmit buffer, the following two operations are used. The packet type must fit the link type, and for ACL links, the maximum slot number must be adhered to. For ACL packets, the packet length must not be greater than the maximum length allowed for the packet type. For SCO packets, the packet length is implicit in the type. The actual payload is provided through a pointer.
After a packet has been sent and, in the case of ACL links, acknowledged successfully,
14. SCO link establishment:
SCO link parameters have to be agreed at the LMP level. Using the add_sco_link command, the link manager can then tell the link controller about the new link.
Two IDs must be provided: an unused SCO link ID for the new link, and a used ACL link ID that denotes the master or slave device to connect to.
************************************************************************
Generic Steps follow up after BT ON:
A: Inquiry: A device in a new environment will automatically initate an inquriy to discover what access pints are within its range.
B: Paging: A baseband procedure invoked by a device which results in synchronization of the device with the access point.
C: Link establishment: The LMP will now establish a link with the access point. If security mode 3, then pairing begins at this layer.
D: Service Discovery: The LMP will use the SDP (service discovery protocol) to discover what device are available.
E: L2CAP channel created : with information obtained from SDP a L2cap channel is created. this may be directly used by the application or by another protocol (eg. RFCOMM, AVCTP etc)
F: Pairing: begins her if the security mode 2. --> then it will ask for the pin and create the link key and share it with remote device.
The link controller implements the Blutooth baseband protocol.
In the Bluetooth system, the link manager uses the services of the link controller to implement the LMP(link Manger protocol).
CONCEPT:
1. Addresses:
Each BT device is assigned a 48-bit address consisting of three parts: a 24-bit lower address part (LAP) and 8-bit uppder address part(UPA), and a 16-bit so called non-significant address part(NAP).LAP and UAP address parts are used in several places in the Baseband protocol. The 32-bit concatenation of the upper and lower address parts is also used and abbreviated as ULAP.
2. Channels:
The BT standerd uses a number of of diffeerent channels, located at different radio frequencies, to communicate data. Channel hopping, i.e. periodic switching between channels, is used to reduce the impact of other radio sources disturbing particular channels, and to enable the existence of multiple BT network in one area.
3. Clocks and slots:
The BT clock is a 28-bit counter with a clock cycle of 312us.BT communicate at the Baseband level is organised into time slot. Each slot has length of two clock cycle.
4. PACKETS:
BT communicateion at the Baseband level is packet-oriented. Anumber of different packet types of varying lengh and with varying error correction and detection facilites are defined. Packets occupy one, three, or five time slots.
5. PICONETS:
The master in a piconet determines slot timing, the channel hopping sequence, and slot allocation. Slave have to adjust to the master's parameters.
6. INQUIRY Procedure: The inquiry procedure enables devices to locate other devices in its vicinity. The inquiring device build up a list of neighbouring devices.
7. PAGE Procedure: It enables devices to establish connection b/w each other. A device page scan mode to listen for packets. On hearing a page packet addressd to itself, the scanning device send a page response. Two more packets are exchanged before a link is fully set up.
NOTE: As the result of the page procedure, the scanning device becomes a slave in the paging device's piconet.
*** Master/slave switch: Sometimes it may be necessary to switch roles in an existing connection, i.e a master may need to join a slave's piconet. Instead of using the page procedure again, they can agree (at the LMP level) to use the Baseband master/slave switch procedure.
8. ACL Links:
Packets on an Asynchronous connection -less link are sent in the next availabel slot. Since there can be contention for slots and transmission errors, they are not guaranteed to arrive within a certain time. Error correction adn detecetion together with flow control ensure though, that packets are eventually delivered, and that happens in the oreder they were sent. ACL links can therfore be compared to TCP internet connection.
An ACL link b/w two devices is established through using the page or master/slave switch procedure. Normally there will only be one ACL link b/w two devices, but there might be a second with exchanged master/slave roles.
Each device can maintain up to fourteen ACL links: up to seven links to slaves in its own piconet, and up to seven links to master of the other piconets
9. SCO links:
Synchronuous connection-orinted links reserved time slot at regular interval. Packets are guaranteed to be sent in the next reserved slot. Error correcction and detection can be used, but flow control is not provided. If an uncorrected transmission error occurs, the packet is lost. SCO link are therfore best suited to real-time data link audio or video where a continous data flow is more important tath data correctness. SCO link might best be compared to ISDN connections.
Two devices can use an existing ACL link to agree on the parameters for the establishment of an SCO link. Each SCO link is associated with an underlying ACL link. there can be multiple SCO links per ACL, i.e. multiple SCO links b/w two devices. Each devices can have up to Three SCO links altogether.
10. Broadcast:
The master of a piconet has the ability to broadcast ACL packets to all its connected slaves, whereby flow control is not provided.
Broadcast is implemented as an additional ACL link, which is availabe by default and over which packets can only be sent but not received. As a slave, broadcast packets are received on the same ACL link as other packets from the current master.
11. Link timeouts:
According to the Baseband specification, a newly established ACL link needs to be verified by the exchange of initial (possibly empty) packets. If that does not happen within a timeout period of 32 slots, the link is removed and the link manager is notified through the new_connection_timeout callback
Also, if no packet is received from a device within a timeout period of 16000 slots (i.e. 20 seconds), the ACL link to that device is removed and the link manager is notified through the supervision_timeout callback
12. Receive buffers:
As there are only one ACL and one SCO receive buffer, no link identifiers are needed here.
An incoming packet is signalled through a rx_reg_loaded c
After a packet has been read and, if necessary, the payload has been copied, it can be removed from the buffer using a clear_rx_reg command.
13. Transmit buffers
Transmit buffer commands take as their second argument the ID of the ACL or SCO link that the targeted buffer is associated with.
To load a packet into a SCO or ACL transmit buffer, the following two operations are used. The packet type must fit the link type, and for ACL links, the maximum slot number must be adhered to. For ACL packets, the packet length must not be greater than the maximum length allowed for the packet type. For SCO packets, the packet length is implicit in the type. The actual payload is provided through a pointer.
After a packet has been sent and, in the case of ACL links, acknowledged successfully,
14. SCO link establishment:
SCO link parameters have to be agreed at the LMP level. Using the add_sco_link command, the link manager can then tell the link controller about the new link.
Two IDs must be provided: an unused SCO link ID for the new link, and a used ACL link ID that denotes the master or slave device to connect to.
************************************************************************
Generic Steps follow up after BT ON:
A: Inquiry: A device in a new environment will automatically initate an inquriy to discover what access pints are within its range.
B: Paging: A baseband procedure invoked by a device which results in synchronization of the device with the access point.
C: Link establishment: The LMP will now establish a link with the access point. If security mode 3, then pairing begins at this layer.
D: Service Discovery: The LMP will use the SDP (service discovery protocol) to discover what device are available.
E: L2CAP channel created : with information obtained from SDP a L2cap channel is created. this may be directly used by the application or by another protocol (eg. RFCOMM, AVCTP etc)
F: Pairing: begins her if the security mode 2. --> then it will ask for the pin and create the link key and share it with remote device.