SWRA648 May   2019 CC1352P , CC1352R , CC1354P10 , CC1354R10 , CC2642R , CC2642R-Q1 , CC2652P , CC2652R , CC2652R7 , CC2652RB , CC2652RSIP

 

  1.   Bluetooth Low Energy Tree Structure Network
    1.     Trademarks
    2. 1 Introduction
    3. 2 Bluetooth Low Energy Basic Knowledge
    4. 3 Three Kinds of Bluetooth Low Energy Network Structure
      1. 3.1 Star Network
      2. 3.2 Mesh
      3. 3.3 Tree Structure Network
    5. 4 Bluetooth Low Energy Tree Structure Network Analysis
      1. 4.1 Role Analysis in Bluetooth Low Energy Tree Structure
      2. 4.2 Tree Structure Network Establishment Analysis
    6. 5 Bluetooth Low Energy Tree Structure Network Realization
      1. 5.1 Tree Structure Establishment
      2. 5.2 Role Differentiation in Tree Structure Network
      3. 5.3 Data Transmission in Tree Structure Network
    7. 6 Bluetooth Low Energy tree Structure Network Test
    8. 7 References

Role Differentiation in Tree Structure Network

According to Section 2, in the tree structure the grandpa node is always a central device. The child nodes are always peripheral role devices. But the father node needs to be both. When in the connection to the grandpa node, it is peripheral role, and when in the connection to the child nodes, it is a central role. This peripheral role to central role changing behavior can be used to identify the father node. If the node’s role is changed after the GAP link establishment event, for example, from peripheral to the central, then the node can be identified as a father in the network. The sample code is shown in below:

// Update the role type when the lnk established uint8_t role = ((gapEstLinkReqEvent_t*) pMsg)->connRole; static uint8_t last_role; // Judge the role change if ( ( (role == GAP_PROFILE_CENTRAL) && (last_role == GAP_PROFILE_PERIPHERAL) ) || ( (role == GAP_PROFILE_PERIPHERAL) && (last_role == GAP_PROFILE_CENTRAL) ) ) my_role = GAP_PROFILE_MULTIROLE; else my_role = role; // Save the last role state last_role = role