Configure and Write Custom Service

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

cross mob
Anonymous
Not applicable

 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    
    
          
    
     Carlos    
    
          
    
     (PD: Sorry for my english, i am improving it)    
   
0 Likes
1 Solution
Anonymous
Not applicable

Please also have a look at AN91162- Creating BLE custom profiles: http://www.cypress.com/documentation/application-notes/an91162-creating-ble-custom-profile

   

This has codes for read and write requests.

View solution in original post

0 Likes
3 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Maybe this might help -

   

 

   

    

   

          

   

http://www.cypress.com/?rID=109900     AN91162 - Creating a BLE Custom Profile

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Please also have a look at AN91162- Creating BLE custom profiles: http://www.cypress.com/documentation/application-notes/an91162-creating-ble-custom-profile

   

This has codes for read and write requests.

0 Likes
Anonymous
Not applicable

Thanks for All,

   

I have resolved the problem, 

0 Likes