BOSS Implementation
1. Fundamental Features
- Tx Packets.
- Rx Packets from specific sender.
- Set Bluetooth ID to each ubertooth device
- Manually set address.
- Auto generate ID.
- Code packet generator:
- Control PDU
- ADV_IND.
- ADV_DIRECT_IND
- ADV_NONCONN_IND
- ADV_SCAN_IND
- SCAN_REQ.
- SCAN_RSP.
- CONNECT_REQ
- Data PDU
- LL Data PDU (empty one)
- LLID: 01
- Length: 00000
- Missing setting the received values of SeqNum & nextSeqNum from both master and Slave.
- LL Data PDU (empty one)
- Control PDU
- Received Pkts:
- set correct Adresses, i.e., AdvAdr & initAdr
- set timing parameters.
2. BLE States
2.1 Advertising
- Inform host of "Entering Advertising State"
- Introduce the Logic in initAdvertisingStateBoss() in bluetooth_rxtx.c
- Calculate advInterval, advDelay, and T_advEvent.
- Set channel index [37, 38, 39].
- Send an Advertising packet, i.e., ADV_IND.
- Wait for CONNECT_REQ request for T_advEvent period to enter Connection State
- IF no CONNECT_REQ, move to next adv channel and repeat sending Advertising packet.
2.2 Initiating
- Inform user of "Starting Initiating state".
- Introduce the Logic in initInitiatingStateBoss() in bluetooth_rxtx.c.
- Insert device addresses:
- InitA: current device BT ID.
- AdvA: device sending advertising pkts.
- Receive advertising pkts from AdvA.
- Generate CONNECT_REQ pkt.
- Transmit CONNECT_REQ.
- Move to Connecting state.
- Inform host of Entering Connection State
2.3 Connection
- Inform user of "Entering Connection state as a YY with device XXX", where YY is a master or slave and XXX is the ID of the other party.
- Introduce the Logic in initConnectionStateBoss() in bluetooth_rxtx.c
2.3.1 Channel Selection Algorithm
- Channel Map:
- used channels: used data channels for the connection. min number is 2.
- unused channels: unused data channels in this connection.
- Assume the channel map has all channels available. CAN BE RELAXED LATER.
- Channel Selection Algorithm:
- Calculate unmapped channel index.
- mapping the index to a data channel from the unused set.
- Parameters:
- unmappedChannel: unmapped channel index for the current connection event.
- lastUnmappedChannel: unmapped channel index of previous connection event.
- remappingIndex: in case of selection a channel from the unused map, this is used to remap the index to one of the used channels.
- numUsedChannels: number of used channels in the channel map.
unmappedChannel = (lastUnmappedChannel + hopIncrement) mod 37
IF unmappedChannel NOT IN used Channel map
remappingIndex = unmappedChannel mod numUsedChannels
END
lastUnmappedChannel = unmappedChannel of previous connection, 0 in initial connection
2.3.2 Master & Slave
- connEventCounter
- 16-bit counter.
- Set to zero (0x0000) on first connection event
- master: incr on sending a new connection event
- slave: incr for each connection event.
2.3.3 Master
Coming from Initiating state.
- Calculate connSupervisionTimeout.
- If connSupervisionTimeout times out without receiving a packet.
- Move to STANDBY State.
- Calculate transmitWindowOffset and transmitWindowSize.
- Reset connSuperVisionTimeout
- Generate first Data PDU.
- Select a data channel .
- wait for transmitWindowOffset+1.25ms.
- send first data pkt within transmitWindowSize
- wait for ""T_IFS" for a response from slave
- YES, move to next channel and send next pkt after connInterval
- NO, move to STANDBY state
2.3.4 Slave
Coming from Advertising state.
- Notify Host: "Slave connection is created!".
- Reset connSuperVisionTimeout.
- Choose a channel index.
- Listen to a packet within transmitWindowSize.
- YES
- If FIRST Then, set anchor point and timing parameters.
- respond
- switch channel.
- No
- Attempt to Rx in other TransmitWindow till the end of connInterval.
- switch channel,
- Expect for a transmitWindowSize. If still No, move to STANDBY State.
- YES
2.4 Scanning
- Passive
2.5 Standby
- Inform user of "Entering Standby State".
- Terminate the host request.