how to read value sent by device in wireless uart demo (ble)?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to read value sent by device in wireless uart demo (ble)?

4,329 Views
mangramarco
Contributor III

Hello,

i use a board with wireless uart demo with kw41z mcu.

It works fine with nxp iot toolbox app so i can reach BleApp_GattServerCallback() function and execute my code.

Ex:

  1. static void BleApp_GattServerCallback (  
  2.                                        deviceId_t deviceId,  
  3.                                        gattServerEvent_t* pServerEvent)  
  4. {  
  5.     switch (pServerEvent->eventType)  
  6.     {  
  7.         case gEvtAttributeWrittenWithoutResponse_c:  
  8.         {  
  9.             if (pServerEvent->eventData.attributeWrittenEvent.handle == value_uart_stream)  
  10.             {  
  11.                 //custom code (e.g. Led toggle function )  
  12.                 BleApp_ReceivedUartStream(pServerEvent->eventData.attributeWrittenEvent.aValue,  
  13.                             pServerEvent->eventData.attributeWrittenEvent.cValueLength);  
  14.                 //custom code  
  15.             }  
  16.             break;  
  17.         }  
  18.     default:  
  19.         break;  
  20.     }  
  21. }  

into BleApp_ReceivedUartStream() function there is an echo service that send data OTA through BleApp_SendUartStream() function. The data sent with these function can be read by iot Toolbox app. It works fine.

Now i'm try tro create a UWP app in c# for work as iotToolBox.

I can find the ble device, connect to it and write the wireless_uart_characteristic.

I verify that my app can execute my custom code (eg. Led toggle) and i'm sure that it work correctly and i'm sure that device sent data by OTA.

unfortunately, i'm not able to read the data send by kw41z device.

With debugger i see that characteristic inside BleApp_SendUartStream() function has a uuid128 different from wireless uart characteristic uuid.

however i not found these uuid with my app and if i read the written characteristic, the value is the same that my app wrote.

i need help.

Best regards

Marco

Labels (3)
Tags (3)
0 Kudos
Reply
9 Replies

3,844 Views
mangramarco
Contributor III

Hello Estephania,

thank you for your reason.

If the Wirelessa UART application implemenths both gatt client and server therefore does my windows app need to implement gatt client and server?

Best regards

0 Kudos
Reply

3,844 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Yes, as this it's a custom and proprietary profile, it's not defined by the Bluetooth LE specification, so there is the need for you to add it in your application as well. 

Regards, 

Estephania 

3,844 Views
mangramarco
Contributor III

Hello Estephania, thank you!

in first time i tried to create a service and characteristic at laptop side but an exception occurred: my ble card not work as peripheral role.

However i tried with a simple android studio app and it works.

thank you.

i use this for transmit a few  message but now i need to create a stream of data from device to laptop. what do you suggest me?

thank you and best regards

Marco

0 Kudos
Reply

3,844 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

Do you mean to have the data directly in the computer? Sorry, it is not clear for me your problem

0 Kudos
Reply

3,844 Views
mangramarco
Contributor III

Hello Estephania, visual studio tell me that my ble dongle not work as peripheral role. However i tryied with android and it work with your suggestion. Thank you

marco

0 Kudos
Reply

3,844 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

You will need to modify the example you are using in order to make your dongle as a peripheral, still, i is good that it works correctly in android.

Regards,

Estephania

0 Kudos
Reply

3,844 Views
rui_bai
Contributor I

Hello Estephania,

I've met the question as Marco too. So about the "a custom and proprietary profile" , where can i find more detailed description to help me add it in my application.

Thanks a lot,

Rui

0 Kudos
Reply

3,844 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello,

You can check more about it in the documentation of the SDK and the examples there.

Regards,
Estephania

0 Kudos
Reply

3,844 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

The Wireless UART application implements both the GATT client and server for the custom Wireless UART profile and
services. The APP will need to implement service_wireless_uart otherwise the device will BleServDisc_FindService fails and disconnect.

Regards, 

Estephania 

0 Kudos
Reply