Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 6

Level 1
First like given
Level 1


I am having trouble understanding how to connect a ESS client to ESS server using the service UUID.

I edited the SimpleBLECentral code to scan for Bluetooth devices and connect to a server with a advertisement packet length of 30. This works fine but the client connects to any device with a packet length 30. I want to edit this by connecting to a ESS peripheral device (with the UUID 181A).

The SimpleBLECentral project compared the scanned servcie UUID with an expected UUID and if the are the same, it pairs and does whatever it needs to thereafter.

For my project I cannot find the required reference for the expected ESS UUID.  Is my approach incorrect? How do I get around this? Below is the particular snip of code i am working on. I have commented out the other if statements (SimpleBLECentral and the length statements) and highlighted where my issue is. My guess is there is no direct reference o the UUID, but I get lost when it comes to deciphering the structure pointers, and I am not confident i understand how they reference the correct member.

Additionally, I am having trouble actually printing out the UUID when I do connect to a ESS it in the message printed once. This is a minor issue but if you can see where my issue is as regards this, id be grateful if you can point me in the right direction.

Thanks in advance for any help.



            // Print Out Information about the Device that was found

            printf("Device ");


            cy_stc_ble_gapc_adv_report_param_t  *scanProgressParam = (cy_stc_ble_gapc_adv_report_param_t  *)eventParameter;


            printf("BD Addr: ");          

            for(unsigned int i=0;i<CY_BLE_BD_ADDR_SIZE;i++)


            printf("\tLength: %d ",scanProgressParam->dataLen);

            printf("\tRssi: %d",scanProgressParam->rssi);

            //printf("Data Received:\t\t%.*s\r\n\r\n",currentAdvInfo.sensorData_len, currentAdvInfo.sensorData);




            if(currentAdvInfo.name != 0)




            //if the advertised data length matches the scanned data length for EnviroSensor(25), attempt to connect


//            if(currentAdvInfo.servUUID_len > 0

//                && memcmp(currentAdvInfo.serviceUUID,cy_ble_customCServ [CY_BLE_CUSTOMC_LED_SERVICE_INDEX].uuid,

//                currentAdvInfo.servUUID_len) == 0)


               &&memcmp(currentAdvInfo.serviceUUID,cy_ble_ess , currentAdvInfo.servUUID_len)==0)


                Cy_GPIO_Write(GREEN_0_PORT, GREEN_0_NUM, 1);

                printf("\r\nFound ESS Service");

                cy_stc_ble_bd_addr_t connectAddr;

                memcpy(&connectAddr.bdAddr[0], &scanProgressParam->peerBdAddr[0] , CY_BLE_BD_ADDR_SIZE);

                connectAddr.type = scanProgressParam->peerAddrType;




                //if connection is successful



                    printf("\r\nConnection Success\r\n");                           //print information about connected device

                    printf("\r\nConnected to:\t\t");         //device name


                    printf("Name Length:\t\t%d \r\n",currentAdvInfo.name_len);      //length of device name

                    printf("Service UUID:\t");                               // uuid


                    printf("Data Received:\t\t%.*s\r\n\r\n",currentAdvInfo.sensorData_len, currentAdvInfo.sensorData);

                    Cy_GPIO_Write(LED9_0_PORT,LED9_0_NUM,0);                        //Light LED9   




1 Solution
Moderator 500 replies posted 250 solutions authored 250 replies posted

Obviously, you have get what you want in currentAdvInfo. The serviceUUID points to '0x1A' and ServUUID_len is 0x02. They are correct.

The problem is below printing sentence can not print the UUID correctly -


It is used to print a string, instead of hexadecimal number.

View solution in original post

6 Replies
Top labels