Hi!
HID again. Inside "hids.device.c" I've added:
uint8_t hids_device_send_input_report_for_id_new(hci_con_handle_t con_handle, uint8_t num_attributes, uint16_t * attribute_handles, uint16_t * report_id, const uint8_t ** report, uint16_t * report_len){
hids_device_t * instance = hids_device_get_instance_for_con_handle(con_handle);
if (!instance){
log_error("no instance for handle 0x%02x", con_handle);
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
}
uint8_t pos;
hids_device_report_t * report_storage;
for (pos = 0 ; pos < num_attributes ; pos++){
report_storage = hids_device_get_report_for_id_and_type(instance, report_id[pos], HID_REPORT_TYPE_INPUT);
if (report_storage == NULL){
return ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
}
attribute_handles[pos] = report_storage->value_handle;
}
return att_server_multiple_notify(con_handle, num_attributes, attribute_handles, report, report_len);
}
with user code of:
uint8_t keyb_data[8] = {0, 0, 0x17, 0x08, 0x16, 0x17, 0x0C, 0x11};
uint8_t cons_data[1] = {0xEA};
uint8_t keyb_data_epty[8] = {0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t cons_data_epty[1] = {0x00};
uint16_t lgth_data[2] = {8, 1};
uint16_t rpid_data[2] = {0x01, 0x04};
const uint8_t *data_together[2] = {keyb_data, cons_data};
const uint8_t *data_together_epty[2] = {keyb_data_epty, cons_data_epty};
uint16_t attribute_handles[2];
while(true) {
hids_device_send_input_report_for_id(con_handle, 0x04, (uint8_t []){0xEA}, 1);
sleep_ms(30);
hids_device_send_input_report_for_id(con_handle, 0x04, (uint8_t []){0x00}, 1);
sleep_ms(1000);
hids_device_send_input_report_for_id(con_handle, 0x01, (uint8_t []){0, 0, 0x17, 0x08, 0x16, 0x17, 0x0C, 0x0A}, 8);
sleep_ms(30);
hids_device_send_input_report_for_id(con_handle, 0x01, (uint8_t []){0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8);
sleep_ms(1000);
result = hids_device_send_input_report_for_id_new(con_handle, 2, attribute_handles, rpid_data, data_together, lgth_data);
printf("Result: %d\r\n", result);
sleep_ms(30);
result = hids_device_send_input_report_for_id_new(con_handle, 2, attribute_handles, rpid_data, data_together_epty, lgth_data);
printf("Result_epty: %d\r\n", result);
sleep_ms(1000);
}
to access it.
hids_device_send_input_report_for_id() functions works fine as expected, but my hids_device_send_input_report_for_id_new() is not. It returns with "0" data are sen, but it doesn't trigger any key presses. Tested alone as well, without hids_device_send_input_report_for_id(). Here's a log:
http://hostuje.net/file.php?id=6059f5d3663d55cb4aa3c06a6cc58923. What I do wrong?