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
  • Hi Martin,

    You need your own app to receive data from custom services, such as the Nordic UART service. HID over GATT is supported natively by the OS, therefore it does not require any additional apps. You can use our nRF connect app for testing the data communication with your services.

    Best regards,

    Vidar

  • Hi Vidar Berg,

    THANKS for reply,

    but there are two questions,

    the first one is tha my app cant conncet to server,and pic is as follows(but mobile without opening app can connect).And what i wanna is that mobile can receive data without any app,just like using keyboard entry word into .word files.

    the other one is that PC cant connect to server as well.

    Best regards,

    Martin

  • the first one is tha my app cant conncet to server,and pic is as follows(but mobile without opening app can connect).

    Please make sure to not include the event handling for the BLE_GATTS_EVT_SYS_ATTR_MISSING and the BLE_GAP_EVT_SEC_PARAMS_REQUEST event from the ble_app_uart example in your HID application. The HID applications use the Peer manager module to handle these events. 

    And what i wanna is that mobile can receive data without any app,just like using keyboard entry word into .word files.

    This is not supported by the HID specification, as far as I know.

Reply
  • the first one is tha my app cant conncet to server,and pic is as follows(but mobile without opening app can connect).

    Please make sure to not include the event handling for the BLE_GATTS_EVT_SYS_ATTR_MISSING and the BLE_GAP_EVT_SEC_PARAMS_REQUEST event from the ble_app_uart example in your HID application. The HID applications use the Peer manager module to handle these events. 

    And what i wanna is that mobile can receive data without any app,just like using keyboard entry word into .word files.

    This is not supported by the HID specification, as far as I know.

Children
Related