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

Data Transmission in Tree Structure Network

For top-down write function, the data packet includes the commands and destination node router index, so the grandpa node writes the data to the appointed father node according to the router index. The father node receives the data in GATT message process function, then it decides whether this data is destined for itself or one of its child nodes. If the data is meant for the father node itself, the father node directly executes the data. If the data is meant for a child node, the father node forwards the data to the target child node. Then, the top-down transmission is finished. For more details, see Figure 10 and .

top-down-write.pngFigure 10. Top-Down Write
// Noted that newValue[0] is reserved in the example code // newValue[2] = '0', message to father, no transmit if (newValue[2] == '0') { Display_printf(dispHandle, MR_ROW_my_message, 0, "Get message %s", newValue); PIN_setOutputValue(ledPinHandle, Board_PIN_RLED, newValue[3] & 0x01); // set/reset Led } //newValue[2] != '0', message to child, transmit to the appointed child else if ( (newValue[2] - 48) <= (valid_table_sum - 1) ) { child_index = newValue[2] - 48; state = multi_role_doSelectConn(child_index); if (state == false) Display_printf(dispHandle, MR_ROW_doSelectConn, 0, "doSelectConn fail: %d", child_index); else { multi_role_doGattWriteString(connList[child_index].connHandle, newValue); // Transmit the data } }

For the bottom-up notify, the father node knows the index of the child node that sent the notification, and the grandpa node knows the index of the father node that sent the notification. For the grandpa node to distinguish which child node that originated the notification, the father node adds the index information in the notification data from the child node before the notification is forwarded to the grandpa node. To distinguish whether the notification’s source is the father node or a child node, adding “00” (2 bytes for write data alignment) before the payload data means the notification is from father node. Now, the grandpa node can know where the notification came from. Then, the down-top notification function is finished. For more details, see Figure 11 and .

down-top-notify.pngFigure 11. Down-Top Notify
// Noted that pMsg->data[0] is reserved in the example code // order number in tree = connHandle pMsg->data[2] = '0' + pMsg->connHandle; memcpy(noti.pValue, pMsg->data, SIMPLEPROFILE_CHAR1_LEN); //Forward the notification status = GATT_Notification( grandfather_index, &noti, FALSE );