<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112527/which-apis-ared-used-to-send-msg-by-ble</link><description>Hiii, 
 I have added BLE from peripheral_hids_keyboard to Peripherial_Uart,and now my PC and mobile (Android) can connect with DK(nrf52833) and can regard it as a HID,but cant receive data sent by DK.I wonder which APIs are needed to send data via ble</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 27 Jul 2024 16:38:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112527/which-apis-ared-used-to-send-msg-by-ble" /><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/495877?ContentTypeID=1</link><pubDate>Sat, 27 Jul 2024 16:38:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a61220d-0fae-426a-91d2-50c7a14bcb27</guid><dc:creator>Martin Evans</dc:creator><description>&lt;p&gt;Thanks so much,and i will read it carefully.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/495574?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2024 08:46:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e031a920-585c-44ae-ad8d-577e0694525a</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Martin&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think the UART buffer size will be relevant for sending data over BLE. The &lt;strong&gt;buf_size&lt;/strong&gt; in your&amp;nbsp;data_send_proc() function for example is only set to 8 it seems, so increasing that might be a start. Also please check out&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/88461/data-transfer-to-a-characteristic-is-limited-to-20-bytes"&gt;this ticket where my colleague Vidar &lt;/a&gt;explains how to increase data transfer sizes in a BLE connection.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/495309?ContentTypeID=1</link><pubDate>Wed, 24 Jul 2024 00:29:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e2e989c-d320-4f29-9601-75fbc85a3cce</guid><dc:creator>Martin Evans</dc:creator><description>&lt;p&gt;Hi，&lt;/p&gt;
&lt;p&gt;Exactly UART_BUF_SIZE is set 128,but i can only send 6 Bytes at a time.&lt;/p&gt;
&lt;p&gt;I want to send more Bytes at a time like 24 or even more.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Martin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/495202?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2024 12:20:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87a85d72-9e1b-42f6-9114-7c2bd762987a</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Terje is out of office so I have been assigned this case in his place. What are you expecting here exactly? I&amp;#39;m assuming the buffer is set to 6 if you&amp;#39;re not able to send more than 6&amp;nbsp;bytes&amp;nbsp;at a time, and that you haven&amp;#39;t set up a buffer handler to handle any exceeding bytes to be sent at a later point. Can you explain what exactly you&amp;#39;re aiming to do so I can get a better idea of what the end goal is and what needs to be done exactly?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/493064?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 06:14:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:053f34d3-7646-4fe7-9210-8353588ef8e5</guid><dc:creator>Martin Evans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ive tried bt_hids_inp_rep_send() that you mentioned and it succed but something unexpected appear.&lt;/p&gt;
&lt;p&gt;The first is that I can only send no more than six word at one time,do there any ideas to expand this?&lt;/p&gt;
&lt;p&gt;The other one is that the data can only be sent the first one if not change the first one word in the second time.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;At the first time I send &amp;quot;04 05 06 07 08 09&amp;quot; and I receive &amp;quot;a b c d e f&amp;quot;,and the second time I send the same data as the first time I just receive &amp;quot;a&amp;quot;.&lt;/p&gt;
&lt;p&gt;And if I send data that is larger than 6Byte,It will only receive the first 6Byte.&lt;/p&gt;
&lt;p&gt;my report map is as follows.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	static const uint8_t report_map[] = {
		0x05, 0x01,       /* Usage Page (Generic Desktop) */
		0x09, 0x06,       /* Usage (Keyboard) */
		0xA1, 0x01,       /* Collection (Application) */

		/* Keys */
#if INPUT_REP_KEYS_REF_ID
		0x85, INPUT_REP_KEYS_REF_ID,
#endif
		0x05, 0x07,       /* Usage Page (Key Codes) */
		0x19, 0xe0,       /* Usage Minimum (224) */
		0x29, 0xe7,       /* Usage Maximum (231) */
		0x15, 0x00,       /* Logical Minimum (0) */
		0x25, 0x01,       /* Logical Maximum (1) */
		0x75, 0x01,       /* Report Size (1) */
		0x95, 0x08,       /* Report Count (8) */
		0x81, 0x02,       /* Input (Data, Variable, Absolute) */

		0x95, 0x01,       /* Report Count (1) */
		0x75, 0x08,       /* Report Size (8) */
		0x81, 0x01,       /* Input (Constant) reserved byte(1) */

		0x95, 0x06,       /* Report Count (6) */
		0x75, 0x08,       /* Report Size (8) */
		0x15, 0x00,       /* Logical Minimum (0) */
		0x25, 0x65,       /* Logical Maximum (101) */
		0x05, 0x07,       /* Usage Page (Key codes) */
		0x19, 0x00,       /* Usage Minimum (0) */
		0x29, 0x65,       /* Usage Maximum (101) */
		0x81, 0x00,       /* Input (Data, Array) Key array(6 bytes) */

		/* LED */
#if OUTPUT_REP_KEYS_REF_ID
		0x85, OUTPUT_REP_KEYS_REF_ID,
#endif
		0x95, 0x05,       /* Report Count (5) */
		0x75, 0x01,       /* Report Size (1) */
		0x05, 0x08,       /* Usage Page (Page# for LEDs) */
		0x19, 0x01,       /* Usage Minimum (1) */
		0x29, 0x05,       /* Usage Maximum (5) */
		0x91, 0x02,       /* Output (Data, Variable, Absolute), */
				  /* Led report */
		0x95, 0x01,       /* Report Count (1) */
		0x75, 0x03,       /* Report Size (3) */
		0x91, 0x01,       /* Output (Data, Variable, Absolute), */
				  /* Led report padding */

		0xC0              /* End Collection (Application) */
	};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And my code getting data from uart and sending them to ble.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void data_send_proc(void)
{
	int err;
	int buf_size = 8;
	uint8_t buffer[UART_BUF_SIZE] = {0,0};
	
	struct uart_data_cmd_t *buf = k_fifo_get(&amp;amp;fifo_uart_rx_data,
						     K_FOREVER);
	
	if(buf-&amp;gt;len != 0){
		printk(&amp;quot;buf-&amp;gt;len is %d\n&amp;quot;,buf-&amp;gt;len);
		
		memcpy(buffer+2,buf-&amp;gt;data,buf-&amp;gt;len-2);
		k_free(buf);

		for (size_t i = 0; i &amp;lt; CONFIG_BT_HIDS_MAX_CLIENT_COUNT; i++) {
			if (conn_mode[i].conn) {
				err = bt_hids_inp_rep_send(&amp;amp;hids_obj, conn_mode[i].conn,
									INPUT_REP_KEYS_IDX,buffer,
									buf_size, NULL);
			}
		}

	}
	
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hope your reply&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Martin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/492994?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2024 13:50:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:130245a6-bf66-4388-ade1-11f49fe81814</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;With the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/bluetooth_services/services/hids.html"&gt;HID Service library&lt;/a&gt; you can send HID reports. It is not intended for sending pure characters, but rather to send HID reports (which in the case of a HID keyboard report contains key presses - which are close to characters but not exactly the same as characters.) Using the HID Service library, HID reports can be sent using&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/bluetooth_services/services/hids.html#c.bt_hids_inp_rep_send"&gt;bt_hids_inp_rep_send()&lt;/a&gt; or &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/bluetooth_services/services/hids.html#c.bt_hids_boot_kb_inp_rep_send"&gt;bt_hids_boot_kb_inp_rep_send()&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/491200?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2024 00:41:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:732a5d54-4c53-466e-b74c-0042e864e1e6</guid><dc:creator>Martin Evans</dc:creator><description>&lt;p&gt;And peripheral_uart can send data via bt_nus_send(),does&amp;nbsp;&lt;span&gt;peripheral_hids_keyboard have the similar one?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/491199?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2024 00:39:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6cc30b2-cadb-431c-99d8-b26183146d77</guid><dc:creator>Martin Evans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I use nfr connect SDKV 2.6.0 running on nrf52833DK.&lt;/li&gt;
&lt;li&gt;I have tested this two sample,and peripheral_uart can send data from &lt;a href="https://docs.nordicsemi.com/bundle/ug_nrf52833_dk/page/UG/dk/vir_com_port.html"&gt;uart&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;span&gt;peripheral_hids_keyboard can send data by pressing button and PC or Mobile can receive data&amp;nbsp;from&amp;nbsp;a HID(keyboard).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;And now I&amp;nbsp;have ported a part code of&amp;nbsp;peripheral_hids_keyboard&amp;nbsp;into peripheral_uart and can connect with mobile regarded as HID,but mobile cant receive data from DK.&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Martin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Which APIs ared used to send msg by ble?</title><link>https://devzone.nordicsemi.com/thread/491163?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2024 15:05:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c740be9-73bf-4770-8240-ff755d59fcc1</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What SDK (and version) are you using?&lt;/li&gt;
&lt;li&gt;Did you test with the unmodified HIDS Keyboard sample first, to confirm that one works on its own?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>