HIDS Database Description

2 posts / 0 new
Last post
awesley
Offline
Last seen:2 years 10 months ago
加入:2015-07-07 12:08
HIDS Database Description

const struct attm_desc hids_att_db[HOGPD_IDX_NB] ={

// HID Service Declaration
[HOGPD_IDX_SVC] = {ATT_DECL_PRIMARY_SERVICE,
PERM(RD, ENABLE),
sizeof(hid_svc), sizeof(hid_svc),
(uint8_t *)&hid_svc},
// HID Service Declaration
[HOGPD_IDX_INCL_SVC] = {ATT_DECL_INCLUDE,
PERM(RD, ENABLE),
sizeof(struct att_incl_desc), 0,
NULL},

// HID Information Characteristic Declaration
[HOGPD_IDX_HID_INFO_CHAR] = {ATT_DECL_CHARACTERISTIC,
PERM(RD, ENABLE),
sizeof(hids_hid_info_char), sizeof(hids_hid_info_char),
(uint8_t *)&hids_hid_info_char},

// HID Information Characteristic Value
[HOGPD_IDX_HID_INFO_VAL] = {ATT_CHAR_HID_INFO,
PERM(RD, ENABLE),
sizeof(struct hids_hid_info), 0,
NULL},
// HID Control Point Characteristic Declaration
[HOGPD_IDX_HID_CTNL_PT_CHAR] = {ATT_DECL_CHARACTERISTIC,
PERM(RD, ENABLE),
sizeof(hids_hid_ctnl_pt_char), sizeof(hids_hid_ctnl_pt_char),
(uint8_t *)&hids_hid_ctnl_pt_char},
// HID Control Point Characteristic Value
[HOGPD_IDX_HID_CTNL_PT_VAL] = {ATT_CHAR_HID_CTNL_PT,
PERM(WR, ENABLE),
sizeof(uint8_t), 0,
NULL},
// Report Map Characteristic Declaration
[HOGPD_IDX_REPORT_MAP_CHAR] = {ATT_DECL_CHARACTERISTIC,
PERM(RD, ENABLE),
sizeof(hids_report_map_char), sizeof(hids_report_map_char),
(uint8_t *)&hids_report_map_char},

// Report Map Characteristic Value
[HOGPD_IDX_REPORT_MAP_VAL] = {ATT_CHAR_REPORT_MAP,
PERM(RD, ENABLE),
HOGPD_REPORT_MAP_MAX_LEN*sizeof(uint8_t), 0,
NULL},

// Report Map Characteristic - External Report Reference Descriptor
[HOGPD_IDX_REPORT_MAP_EXT_REP_REF] = {ATT_DESC_EXT_REPORT_REF,
PERM(RD, ENABLE),
sizeof(uint16_t), 0,
NULL},

...
}

There are some methods to set the value of "HID Information Characteristic Value" and other Characteristic Value ??
I just found "hogpd_set_report_map_req_handler" that is a function to set "Report Map Characteristic Value"

I try to create a function that is similar to "hogpd_set_report_map_req_handler". The function run , but it did not work.

static int hogpd_set_hid_info_val_req_handler(ke_msg_id_t const msgid,
struct hogpd_set_report_map_req const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
// Status
uint8_t status = PRF_ERR_INVALID_PARAM;

// Check Report map value length
if (param->report_map_len <= sizeof(struct hids_hid_info))
{
// Check HIDS instance - The Report Map Characteristic is mandatory and has been added.
if (param->hids_nb < hogpd_env.hids_nb)
{
// Set Report Map Char. Value
#ifndef USE_ONE_HIDS_INSTANCE
status = attmdb_att_set_value(hogpd_env.shdl[param->hids_nb] + hogpd_env.att_tbl[param->hids_nb][HOGPD_HID_INFO_CHAR] + 1,
param->report_map_len,
(uint8_t *)¶m->report_map[0]);
#else
status = attmdb_att_set_value(hogpd_env.shdl[0] + hogpd_env.att_tbl[0][HOGPD_HID_INFO_CHAR] + 1,
param->report_map_len,
(uint8_t *)¶m->report_map[0]);
#endif
}
else
{
// Report Map Char. is not in the DB - Request disallowed
status = PRF_ERR_REQ_DISALLOWED;
}
}

if (status != PRF_ERR_OK)
{
// The connection doesn't exist, request disallowed
prf_server_error_ind_send((prf_env_struct *)&hogpd_env, status,
HOGPD_ERROR_IND, HOGPD_SET_CHAR_VAL_REQ);
}

return (KE_MSG_CONSUMED);
}

Device:
MT_dialog
Offline
Last seen:6 days 20 hours ago
Staff
加入:2015-06-08 11:34
Hi awesley,

Hi awesley,

The only thing i can see that is changed from the example function is that you 've replaced the HOGPD_REPORT_MAP_MAX_LEN (512) with the size of a structure that is 32 bytes is this size enough for your report map? I guess that if the function returned no error but the device didn't work maybe you should check your report map.

Thanks MT_dialog