<?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>is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90739/is-there-a-way-pass-a-service-characteristic-uuid-as-a-variable</link><description>Dear support 
 I am developing a generic client, after connection and service discovery, there are usually a few characteristics with different uuids are found, I need to choose which characteristic to work on by its uuid, and pass the uuid as a parameter</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Aug 2022 09:24:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90739/is-there-a-way-pass-a-service-characteristic-uuid-as-a-variable" /><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/381956?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2022 09:24:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e396b21-cf09-4e77-a8bf-a818a0275aec</guid><dc:creator>PingISTL</dc:creator><description>&lt;p&gt;thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/381952?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2022 09:20:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cf891b1-c9ff-4189-bf8e-09d42f820635</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Ping,&lt;/p&gt;
&lt;p&gt;Thank you. I agree, for your implementation I think it will make sense to report all the UUIDs along with their attribute handles to host after the service discovery is completed. This way the host can decide which characteristic(s) it wants to interface with. It is kind of similar to how the&amp;nbsp;&lt;span&gt;&lt;a title="nRF Connect Bluetooth Low Energy" href="https://infocenter.nordicsemi.com/topic/ug_nrfconnect_ble/UG/nRF_Connect_BLE/nRF_Connect_intro.html?cp=10_3_0"&gt;nRF Connect Bluetooth Low Energy&lt;/a&gt;&lt;/span&gt; app works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/381404?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2022 15:02:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2d0e723-884a-4049-ba81-1d80342e0a65</guid><dc:creator>PingISTL</dc:creator><description>&lt;p&gt;Hi, Vidar&lt;/p&gt;
&lt;p&gt;Thank you for clarification.&lt;/p&gt;
&lt;p&gt;Yes, the gateway is meant to be working with any peripheral device, there is another upper level server is meant to know the protocols and pass the data to gateway and then gateway pass&amp;nbsp;it to BLE module. Before this Gateway report full DB&amp;nbsp;that BLE finds.&amp;nbsp;For a particular characteristics&amp;nbsp;, I am thinking of report it starting handle(when UUID =0x2803), so upper app knows the handle value and do a read, then able to know the &lt;span&gt;characteristic UUID, value handle to read/write or notify depend on properties.&amp;nbsp; For&amp;nbsp;standard UUIDs listed in Bluetooth 16-bit UUID Number Document,&amp;nbsp; hopefully server knows the protocol, for&amp;nbsp; proprietary services with custom UUIDs, it is upper level server&amp;#39;s job to find how to interact&amp;nbsp;with it as gateway doesn&amp;#39;t know.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you again for your support - your suggestion&amp;nbsp;on handles are very helpful!&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ping&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/381394?ContentTypeID=1</link><pubDate>Fri, 12 Aug 2022 13:57:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45b08279-418e-48db-a650-1b5c761a48c6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Ping,&lt;/p&gt;
&lt;p&gt;Technically, the host does not have to know the UUID to write or subscribe to notifications from a characteristic. But I&amp;#39;m not sure what it is going to send/receive if it does not know what kind of characteristic it is? Is the gateway meant to be able interface with any peripheral device? Please keep in mind that peripherals will often include undocumented proprietary services with custom UUIDs.&lt;/p&gt;
[quote user="PingISTL"]the protocols are internal to a specific peripheral and I need to know this before I send data to read/write, is that right?[/quote]
&lt;p&gt;Usually you will be able to write and read the characteristics, but if you connect to an arbitrary peripheral you would not necessary know how to interface with it.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/381045?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 14:06:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f87fbc0-02cc-42ce-b0a3-688b78a77d10</guid><dc:creator>PingISTL</dc:creator><description>&lt;p&gt;Hi, Vidar&lt;/p&gt;
&lt;p&gt;Further to my question, I wonder whether there is ever a need to let the upper level host know the UUIDs of the service/characteristic discovered by central SDP? As the central is designed to be&amp;nbsp;generic&amp;nbsp;for any peripherals, and upper level application has no knowledge of the services, I wonder whether just provide handle values and properties is enough&amp;nbsp;for the host to do full data exchange.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Ping&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/380989?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 11:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c96ba86-bf4f-42b4-9ad7-e1561ce97981</guid><dc:creator>PingISTL</dc:creator><description>&lt;p&gt;Thank you, Vidar&lt;/p&gt;
&lt;p&gt;I tried use handles to address the characteristics and&amp;nbsp;to operate them, and it works fine, and this way it is easy to make it generic and so far works with 2 different peripherals when they are all connected. Thank you for your good suggestion!&lt;/p&gt;
&lt;p&gt;I will further look at the shell example,&amp;nbsp;is there a document on the interface command? I struggled a few month ago to get&amp;nbsp;some commands working before.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have another question about SDP, service discovery is able to find all characteristics, their value/notification handles and properties, but the data exchange in between is peripheral specific, is that right? For example, I know LBS button characteristic has a 1 byte of data when read and notified, but other service/&lt;span&gt;characteristics&amp;nbsp;&lt;/span&gt;might have a different set of data to read and notify, the protocols are internal to a specific peripheral and I need to know this before I send data to read/write, is that right?&lt;/p&gt;
&lt;p&gt;Regards!&lt;/p&gt;
&lt;p&gt;Ping&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/380975?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 10:16:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dc94f15-038e-4eee-81b4-74b349ef6253</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Ping,&lt;/p&gt;
&lt;p&gt;Thanks, I understand your use case now. I agree that the shell sample can be a bit complicated to use. Still, if you want to see how the commands are implemented, you can have a look at the files in zephyr/subsys/bluetooth/shell.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1660125896378v1.png" alt=" " /&gt;&lt;/p&gt;
[quote user="PingISTL"]I have to consider multiple connection as well, as the central is able to connect up to 20 peripherals at same time, in case of all of them sending data to BLE, I hope the data are not coming at same time? and when&amp;nbsp;any connections are established, I guess I have to stop scanning, as the radio cannot support them both?[/quote]
&lt;p&gt;The data will not come at the same time, no. The BT event handlers will also include a reference to the connection that raised the event so you can know which device the data came from (&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/connectivity/bluetooth/api/connection_mgmt.html"&gt;Connection Management&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The RADIO cannot operate in RX and TX mode at the same time. However, the controller will take care of the scheduling the scan events to allow scanning to happen between connection events. Please see the &amp;quot;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/nrfxlib/softdevice_controller/doc/scheduling.html"&gt;Scheduling&lt;/a&gt;&amp;quot; chapter of the Softdevice controller for details. It includes some good illustrations of how it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/380641?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 13:57:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59f46028-81a9-4538-a0f5-d1cf0ff35e8e</guid><dc:creator>PingISTL</dc:creator><description>&lt;p&gt;Thanks, Vidar&lt;/p&gt;
&lt;p&gt;I am developing a bluetooth gateway and the module is hosted by&amp;nbsp;a host processor via UART.&amp;nbsp;&amp;nbsp; So the BLE central application has to be&amp;nbsp;generic - work with any GATT server and passes whatever it scans to host processor and listen to commands from host processor to do connection, SDP and data exchange etc.&lt;/p&gt;
&lt;p&gt;The interface&amp;nbsp;protocol between host and BLE is specific to the product only and will never need to interface with other hosts and don&amp;#39;t have to be that readable in terms of format,&amp;nbsp;so&amp;nbsp;commands&amp;nbsp;are&amp;nbsp;not as complicated as the Shell example you pointed out - I tried&amp;nbsp;it before and not be able to follow all of them and it is not easy to dig out all source modules it uses - look like it is everywhere and well hidden.&lt;/p&gt;
&lt;p&gt;I will try your suggest to use handles to communicate with host, probably that the better way, I am thinking of use BLE MAC address and handles to address each characteristic and pass data in between - read/write/notify etc.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have to consider multiple connection as well, as the central is able to connect up to 20 peripherals at same time, in case of all of them sending data to BLE, I hope the data are not coming at same time? and when&amp;nbsp;any connections are established, I guess I have to stop scanning, as the radio cannot support them both?&lt;/p&gt;
&lt;p&gt;Thanks you for&amp;nbsp;contribution and suggestion.&lt;/p&gt;
&lt;p&gt;Ping&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/380581?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 11:24:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8812e62-8de1-4970-bb08-e59b4a48d300</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Ping,&lt;/p&gt;
&lt;p&gt;Thanks for the clarification.Still, I&amp;#39;m not sure I understand how the app is meant to be used. Is it going to work with a pre-defined set of supported characteristics, or is it going to work with any GATT server?&lt;/p&gt;
&lt;p&gt;If you haven&amp;#39;t alread, I would suggest you try Bluetooth shell example to see if maybe does what you want. It&amp;#39;s mainly used for testing in the Zephyr projet, so documentation for it a bit lacking, but should still be possible to use. You can add the --help argument to check what input parameters a particular command expects as shown below.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UART serial client connected to Bluetooth shell sample&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1659957667350v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/380427?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 14:49:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2f8f891-fe19-4540-8be0-e9d6255d6424</guid><dc:creator>PingISTL</dc:creator><description>&lt;p&gt;Hi, Vidar&lt;/p&gt;
&lt;p&gt;You are right, I am doing a central based on UART commands, I listen to the command from upper app to connect to a particular&amp;nbsp;peripheral and then&amp;nbsp;do service discovery.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If upper app need to do data exchange on a characteristics, I am thinking of passing the uuid to the central and then assign handles and ready for data exchange. It is hard to pass uuid as parameters as I just found.&lt;/p&gt;
&lt;p&gt;I will try to use handles probably as you suggested,&amp;nbsp;do I need to assign and keep all of them to my client variables before I know which one to operate? There are quite a few characteristics in the service.&amp;nbsp;and find their handles need to pass&amp;nbsp;some uuid too from the example I know,&amp;nbsp;like Nordic LBS.&lt;/p&gt;
&lt;p&gt;Regards!&lt;/p&gt;
&lt;p&gt;Ping&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: is there a way pass a service/characteristic uuid as a variable ?</title><link>https://devzone.nordicsemi.com/thread/380407?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 13:41:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0af5791a-914b-472a-b080-96c408543552</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Ping,&lt;/p&gt;
&lt;p&gt;Are you looking to implement something similar to the Bluetooth shell sample (&lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/main/tests/bluetooth/shell"&gt;https://github.com/nrfconnect/sdk-zephyr/tree/main/tests/bluetooth/shell&lt;/a&gt;) where you can use the command line to connect and interface with BLE devices?&lt;/p&gt;
&lt;p&gt;After the service discovery is complete, you usually don&amp;#39;t use the UUID to reference a characteristic, but its attribute handle value. Isn&amp;#39;t that possible in your case?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>