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

cross mob
PSOC6_dev
Level 4
Level 4
10 questions asked 25 sign-ins 25 replies posted

Hi,

I have a little question.

My PSOC6 Device is in GATT peripheral mode and allows remote devices to connect and bond to it.

I use mtb2.4 and bless lib.

How I can have easily the remote bluetooth device name (pc name/smartphone name) when a connection is made

 

Thank you for your support,

Regards

0 Likes
1 Solution

Hi @Yugandhar 

Thank you for your feedback,

I made some search on how to do it and I found.

I share below in case if someone need it

					DEBUG_LOG("AUTHENTICATION_READ_CENTRAL_DEVICE_NAME");
					cy_stc_ble_gattc_read_by_type_req_t readByTypeReqParam;
					readByTypeReqParam.range.startHandle = CY_BLE_GATT_ATTR_HANDLE_START_RANGE;
					readByTypeReqParam.range.endHandle = CY_BLE_GATT_ATTR_HANDLE_END_RANGE;
					readByTypeReqParam.uuid.uuid16 = CY_BLE_UUID_CHAR_DEVICE_NAME;
					readByTypeReqParam.uuidFormat = CY_BLE_GATT_16_BIT_UUID_FORMAT;
					readByTypeReqParam.connHandle = conn_handle;

					ble_api_result = Cy_BLE_GATTC_ReadUsingCharacteristicUuid(&readByTypeReqParam);
					if(ble_api_result == CY_BLE_SUCCESS)
					{
						authState = AUTHENTICATION_READING_CENTRAL_DEV_NAME;
						/* Wait for CY_BLE_EVT_GATTC_READ_BY_TYPE_RSP event */
					}
					else
					{
						DEBUG_LOG("Cy_BLE_GATTC_ReadUsingCharacteristicUuid API Error: 0x%x \r\n", ble_api_result);
						authState = AUTHENTICATION_UPDATE_CONN_PARAM;
					}


 Regards

View solution in original post

0 Likes
2 Replies
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

In MTB, we would recommend to use the new AIROC BTStack. BLESS Stack will be discontinued, and this stack will be supported only with PSoC Creator.

There is no application level API to read the peer connected device's name. You can use the Cy_BLE_GAP_GetPeerBdAddr() API to read the peer connected device's address and can be used to identify the central device.

Thanks,
P Yugandhar.

0 Likes

Hi @Yugandhar 

Thank you for your feedback,

I made some search on how to do it and I found.

I share below in case if someone need it

					DEBUG_LOG("AUTHENTICATION_READ_CENTRAL_DEVICE_NAME");
					cy_stc_ble_gattc_read_by_type_req_t readByTypeReqParam;
					readByTypeReqParam.range.startHandle = CY_BLE_GATT_ATTR_HANDLE_START_RANGE;
					readByTypeReqParam.range.endHandle = CY_BLE_GATT_ATTR_HANDLE_END_RANGE;
					readByTypeReqParam.uuid.uuid16 = CY_BLE_UUID_CHAR_DEVICE_NAME;
					readByTypeReqParam.uuidFormat = CY_BLE_GATT_16_BIT_UUID_FORMAT;
					readByTypeReqParam.connHandle = conn_handle;

					ble_api_result = Cy_BLE_GATTC_ReadUsingCharacteristicUuid(&readByTypeReqParam);
					if(ble_api_result == CY_BLE_SUCCESS)
					{
						authState = AUTHENTICATION_READING_CENTRAL_DEV_NAME;
						/* Wait for CY_BLE_EVT_GATTC_READ_BY_TYPE_RSP event */
					}
					else
					{
						DEBUG_LOG("Cy_BLE_GATTC_ReadUsingCharacteristicUuid API Error: 0x%x \r\n", ble_api_result);
						authState = AUTHENTICATION_UPDATE_CONN_PARAM;
					}


 Regards

0 Likes