Hi there,
Hi there,
Hello,
-120 means Operation already in progress, are you calling this anywhere else in your code?
You can check the error codes here.
Best regards,
Karl
Thanks for your quick reply, Karl!
Yes, I call 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'm using the API incorrectly, how should I use it?
On the referenced page, EINPROGRESS is 119, not -120. How so?
mlac said:Thanks for your quick reply, Karl!
No problem at all, I am happy to help! :)
mlac said:First, for a HID device and second, for a Nordic UART service. My application must advertise both simultaneously. If I'm using the API incorrectly, how should I use it?
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.
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?
mlac said:On the referenced page, EINPROGRESS is 119, not -120. How so?
The error code you saw was -120, which is EALREADY, but you are correct that EINPROGRESS is 119.
Best regards,
Karl
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.
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 always look up the related positive error code?
Hello,
mlac said: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.
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?
mlac said: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 always look up the related positive error code?
That's correct - within Linux negative 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
return -EBUSY
Best regards,
Karl
Hello,
mlac said: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.
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?
mlac said: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 always look up the related positive error code?
That's correct - within Linux negative 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
return -EBUSY
Best regards,
Karl
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.
Device A and B both use the nRF52840. The host device can be any computer, phone, or tablet.
mlac said:My knowledge of BLE advertising requirements and filtering possibilities is limited.
Thank you for clarifying, that's no problem at all - when I know this I can answer more in-depth :)
mlac said:I only know that both the host computer and device B must be able to simultaneously connect to device A.
If you increase the number of accepted connections through the
CONFIG_BT_CTRL_SDC_PERIPHERAL_COUNT kconfig, so that the device can hold additional connections.
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's as these will be found by the central when they connect and start a discovery.
So, if your device for instance only advertises its name 'DeviceA', you can have both the DeviceB and computer look for this specific device name in the advertisers, and connect to it.
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).
Best regards,
Karl