Hello,
Basically what I'am trying to do is to, upon initialization, write a value of 0x01 to the characteristic configuration at handle 0x0034 of the simple keys profile to turn on key press notifications. This will eliminate the need for me to do this in BTool every time i connect the dongle to the key fob. I just want the notifications to be on as soon as I establish a connection. I thought this would be pretty simple, and it probably is but don't fully understand how the handles work. It looks to me that in simplekeys.c, all the handles are initialized to zero? shouldn't they already be initialized with values like 0x0033, 0x0034?
// Characteristic Value- Key Pressed { { ATT_BT_UUID_SIZE, keyPressedUUID }, // keyPressedUUID = 0xFFE1 0, // Permissions 0, // Handle &skKeyPressed // pValue },
// Characteristic configuration { { ATT_BT_UUID_SIZE, clientCharCfgUUID }, // clientCharCfgUUID = 0x2902 GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, // <- 0x0034??? (uint8 *)skConfig // <- 0x01??? },
If someone could explain to me how handles are initialized and where and I can change the default characteristic configuration value to 0x01 that would be great.
bStatus_t SK_AddService( uint32 services ){ uint8 status = SUCCESS;
// Initialize Client Characteristic Configuration attributes for ( uint8 i = 0; i < GATT_MAX_NUM_CONN; i++ ) { I tried changing values skConfig[i].connHandle = INVALID_CONNHANDLE; <-here 0x0034 skConfig[i].value = GATT_CFG_NO_OPERATION; <-and here 0x01
} doesn't work.
Good question, would like to know either.
Eric
The handles are assigned at compile time and incrementally whenever you add a service. For the Simple Keys, the method SK_AddService is calling 'GATTServApp_RegisterService' to register the services and I believe it is there where it is assigned a handle. Maybe TI personnel can confirm that. Depending on the call structure, the handles can be different based on services registered. see keyfobdemo.c in function 'KeyFobApp_Init'. Hope that helps.
I am interested in knowing how to auto turn on notification if you figured it out.
~LD
Some Ti support would be appreciated.
I think it is a BLE question, not TI question...
http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.client_characteristic_configuration.xml
Notifications can be enabled after a link has been established.
One way to do this is to register a callback for GAP profile state change - you can pass it to GAPRole_StartDevice - and in this callback you enable notifications for the desired characteristic whenever the gap role_State_t parameter passed to it is equal to GAPROLE_CONNECTED.
To enable notifications I call the GATTServApp_WriteCharCfg function, I don't know if there is another way.
Pierre
Using the BTool, we first have to use service discovery to acquire the profile handle; then enable the notification. You suggest that once connected, you can do that which is true but how to tell which profile notification we the master is turning ON?
Maybe a TI's personnel can help point out the documentation where this is stated more clearly on how to do it.
thanks
Hi,
The information available about GATTServApp_WriteCharCfg in the GATT server API documentation is rather succinct, but you should take a look at it nonetheless :)
I suppose somewhere in your source code you have an array of gattAttribute_t that defines the attributes of your profile. Well, a gattAttribute_t structure has a handle member which is described as follows in gatt.h: "Attribute handle - assigned internally by attribute server". So that's how you retrieve an attribute handle.
Otherwise I think what you really need is GATTServApp_WriteCharCfg which only needs a pointer to the gattCharCfg_t structure you want to target.
Best Regards,
P.S: I edited my answer after noticing I was confusing GATTServApp_WriteCharCfg with GATTServApp_ProcessCCCWriteReq.