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.
  • Received Pkts:
    • set correct Adresses, i.e., AdvAdr & initAdr 
    • set timing parameters. 

2. BLE States

2.1 Advertising

  1. Inform host of "Entering Advertising State"
  2. Introduce the Logic in initAdvertisingStateBoss() in bluetooth_rxtx.c
  3. Calculate advInterval, advDelay, and T_advEvent.
  4. Set channel index [37, 38, 39].
  5. Send an Advertising packet, i.e., ADV_IND.
  6. Wait for CONNECT_REQ request for T_advEvent period to enter Connection State
  7. IF no CONNECT_REQ, move to next adv channel and repeat sending Advertising packet.

2.2 Initiating

  1. Inform user of "Starting Initiating state".
  2. Introduce the Logic in initInitiatingStateBoss() in bluetooth_rxtx.c.
  3. Insert device addresses:
    1. InitA: current device BT ID.
    2. AdvA: device sending advertising pkts.
  4. Receive advertising pkts from AdvA.
  5. Generate CONNECT_REQ pkt.
  6. Transmit CONNECT_REQ.
  7. Move to Connecting state.
  8. 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.

2.4 Scanning

  1. Passive

2.5 Standby

  1. Inform user of "Entering Standby State".
  2. Terminate the host request.