4 Replies Latest reply on Jun 24, 2016 2:48 AM by phateee_1677816

    Communication between 2 BLE units

    phateee_1677816

      Hello,

         

      can me somebody help, please? I want to make the communication between 2 BLE units. One unit sends reguest (my data) to second unit. Than second unit sends the response (another data - my data).

         

      I don¨t know, if each unit has to be defined as Client and Server unit or not.

         

      Communication:  

         

      1. first unit sends reguest (my data - combination of sensors)

         

      2  second unit receives this data from first unit

         

      3. second unit reads the sensor values

         

      4. second unit sends data (sensor values)

         

      5. first units receives data from first unit

         

      I haven't find any example with this type of communication. In examples, there is only case, that client sends request and than server sends response. 

         

      Thank you... 

        • 1. Re: Communication between 2 BLE units
          user_78878863

          As long as we are talking about the BLE GATT layer, one unit needs to be client and one the server. Typically the unit providing the values is the GATT server (your second unit). The client would write to a server attribute, indicating which sensors it wants to be read. Then the server provides values, probably via a notification.

             

          But with BLE this is inefficient - actually the server should periodically read the sensors, and provide the values in its GATT attributes. When the client needs the values, it just reads the attributes and gets the current values.

          • 2. Re: Communication between 2 BLE units
            phateee_1677816

            Thank You for answer. Unit with sensor will send values every 1s, otherside it will be deep sleep. My plan is to connect three unit  (slaves ) with sensors to one unit (master), which will process data from these units. For this case is better first or second variant?

            • 3. Re: Communication between 2 BLE units
              user_78878863

              The Cypress BLE stack can handle only one connection at a time, so your scenario will not work without some special logic (round-robin connection from the master to the slaves).

                 

              The second version is much more energy efficient. If you have a fixed timing, the sensor units can wake up once per second, read their sensor and then send a notification to the master.

              1 of 1 people found this helpful
              • 4. Re: Communication between 2 BLE units
                phateee_1677816

                So, I will use notify property. Can be the communication this way?

                   

                1.Client:  CyBle_GattcWriteCharacteristicValue 

                   

                2. Server accepts data in CyBle_GattsWriteRsp

                   

                3. Server sends ack connection:  CyBle_GattsWriteRsp

                   

                4. Server sends the notification (there is a new data): CyBle_GattsNotification

                   

                5. Client accepts data in CYBLE_EVT_GATTC_HANDLE_VALUE_NTF

                   

                OR

                   

                1.Client:  CyBle_GattcWriteCharacteristicValue 

                   

                2. Server accepts data in CyBle_GattsWriteRsp

                   

                4.Server sends the new data in the notification (without CyBle_GattsWriteRsp) : CyBle_GattsNotification

                   

                5. Client accepts data in CYBLE_EVT_GATTC_HANDLE_VALUE_NTF

                   

                It is a question, if I can send the new data in case CYBLE_EVT_GATTS_WRITE_REQ (I read data from client and send the data in the same time) with CyBle_GattsNotification?