I want to send string from char array using BLE
I add custom service in Profiles (BLE configuration),
What should I do next?
Just set the GATT attribute for you char array to the value you need. When the GATT client next time read the attribute it gets the value (or it anbled notification, then it can get the value as soon as its written).
Can somebody tell my step by step how to send string?
I'm working on BLE_Keyboard example project.
Based on Caspesne BLE video:
In BLE configuroations -> Profiles -> HID over GATT i added:
Custom service named: POINTS ->
Custom Characteristic named: LIST ->
Client Characteristic Configuration
In main body i add:
char tekst = "A:50;B:60" ;
punktyHandle.attrHandle = CYBLE_POINTS_LIST_CHAR_HANDLE;
punktyHandle.value.val = &tekst;
punktyHandle.value.len = 10;
CyBle_GattsWriteAttributeValue( &punktyHandle, 0, &cyBle_connHandle, 0);
But it does not work.
The data you are sending is custom in nature where as you are trying to use the Standard BLE Service for HID.
I suggest you refer to the application note AN91162 (www.cypress.com/documentation/application-notes/an91162-creating-ble-cus...). This should get you in the right direction for implementing what you want.
It works with uint8 array... now i wonder witch type of filed should I choose in Custom characteristic to send String " (for example: "A:10;B:33;C:50") and then which type sholuld have xData;
Handle.attrHandle = attrHandle;
Handle.value.val = xData;
Handle.value.len = len;
Should i choose utf8s?
xData should by always uint8?
Is there any simple way to convert char to uint8?
The characteristic interface is in form of uint8*. So the data you receive from or assing to .value.val is in form of uint8*. If you have any other data type, then you should typecase into this form.