<?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>nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105727/nrf-connect-zephyr-error-codes</link><description>Hi there, 
 
 bt_le_adv_start ( BT_LE_ADV_CONN , ad , ARRAY_SIZE ( ad ), sd , ARRAY_SIZE ( sd )) returns with error code -120. 
 
 What does this error code mean, and where can I look up the meaning of error codes in general?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Nov 2023 12:20:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105727/nrf-connect-zephyr-error-codes" /><item><title>RE: nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/thread/456148?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 12:20:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33805586-60e0-48c0-88a0-46318f858a28</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="mlac"]My knowledge of BLE advertising requirements and filtering possibilities is limited.[/quote]
&lt;p&gt;Thank you for clarifying, that&amp;#39;s no problem at all - when I know this I can answer more in-depth :)&amp;nbsp;&lt;/p&gt;
[quote user="mlac"]I only know that both the host computer and device B must be able to simultaneously connect to device A.[/quote]
&lt;p&gt;If you increase the number of accepted connections through the&amp;nbsp;&lt;br /&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT"&gt;CONFIG_BT_CTRL_SDC_PERIPHERAL_COUNT&lt;/a&gt;&amp;nbsp;kconfig, so that the device can hold additional connections.&lt;br /&gt;You can have the same advertising payload in both cases, so long as both central devices are looking for the same device - the advertising does for instance not need to contain the service UUID&amp;#39;s as these will be found by the central when they connect and start a discovery.&lt;br /&gt;So, if your device for instance only advertises its name &amp;#39;DeviceA&amp;#39;, you can have both the DeviceB and computer look for this specific device name in the advertisers, and connect to it.&lt;br /&gt;Then they both will have access to all the services exposed by the device, HID and NUS, so long as they fulfill their encryption requirement(if any).&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/thread/456133?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 11:21:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbe2bd60-0eea-4f17-ba29-75572cf5acd4</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;My knowledge of BLE advertising requirements and filtering possibilities is limited. I only know that both the host computer and device B must be able to simultaneously connect to device A.&lt;/p&gt;
&lt;p&gt;Device A and B both use the nRF52840. The host device can be any computer, phone, or tablet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/thread/456106?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 10:07:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bb7d018-6615-4d9e-86ee-9f6b86da54d9</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="mlac"]I have device A and device B. Device A is a HID keyboard and a NUS server. Device B is a NUS client. Device A must be connected to a host computer as a keyboard, and it must be simultaneously connected to a NUS client. Therefore, I thought I should make device A advertise both as a HID keyboard and a NUS server. Please advise how I should implement the advertisement of device A.[/quote]
&lt;p&gt;Do you need Device A to advertise both the HID and NUS services for Device B to be able to find it, or could Device A just advertise its name, or some other identifier, which both device B and the computer could use to filter and connect to?&lt;/p&gt;
[quote user="mlac"]As for the error codes, the referenced file contains positive values, while the API provided a negative value. Is this a convention, so should I&amp;nbsp;always&amp;nbsp;look up the related positive error code?[/quote]
&lt;p&gt;That&amp;#39;s correct - within Linux negative&amp;nbsp;values are usually function result codes, while positive values are function return values, and so when error codes are returned they would for instance be written&lt;br /&gt;&lt;br /&gt;return -EBUSY&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/thread/456085?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 08:52:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:376700bd-34e6-4139-bed9-6be9ac15b1ad</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;I have device A and device B. Device A is a HID keyboard and a NUS server. Device B is a NUS client. Device A must be connected to a host computer as a keyboard, and it must be simultaneously connected to a NUS client. Therefore, I thought I should make device A advertise both as a HID keyboard and a NUS server. Please advise how I should implement the advertisement of device A.&lt;/p&gt;
&lt;p&gt;As for the error codes, the referenced file contains positive values, while the API provided a negative value. Is this a convention, so should I&amp;nbsp;always&amp;nbsp;look up the related positive error code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/thread/456080?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 08:09:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e735e44-63dc-429a-95bd-fb83f3fc2c22</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="mlac"]Thanks for your quick reply, Karl![/quote]
&lt;p&gt;No problem at all, I am happy to help! :)&amp;nbsp;&lt;/p&gt;
[quote user="mlac"]First, for a HID device and second, for a Nordic UART service. My application must advertise both simultaneously. If I&amp;#39;m using the API incorrectly, how should I use it?[/quote]
&lt;p&gt;Could you elaborate what you mean by this? Your device will have both services either way, regardless of the contents of the advertising packet, so you only need to start one advertising to make it available for connection by a central device.&lt;br /&gt;Are you here perhaps talking about multiple advertising sets - that you sometimes wish to advertise the UUID only of the HID service, and sometimes only of the NUS service?&lt;/p&gt;
[quote user="mlac"]On the referenced page, EINPROGRESS is 119, not -120. How so?[/quote]
&lt;p&gt;The error code you saw was -120, which is EALREADY, but you are correct that EINPROGRESS is 119.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/thread/455974?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2023 12:51:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c4fbc2f-cc3a-4a92-b427-150c8d6df719</guid><dc:creator>mlac</dc:creator><description>&lt;p&gt;Thanks for your quick reply, Karl!&lt;/p&gt;
&lt;p&gt;Yes, I call&amp;nbsp;bt_le_adv_start() twice. First, for a HID device and second, for a Nordic UART service. My application must advertise both simultaneously. If I&amp;#39;m using the API incorrectly, how should I use it?&lt;/p&gt;
&lt;p&gt;On the referenced page, EINPROGRESS is 119, not -120. How so?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect / Zephyr error codes</title><link>https://devzone.nordicsemi.com/thread/455932?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2023 10:22:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ec4d499-094b-40aa-9c56-f52f2223e180</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;-120 means&amp;nbsp;&lt;em&gt;Operation already in progress,&amp;nbsp;&lt;/em&gt;are you calling this anywhere else in your code?&lt;br /&gt;&lt;a href="https://docs.zephyrproject.org/apidoc/latest/group__system__errno.html"&gt;You can check the error codes here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>