3 Replies Latest reply on Sep 7, 2015 12:24 AM by userc_40761

    Configure and Write Custom Service

       Hi, i am new here, i have PSOC4200 BLE, and i am developing a firm with i need to send some data and read other data. Send data over sensors, and receive data about diferent mode of operation. 


      I have an android APP, to manage this information. My board asume the role of GATT Server Peripheral. Send data over Custom Service, and the APP receive this information and show it.


      The UUID of the services, on the APP are:




      public class SampleGattAttributes {


          private static HashMap<String, String> attributes = new HashMap();


          public static String VALORES_REGISTRO = "0000fff0-0000-1000-8000-00805f9b34fb";


          public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";




          public static String VALORES_SERVICIO_POSICION = "0000fff0-0000-1000-8000-00805f9b34fb";


          public static String VALORES_CARACTERISTICA_FRONTAL = "0000fff1-0000-1000-8000-00805f9b34fb";


          public static String VALORES_CARACTERISTICA_TRASERO = "0000fff2-0000-1000-8000-00805f9b34fb";




          public static String VALORES_SERVICIO_MOTOR = "0000fff0-0000-1000-8000-00805f9b34fb";


          public static String VALORES_CARACTERISTICA_MOTOR = "0000fff3-0000-1000-8000-00805f9b34fb";




          public static String VALORES_SERVICIO_ALARMA = "0000fff0-0000-1000-8000-00805f9b34fb";


          public static String VALORES_CARACTERISTICA_ALARMA_FRONTAL = "0000fff6-0000-1000-8000-00805f9b34fb";




          public static String VALORES_SERVICIO_MODO = "0000fff0-0000-1000-8000-00805f9b34fb";


          public static String VALORES_CARACTERISTICA_MODO = "0000fff7-0000-1000-8000-00805f9b34fb";




          public static String VALORES_CARACTERISTICA_NOTIFICACION = "0000fff4-0000-1000-8000-00805f9b34fb";




          static {


              // Sample Characteristics.


              attributes.put(VALORES_REGISTRO, "Device Data");


              attributes.put("0000fff3-0000-1000-8000-00805f9b34fb", "Valor Guardado");





          I have other board that it is working with this APP, my goal, is to change this board and use PSOC BLE.   
          I need to write the atributtes values over gatt, and i think that the Client (APP) must be read it.   
          Now, i have the same services with the same UUIDs, and i write the values using:   
           /* Valor del manejador para actualizar CCCD */    
                   CYBLE_GATT_HANDLE_VALUE_PAIR_T Motors_values;    
                   Motors_value = 0xFF;    
                    /*Actualizamos el manejador CCCD con los nuevos valores de notificaciones*/    
                    Motors_values.attrHandle = CYBLE_ADC_1_MOTORES_CHAR_HANDLE;    
                    Motors_values.value.val = &Motors_value;    
                    Motors_values.value.len = ADC_NTF_DATA_LEN;    
                       /* Enviamos datos a componente BLE para mandarlos cuando lea el dispositivo central*/    
                    CyBle_GattsWriteAttributeValue(&Motors_values, ZERO, &connectionHandle, CYBLE_GATT_DB_LOCALLY_INITIATED);    
           But it doesnt work, i dont really care, if i need to use         CyBle_GattsWriteRsp(connectionHandle);      after WritteAttribute.     
           I place the write code every second, with WDT routine, to update the sensor value....    
           When i write the new value, the only thing that need to do the Client is to read this value i think, i am wrong?    
           I dont use notifications, only Write/Read.    
           Thanks for all    
           (PD: Sorry for my english, i am improving it)