Dear Sirs,
我已经制作了一个包含一些标准BLE服务和2个自定义服务的应用程序。根据您的SDK的例子,所有内容都运行100%。也就是说,除了一个服务之外。
Custom service 1 is fine, but I've defined custom service 2 having a single characteristic with notification. To be sure I didn't miss anything I've been following the way the BAS service is implemented in the SDK, and I've defined and implemented my custom service accordingly (with 128 bit UUID's). But when I use a BLE App on a smartphone the custom service 2 doesn't show the symbols for having notification properties. Also, the Client Characteristic Configuration (UUID 0x2902) doesn't show.
Could you perhaps give me a hint if this is a known issue, or (most probably) what I could be doing wrong ?
最亲切的问候,
Peter
Device:

Hidevelopment@clickey.eu,
In the SDK, i assume that you are using the latest 5.0.4, so there is no implementation for the CUSTS2 profile, you will have to make some file addition in order to get things to work so please try to follow the link belowhttps://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ....
After doing that you should have a functional second custom profile, in order to send notifications to that profile, for example using a timer, just set a timer and in the callback you can use the following snippets in order to send data.
void app_adcval2_timer_cb_handler()
{
struct custs2_val_ntf_req* req = KE_MSG_ALLOC_DYN(CUSTS2_VAL_NTF_REQ,
TASK_CUSTS2,
TASK_APP,
custs2_val_ntf_req,
DEF_CUST2_ADC_VAL_1_CHAR_LEN);
// ADC value to be sampled
static uint16_t sample;
sample = (sample <= 0xffff) ? (sample + 1) : 0;
req->conhdl = app_env->conhdl;
req->handle = CUST2_IDX_ADC_VAL_1_VAL;
req->length = DEF_CUST2_ADC_VAL_1_CHAR_LEN;
memcpy(req->value, &sample, DEF_CUST2_ADC_VAL_1_CHAR_LEN);
ke_msg_send(req);
if(ke_state_get(task_app)== app_connected)
{
// Set it once again until Stop command is received in Control Characteristic
timer2_used = app_easy_timer(app_peripheral_ctrl_timer_delay_2,app_adcval2_timer_cb_handler);
}
}
So if you have the custom profile up and running make sure that the message that allocates the notification is using the proper handles in order to update the proper value of the characteristic of the second profile.
Thanks MT_dialog
Thanks for the explanation,
At first I followed the info as given in your Video tutorial about custom profiles (in SDK 5.0.4). In this explanation I was told both custom profiles are implemented in the SDK. But when I started my own application based on the SDK's template I already discovered that custs2 was not present. So I had earlier taken the steps as proposed in the forum-post 'custom-profile-multiple-services'. This worked fine, but my problem lies beyond .....
In custs2 I added a characteristic that should be notifiable. When I start the smartphone-app the symbol for notifications shows, but it has no effect at all. So, I've been searching through the SDK and examples (like BASS), but I can't seem to find if/what I probably should implement to get it working. In the BASS for instance a message BASS_BATT_LEVEL_NTF_CFG_IND is present, but in CUSTS2 this is not the case.
I know how to update a characteristic's value (for instance timer based), but in my understanding I have to use a message like CUSTS2_CHAR_NTF_CFG_IND to inform the system to start/stop updating the characteristic's value ?
指针进入正确的方向会非常好:-)
Peter
Thanks MT_dialog,
My problem has been solved :-)
After some experiments I copied functionality from the SDK's example "ble_app_peripheral". Now I can enable/disable notification perfectly !
Peter
Hi,
Glad you found it,
FYI the snippet that i ve attached, sends a notification to the central and used the CUSTS2_VAL_NTF_REQ message in order to do so. You can take the custs1 profile as an example in order to implement what you would like. The custs2 works the same way the custs1 does. If you take the first custom profile as an example you will be able to implement the second. You will able to find the CUSTS2_VAL_NTF_REQ message in the custs2_task.h file in the sdk_profiles folder (not imported in keil's folder you will have to import it from the SDK).
The message that you ve posted from the battery profile doesn't send a notification, its the message that it is generated to the application when you enable the configuration characteristic from a central.
Thanks MT_dialog
Thanks. I'm prety sure I'll encounter som more 'problems' in the near future :-)