1 Reply Latest reply on May 19, 2016 1:48 PM by Madhu Lakshmipathy

    Connect 3 devices successively

    s.lejeune_1616216

      Hello,

         

       

         

      we try to connect from cyble-022001-00  to 3 or 4  cyble-022001-00 successively.

         

      First : we build a array ( TONOFFC [][] ) with the mac addresses we want to connect to.       

         

      Second : we read the address in the array and setup the peer address after that we connect.

         

      Third  : We disconnect the ble . This code is managed in other condition because that doesn't work if it is in the previous condition.

         

      See below a part of our code :

         

      Main ()

         

      {

         

      ......

         

      while (1)

         

      ....

         

      {
                  peerAddr.bdAddr[0]=TONOFFC[intTest][5];
                  peerAddr.bdAddr[1]=TONOFFC[intTest][4];
                  peerAddr.bdAddr[2]=TONOFFC[intTest][3];  
                  peerAddr.bdAddr[3]=TONOFFC[intTest][2];  
                  peerAddr.bdAddr[4]=TONOFFC[intTest][1];   
                  peerAddr.bdAddr[5]=TONOFFC[intTest][0];
                  peerAddr.type  = 0;
                  CyBle_GapcConnectDevice(&peerAddr);
                  CyBle_ProcessEvents();          
                  }

         

           if(state==CONNECTED )
          {
              CyBle_GapDisconnect(cyBle_connHandle.bdHandle);  
              state=DISCONNECTED;
              CyDelay(200u);
              CyBle_ProcessEvents();  

         

          }

         

      }

         

      Result :

         

      For the moment only the first device of the array is working. the while loop works correctly because each variable change.

         

      But there is no connection to the second , third ... devices.

         

       

         

      If somebody have any idea , please help us.

         

       

         

      Nota : We already use this code for connect one cyble-022001-00 to another one and it works fine.