Hi Dialog
I add two charactristics in custom profile service(refer to sample128), and I can read the value by use a android phone.
But I fail to write the characteristic value in the service.What's the problem?
It seems that I can't receivce the msg(GATTC_WRITE_CMD_IND).Is there anything wrong in my code?
static int gattc_write_cmd_ind_handler(ke_msg_id_t const msgid,
struct gattc_write_cmd_ind const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
uint8_t char_code = SAMPLE128_ERR_CHAR;
uint8_t status = PRF_APP_ERROR;
if (KE_IDX_GET(src_id) == simpleKey_env.con_info.conidx)
{
if(param->handle == simpleKey_env.sample128_shdl + SIMPLE_KEY_VAL1)
{
char_code = SIMPLE_KEY_VAL1;
}
else if(param->handle == simpleKey_env.sample128_shdl + SIMPLE_KEY_CFG2)
{
char_code = SIMPLE_KEY_CFG2;
}
switch(char_code)
{
case SIMPLE_KEY_VAL1:
attmdb_att_set_value(param->handle,
sizeof(uint8_t),
(uint8_t *)¶m->value[0]);
if(param->last)
{
sample128_send_val(param->value[0]);
}
status = PRF_ERR_OK;
break;
case SIMPLE_KEY_CFG2:
uint16_t ntf_cfg;
ntf_cfg = co_read16p(¶m->value[0]);
if ((ntf_cfg == PRF_CLI_STOP_NTFIND) || (ntf_cfg == PRF_CLI_START_NTF))
{
attmdb_att_set_value(param->handle, sizeof(uint16_t), (uint8_t *)¶m->value[0]);
if (ntf_cfg == PRF_CLI_START_NTF)
{
simpleKey_env.feature |= PRF_CLI_START_NTF;
}
else
{
simpleKey_env.feature &= ~PRF_CLI_START_NTF;
}
status = PRF_ERR_OK;
}
break;
default:break;
}
}
atts_write_rsp_send(simpleKey_env.con_info.conidx, param->handle, PRF_ERR_OK);
return (KE_MSG_CONSUMED);
}
I have solved the problem,it's cause by careless.
I set the permission of characteristic readable but not writable.
好的,谢谢Sklin . .
Hello Sklin and JE_Dialog,
Sklin, you said in the post the following "I add two characteristics in custom profile service(refer to sample128),". Would you please clarify where did you add those characteristics ? in what structure, and in what file i mean.
Thanks in advance.
Hi krishnacr,
You can use the Connection manager with the USB Dongle or with any development kit and operate it as central, or you can use any generic application for BLE on android play store like BLE Scanner, B-BLE etc.
Regarding the throughput question, there is no generic tool from dialog that will allow you to measure the throughput of your application or a thirdparty application as far as i know. If you wish to test your application the test should be application specific.
Thanks MT_dialog