5 Replies Latest reply on Oct 28, 2015 11:32 PM by rohitk_

    BLE - Sending string


      I want to send string from char array using BLE
      I add custom service in Profiles (BLE configuration),
      What should I do next?

        • 1. Re: BLE - Sending string

          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).

          • 2. Re: BLE - Sending string

            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:


            CYBLE_GATTS_HANDLE_VALUE_NTF_T punktyHandle;
                            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.


            • 3. Re: BLE - Sending string

              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-custom-profile). This should get you in the right direction for implementing what you want.

              1 of 1 people found this helpful
              • 4. Re: BLE - Sending string

                OK, Thanks. 
                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? 

                • 5. Re: BLE - Sending string

                  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.

                  1 of 1 people found this helpful