Why data sent from nrf52833DK can be received by client(mobile phone)

Hi,

I use Nrf52833dk running ncs v2.6.0.

I transport peripherial_uart to peripheral_hids_keyboard ,obviously I wanna make MOBILE OR PC can connect to DK and regard dk as a hid,and then receive data from dk sent by uart.

I found that peripheral_hids_keyboard can make part of that come true,but only specific message,so I transport uart into this project.

And my problem is that pc or mobile cant receive data.

Here is my code.

Best regards,

Martin

static void data_send_proc(void)
{
	int err;
	struct uart_data_cmd_t *buf = k_fifo_get(&fifo_uart_rx_data,
						     K_FOREVER);
	for(int i =0;i<buf->len;i++){	
		printk("data[%d] is %d\n",i,buf->data[i]);
	}
	for (size_t i = 0; i < CONFIG_BT_HIDS_MAX_CLIENT_COUNT; i++) {
		if(conn_mode[i].conn){
			printk("conn_mode[%d] = %d\n",i,conn_mode[i].conn);
			err = bt_hids_inp_rep_send(&hids_obj, conn_mode[i].conn,
								INPUT_REP_KEYS_IDX, (uint8_t const *)buf->data,
								buf->len, NULL);
		}
	}
}

Parents Reply
  • Yeah,you are right,but now I add Uart to this demo,and i can get what uart send by 

    k_fifo_get,then i want to send them to phone by ble just like 'H' 'E' 'L' 'L' 'O',but now I cant do it successfully.
    err = bt_hids_inp_rep_send(&hids_obj, conn_mode[i].conn,
                                    INPUT_REP_KEYS_IDX,(uint8_t const *)buf->data,
                                    buf_size, NULL);
    I use this API to send buf->data, which is get by follows.
    struct uart_data_cmd_t *buf = k_fifo_get(&fifo_uart_rx_data,
    						     K_FOREVER);	
Children
Related