<?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>Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60918/service-discovery-failed-using-pc-ble-driver</link><description>I am using an nRF52840 Dongle to try and connect to a product over Bluetooth and communicate with it. I have been able to open this dongle using nRF Connect Bluetooth Low Energy, and can successfully find my product, connect to it, and write to its characteristics</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 May 2020 15:49:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60918/service-discovery-failed-using-pc-ble-driver" /><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248786?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 15:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:366f4297-09af-4a65-8f42-44a6777bcbb9</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;I finally figured it out!&lt;/p&gt;
&lt;p&gt;So when I had searched for descriptors after getting my characteristics, I was getting a couple of different values, some with UUIDs that were different from what I expected to see, based on the values in nRF Connect. For each characteristic, one of the descriptors I could receive would have the same UUID as the characteristic, but with a different handle.&lt;/p&gt;
&lt;p&gt;Turns out, I needed to pass THIS handle to the write_params, not the handle of the characteristic. Now, my write command is working, and I can see the data on the peripheral&amp;#39;s bus!&lt;/p&gt;
&lt;p&gt;I also verified my other questions for myself, I was able to figure out how to toggle notifications, and get back the notification data read on a characteristic.&lt;/p&gt;
&lt;p&gt;I think I&amp;#39;ve finally got everything I need for this project! Thanks for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248780?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 14:57:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79d6a418-2cd6-4c96-9349-e31852e9c3fe</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;I think there may be an issue...&lt;/p&gt;
&lt;p&gt;I changed my discovery routines to search instead for the first characteristic, which is notify only. I discovered it correctly, and then had my function write to its handle, and I got no error messages, and the handler went into the BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE state. This characteristic does not have write privileges, it is notify only, so I think I should see some failure somewhere. So something is not writing correctly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248769?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 14:34:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a39fc824-ef5e-46f8-ad96-899252c23318</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;I did end up fixing that, it didn&amp;#39;t have an effect.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure what you mean about the callback event, I don&amp;#39;t have access to the code that is running on the peripheral. I am just connecting to it and monitoring its parallel bus.&lt;/p&gt;
&lt;p&gt;I did some experimenting, and I tried setting the write_params.handle value to m_hrm_char_handle1 instead of m_hrm_char_handle2. This is a variable I intend to use for one of the other characteristics, but for now, I&amp;#39;m only discovering the &amp;quot;write&amp;quot; characteristic, which is being stored in m_hrm_char_handle2.&lt;/p&gt;
&lt;p&gt;So basically, I tried calling the same command with a non-assigned, zero-value handle as the write_params.handle value, and I got the same response. As in, there was no error code, and the event handler went into the state for BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE. I was surprised to not see some error. This makes me wonder if my command is actually doing anything with the actual handle being used. For what it&amp;#39;s worth, I did pause the code to check and ensure my m_hrm_char_handle2 value is set to the characteristic&amp;#39;s handle that was discovered, and that the discovered characteristic&amp;#39;s UUID is the &amp;quot;write&amp;quot; characteristic I&amp;#39;m wanting to use.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248758?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 14:14:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47b50e72-b73f-4932-ba68-0c7ae7970f13</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;A Shot in the dark:&lt;/p&gt;
&lt;p&gt;You set enc_data[0] twice, and you do not set enc_data[10]. Just in case you are not checking for the event, but only a specific packet. Since you mention that you tried to reverse the packet here as well. The content of the payload shouldn&amp;#39;t really matter for the BLE stack.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you check whether or not the callback event is triggered on the peripheral?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248724?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 13:14:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c165f51-2c1c-432f-ab12-43f3bbd52c21</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;Okay, so I did some digging and I found a function that I think is right for what I need. It is called &amp;quot;sd_ble_gattc_write&amp;quot;. I modified my new &amp;quot;writeble&amp;quot; routine like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static uint32_t writeble()
{
    uint32_t error_code;
	uint8_t enc_data[13];
	ble_gattc_write_params_t write_params;
	
	enc_data[0] = 0x01;
	enc_data[1] = 0x00;
	enc_data[2] = 0xFF;
	enc_data[3] = 0x20;
	enc_data[4] = 0x08;
	enc_data[5] = 0x01;
	enc_data[6] = 0x02;
	enc_data[7] = 0x03;
	enc_data[8] = 0x04;
	enc_data[9] = 0x05;
	enc_data[0] = 0x06;
	enc_data[11] = 0x07;
	enc_data[12] = 0x08;
	
	write_params.write_op = BLE_GATT_OP_WRITE_CMD;
	write_params.flags = BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE;
	write_params.handle = m_hrm_char_handle2;
	write_params.offset = 0;
	write_params.len = 0xD;
	write_params.p_value = enc_data;
	
	error_code = sd_ble_gattc_write(m_adapter, m_connection_handle, &amp;amp;write_params);
	
	if(error_code != NRF_SUCCESS){
		printf(&amp;quot;Failed to send. Error code 0x%02X\n&amp;quot;, error_code);
		fflush(stdout);
		return error_code;
	}
	return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now, I don&amp;#39;t get any error when I run this code, and the event handler enters the case for BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE, which should mean that the Write Without Response command completed successfully.&lt;/p&gt;
&lt;p&gt;However, I am not seeing the proper response from my peripheral. For reference, I am monitoring a parallel bus on my peripheral, and when this characteristic is written to (using the specified 13-byte packet layout), I will see a response. If I use nRF Connect, I can type these 13 bytes into the characteristic, click &amp;quot;write&amp;quot;, and I will see the response on the bus I&amp;#39;m monitoring. However, when using this write command in the program, nothing appears on the bus.&lt;/p&gt;
&lt;p&gt;I know the peripheral is behaving properly, since it works in nRF Connect, and it seems that the write command is executing correctly, so there must just be something configured differently in how the program is setting up the command vs how the nRF Connect is setting up the command. I have already tried reversing the byte order in the enc_data array, to no avail. As with the previous code I posted, the handle used here is the one that was assigned to my &amp;quot;write&amp;quot; characteristic (the UUID is matched correctly). I am only discovering this one characteristic for right now, so as to simplify the process. This characteristic does not have any descriptors defined, so I am not calling the &amp;quot;descr_discovery_start&amp;quot; function for now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248697?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 11:48:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cef54acc-2054-4f14-b21c-1967b3e12fb6</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;Changing the uuid.type to 0x00 had no change to the behavior with it defined as BLU_UUID_TYPE_VENDOR_BEGIN. So, I am still discovering the service properly, and I&amp;#39;m able to get a characteristic and its descriptor.&lt;/p&gt;
&lt;p&gt;By looking through other cases here on the help website, I found suggestions that users simply call the &amp;quot;sd_ble_gattc_characteristics_discover&amp;quot; routine multiple times in order to discover more than one characteristic, just increasing the lower boundary of the handle range each time. I thought this was strange, since the params.char_disc_rsp object has a count parameter, it seems like it should be able to return multiple characteristics. Either way, by using multiple calls, I&amp;#39;ve been able to assign all 3 characteristics to different handles. For now, though, since I am still trying to figure out the read/write commands, I&amp;#39;m only assigning one characteristic at a time.&lt;/p&gt;
&lt;p&gt;So, my next concern is with the write command. Currently, I have my code begin the &amp;quot;sd_ble_gattc_characteristics_discover&amp;quot; routine using an increased lower handle, so that the characteristic it returns has a UUID that matches my peripheral&amp;#39;s &amp;quot;write&amp;quot; characteristic. I am wanting to know what code to use to write from this characteristic, mimicking the behavior of the nRF Connect program, where I can type data into the characteristic&amp;#39;s string field and click the &amp;quot;write&amp;quot; button.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve started by looking at the HRM code in the pc-ble-driver example. I&amp;#39;ve added a function based on this example, here&amp;#39;s what it looks like so far:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static uint32_t writeble()
{
    uint32_t error_code;
	uint8_t enc_data[13];
	uint16_t data_len;
	ble_gatts_hvx_params_t hvx_params;
	
	data_len = (uint16_t)13;
	
	enc_data[0] = 0x01;
	enc_data[1] = 0x00;
	enc_data[2] = 0xFF;
	enc_data[3] = 0x20;
	enc_data[4] = 0x08;
	enc_data[5] = 0x01;
	enc_data[6] = 0x02;
	enc_data[7] = 0x03;
	enc_data[8] = 0x04;
	enc_data[9] = 0x05;
	enc_data[0] = 0x06;
	enc_data[11] = 0x07;
	enc_data[12] = 0x08;
	
	hvx_params.handle = m_hrm_char_handle2;
	hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
	hvx_params.offset = 0;
	hvx_params.p_len = &amp;amp;data_len;
	hvx_params.p_data = enc_data;
	
	error_code = sd_ble_gatts_hvx(m_adapter, m_connection_handle, &amp;amp;hvx_params);
	
	if(error_code != NRF_SUCCESS){
		printf(&amp;quot;Failed to send. Error code 0x%02X\n&amp;quot;, error_code);
		fflush(stdout);
		return error_code;
	}
	return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is based on the HRM example. The data is a 13-byte packet, it is the same data that I type into the characteristic&amp;#39;s field in the nRF Connect program. The value &amp;quot;m_hrm_char_handle_2&amp;quot; is the handle that this characteristic is being assigned to by &amp;quot;sd_ble_gattc_characteristics_discover&amp;quot;.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve modified the main loop of the example, which waits for a character input into the terminal, then calls the HRC notification toggle. I&amp;#39;ve commented out this function call, and replaced it with a call to this new function. So after the peripheral is connected, and the service, characteristic, and descriptor are all discovered, pressing a key will call this function.&lt;/p&gt;
&lt;p&gt;As it is now, doing so gives me an error code of 0x05, which seems to correspond to NRF_ERROR_NOT_FOUND. So something is not being set up correctly. Is there any other code I need to add to ensure that I can carry out this write command? Or am I going about this the wrong way? For reference, this characteristic only has the &amp;quot;WriteWithoutResponse&amp;quot; property enabled. So if this is doing something other than a write (without response) type of command, maybe that&amp;#39;s where the error is from. But since this is the only &amp;quot;write&amp;quot; type command I could find in the examples, I&amp;#39;m not sure where to go from here.&lt;/p&gt;
&lt;p&gt;Please let me know if you&amp;#39;ve got any pointers for me, thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248673?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 10:03:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:349a2ba3-f9e3-4291-95fa-2b48188611d4</guid><dc:creator>Edvin</dc:creator><description>[quote user="mmercier"]Changing the 16-bit UUID to 0x0001 worked![/quote]
&lt;p&gt;&amp;nbsp;Great! That is good to hear. This is why I wanted you to check the ble_nus_c example, because I wanted you to compare the UUID with the part of the UUID that the central looked for in the service discovery.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="mmercier"]I just wanted to ask if these handles need to match, or if they are just assigned sequentially and it doesn&amp;#39;t particularly matter the exact value.[/quote]
&lt;p&gt;&amp;nbsp;They do not need to match exactly, no. They are just used internally in your application, and are assigned during runtime.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="mmercier"] My peripheral&amp;#39;s service has 3 characteristics, but the call to &amp;quot;sd_ble_gattc_characteristics_discover&amp;quot; is only returning a value of 1 for the count of characteristics found[/quote]
&lt;p&gt;&amp;nbsp;Can you try to set the&amp;nbsp;&lt;span&gt;uuid.type to 0x00 in start_discovery()? What does things look like in the&amp;nbsp;on_service_discovery_response() then?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248500?ContentTypeID=1</link><pubDate>Wed, 06 May 2020 13:48:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:282b9584-44de-49ea-9966-895ed521e6f4</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;One more thing I noticed about the handles, when I discover the characteristic with handle 0xF, and the event handler moves into the descriptor discovery, the returned value of the CCCD handle is also 0xF. On the other hand, in nRF Connect, the characteristic&amp;#39;s handle is 0x10, and the CCCD handle is 0x11. It seems strange to me that the program would read the same handle for the characteristic and its CCCD. Is this normal? Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248485?ContentTypeID=1</link><pubDate>Wed, 06 May 2020 13:29:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f78c7ccb-0536-46d7-b6ce-4d5911789db1</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;Changing the 16-bit UUID to 0x0001 worked! I can now move past the service discovery response. So it seems that the 128-bit UUID needs to be defined in little endian format, but the 16-bit service UUID section must be big endian.&lt;/p&gt;
&lt;p&gt;I am now able to move past into the characteristic discovery. This has given me a lot more to experiment with. I just have a few questions that I am curious about.&lt;/p&gt;
&lt;p&gt;1: I am able to discover a characteristic from my service and read back its UUID. The program also responds with the handle value of the characteristic (it is 0xF, one up from the service handle of 0xE). However, I noticed that, when connecting to the peripheral in nRF Connect, the handle assigned to the characteristic is not 0xF, but 0x10 (service handle is still 0xE, I couldn&amp;#39;t find where 0xF was). I just wanted to ask if these handles need to match, or if they are just assigned sequentially and it doesn&amp;#39;t particularly matter the exact value.&lt;/p&gt;
&lt;p&gt;2: My peripheral&amp;#39;s service has 3 characteristics, but the call to &amp;quot;sd_ble_gattc_characteristics_discover&amp;quot; is only returning a value of 1 for the count of characteristics found (only the first, with the 0xF handle, is being found). I experimented by changing the value of handle_range.start_handle to be equal to the service handle + 2 (so that it would skip the first characteristic), and it still returned a count value of 1, but this time, it was the service&amp;#39;s second characteristic that had been found (since I made it skip the first). So it seems like something is causing the function to only consider the first characteristic it finds. This seems to make sense, due to the expected HRM only having the one characteristic, but I couldn&amp;#39;t find anywhere that specifically told the function to only look for up to 1 characteristic. Is there some setting I can modify to have this function discover all three?&lt;/p&gt;
&lt;p&gt;Thanks for the suggestions!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248445?ContentTypeID=1</link><pubDate>Wed, 06 May 2020 12:11:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e83e139-6207-4659-9b05-ea20b00d2f02</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I do not mean that you should use the SDK&amp;#39;s example in the end, but that this example shows you how to try to discover a 128bit UUID. I guess if you ask 4 different people how to develop your application, you will get 4 different answers. What I wanted you to check in the central ble_app_uart_c example was what octets that are being used in the service discovery. This has nothing to do with your scanning or find_adv_name() function. Do you know what service discovery is, in the first place?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The reason I started listing the UUID of the ble_app_uart peripheral is because it is a 128bit UUID.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="mmercier"]I&amp;#39;ve also changed the value of BLE_UUID_HEART_RATE_SERVICE to 0x0100, to match with octets 12-13 of my service UUID.[/quote]
&lt;p&gt;&amp;nbsp;Can you try to set it to 0x0001 as well? This is why I tried to point you to the ble_app_uart example, to show a bit of how the UUID is represented in different applications. I am sorry if it was confusing.&lt;/p&gt;
&lt;p&gt;If that doesn&amp;#39;t work, what happens if you set the uuid.type to 0x00 in start_discovery()? Do you get a on_service_discovery_response() callback in that case? If so, what does the log say from this part?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248306?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 19:32:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a1164f8-9823-46d6-b167-34dcccce2739</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;Okay, so I&amp;#39;ve gotten into contact with a Nordic rep to try and figure out what kind of software I should be using for the project I need. He has informed me that, in order to do what I need, I will need to use the pc-ble-driver, and modify the HRC example to search for my peripheral rather than the HRM it&amp;#39;s set up to look for. So that UART example will not work. This is what I&amp;#39;d thought at first, but I wanted to make sure I wasn&amp;#39;t just making things more difficult for myself.&lt;/p&gt;
&lt;p&gt;So now that I know I&amp;#39;m on the right path, I need to figure out how to modify this code in order to search for my specific peripheral rather than the HRM it&amp;#39;s normally expecting. So far, I have made 2 major modifications to the original HRC code. The first is in the &amp;quot;find_adv_name&amp;quot; routine, called in the &amp;quot;on_adv_report&amp;quot; routine. Here is the original version of this routine:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static bool find_adv_name(const ble_gap_evt_adv_report_t *p_adv_report, const char * name_to_find)
{
    uint32_t err_code;
    data_t   adv_data;
    data_t   dev_name;

    // Initialize advertisement report for parsing
#if NRF_SD_BLE_API &amp;gt;= 6
    adv_data.p_data     = (uint8_t *)p_adv_report-&amp;gt;data.p_data;
    adv_data.data_len   = p_adv_report-&amp;gt;data.len;
#else
    adv_data.p_data     = (uint8_t *)p_adv_report-&amp;gt;data;
    adv_data.data_len   = p_adv_report-&amp;gt;dlen;
#endif

    //search for advertising names
    err_code = adv_report_parse(BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME,
                                &amp;amp;adv_data,
                                &amp;amp;dev_name);
    if (err_code == NRF_SUCCESS)
    {
        if (memcmp(name_to_find, dev_name.p_data, dev_name.data_len )== 0)
        {
            return true;
        }
    }
    else
    {
        // Look for the short local name if it was not found as complete
        err_code = adv_report_parse(BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME,
                                    &amp;amp;adv_data,
                                    &amp;amp;dev_name);
        if (err_code != NRF_SUCCESS)
        {
            return false;
        }
        if (memcmp(name_to_find, dev_name.p_data, dev_name.data_len )== 0)
        {
            return true;
        }
    }
    return false;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And here is my modified code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static bool find_adv_name(const ble_gap_evt_adv_report_t *p_adv_report, uint8_t name_to_find)
{
    uint32_t err_code;
    data_t   adv_data;
    data_t   dev_name;

    // Initialize advertisement report for parsing
//#if NRF_SD_BLE_API &amp;gt;= 6
    adv_data.p_data     = (uint8_t *)p_adv_report-&amp;gt;data.p_data;
    adv_data.data_len   = p_adv_report-&amp;gt;data.len;
//#else
    //adv_data.p_data     = (uint8_t *)p_adv_report-&amp;gt;data;
    //adv_data.data_len   = p_adv_report-&amp;gt;dlen;
//#endif
	
    //search for advertising names
    /*err_code = adv_report_parse(BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME,
                                &amp;amp;adv_data,
                                &amp;amp;dev_name);*/
    err_code = adv_report_parse(BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA,
                                &amp;amp;adv_data,
                                &amp;amp;dev_name);
	
    if (err_code == NRF_SUCCESS)
    {
        //if (memcmp(name_to_find, dev_name.p_data, dev_name.data_len )== 0)
        if (memcmp(&amp;amp;name_to_find, dev_name.p_data, 1 )== 0)
        {
            return true;
        }
    }
    else
    {
        // Look for the short local name if it was not found as complete
        err_code = adv_report_parse(BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME,
                                    &amp;amp;adv_data,
                                    &amp;amp;dev_name);
        if (err_code != NRF_SUCCESS)
        {
            return false;
        }
        if (memcmp(name_to_find, dev_name.p_data, dev_name.data_len )== 0)
        {
            return true;
        }
    }
    return false;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can see, I&amp;#39;ve changed the final argument of this function to be a uint8_t rather than a const char*. This is because my peripheral does not advertise its Name data (which is a const char*), but it does advertise its Manufacturer Specific data, which is a uint8_t. The &amp;quot;on_adv_report&amp;quot; function calls &amp;quot;find_adv_name&amp;quot;, and passes TARGET_DEV_NAME as its final argument. I&amp;#39;ve changed this #define statement from a string to the uint8_t value of the Manufacturer Specific Data I intend to find.&lt;/p&gt;
&lt;p&gt;I am fairly confident that this change works, as the program seems to find and connect to my peripheral properly. The remainder of the &amp;quot;on_adv_report&amp;quot; function carries on without any error flags returned.&lt;/p&gt;
&lt;p&gt;The other change I&amp;#39;ve made is what I&amp;#39;d described above, in the &amp;quot;service_discovery_start&amp;quot; routine, called by &amp;quot;on_connected&amp;quot;. The full text is pasted above, but basically, I&amp;#39;ve changed the uuid type value from BLE_UUID_TYPE_BLE to BLE_UUID_TYPE_VENDOR_BEGIN, changed the value of the 16-bit UUID field to 0x0100 (octets 12-13 of my peripheral&amp;#39;s service UUID), and defined a struct for a 128-bit UUID, populated it with the bytes of my peripheral&amp;#39;s UUID, and passed it with a call to &amp;quot;sd_ble_uuid_vs_add&amp;quot;.&lt;/p&gt;
&lt;p&gt;Notably, before I had added this call to &amp;quot;sd_ble_uuid_vs_add&amp;quot;, I was getting an error returned by the &amp;quot;sd_ble_gattc_primary_services_discover&amp;quot; call. After adding this 128-bit UUID, I no longer get an error here, and I am able to move on to the next event. This leads me to believe that the UUID is being passed properly.&lt;/p&gt;
&lt;p&gt;Now, my issue is with the next pass through the event handler, which goes to the routine &amp;quot;on_service_discovery_response&amp;quot;. The very first thing done in this routine is to check the value of the &amp;quot;gatt_service&amp;quot; parameter of the struct passed by the event handler (called p_ble_evt-&amp;gt;evt.gattc_evt). This is resulting in an error, as the value is not 0x0, but 0x10A.&lt;/p&gt;
&lt;p&gt;By stepping through the code following the completion of the &amp;quot;on_connected&amp;quot; routine, I discovered that this &amp;quot;gatt_service&amp;quot; value stays 0 until the end of that pass through the event handler. Then, on the next pass (when the &amp;quot;on_service_discovery_response&amp;quot; will be called), the value of &amp;quot;gatt_service&amp;quot; changes to 0x10A. This seems to correspond to the error message for BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND.&lt;/p&gt;
&lt;p&gt;I need to know how to continue on from here. I am not getting any error messages in any of the fields that I&amp;#39;ve modified, so I do not know where this error could be coming from.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248297?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 18:24:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a3597ae-fc7a-4b84-a1fd-15f1617cb7f9</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;I have been looking at that example code you mention, and I don&amp;#39;t think it will work in this project. It seems to be using an entirely different set of library functions than what I have. I am currently using the libraries/headers/dlls from the pc-ble-driver.&lt;/p&gt;
&lt;p&gt;Is there some other set of libraries/headers/dlls that I could use in order to build a project using these other example files you sent? I want to know the simplest way to build a C program which will allow me to connect to my peripheral, and read/write to its characteristics through my dongle, which will be attached to the PC running the C program.&lt;/p&gt;
&lt;p&gt;I keep getting conflicting information about how to go about making this program, and I want to ensure I am going down the right path for what I&amp;#39;m trying to accomplish.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248287?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 16:24:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3057d329-801a-48fd-90ec-0ec4b463735f</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;As I&amp;#39;d mentioned, after adding the call to &amp;quot;sd_ble_uuid_vs_add&amp;quot;, I do not get error messages in the &amp;quot;service_discovery_start&amp;quot; or &amp;quot;on_connected&amp;quot; functions. I do not get any errors until after the event handler finishes the pass in which it called this function. When the event handler enters its next pass, with the p_ble_evt-&amp;gt;header.evt_id set to BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP, this is when the value of p_ble_evt-&amp;gt;evt.gattc_evt.gatt_status becomes 0x10A. This is the error I am trying to solve. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248270?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 15:18:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3ee42ef-14eb-49d6-b9ee-c2d7395fddea</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;I have been describing my modifications to the &amp;quot;service_discovery_start&amp;quot; routine in the above posts, as this is the routine that I&amp;#39;d been originally seeing errors in. For reference, here is the code for this routine:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static uint32_t service_discovery_start()
{
    uint32_t   err_code;
    uint16_t   start_handle = 0x01;
    ble_uuid_t srvc_uuid;
	ble_uuid128_t srvc_uuid128;

    printf(&amp;quot;Discovering primary services\n&amp;quot;);
    fflush(stdout);

    //srvc_uuid.type = BLE_UUID_TYPE_BLE;
    srvc_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
    //srvc_uuid.type = BLE_UUID_TYPE_UNKNOWN;
    srvc_uuid.uuid = BLE_UUID_HEART_RATE_SERVICE;
	
	//for(int i=0;i&amp;lt;16;i++)
		//srvc_uuid128.uuid128[i] = BLE_UUID_LONG[i];
    	//printf(&amp;quot;%02X &amp;quot;, BLE_UUID_LONG[i]);
	srvc_uuid128.uuid128[0] = 0x32;
	srvc_uuid128.uuid128[1] = 0x0D;
	srvc_uuid128.uuid128[2] = 0x3B;
	srvc_uuid128.uuid128[3] = 0x45;
	srvc_uuid128.uuid128[4] = 0x12;
	srvc_uuid128.uuid128[5] = 0x32;
	srvc_uuid128.uuid128[6] = 0xF3;
	srvc_uuid128.uuid128[7] = 0x8B;
	srvc_uuid128.uuid128[8] = 0x84;
	srvc_uuid128.uuid128[9] = 0x47;
	srvc_uuid128.uuid128[10] = 0x07;
	srvc_uuid128.uuid128[11] = 0xEB;
	srvc_uuid128.uuid128[12] = 0x00;
	srvc_uuid128.uuid128[13] = 0x00;
	srvc_uuid128.uuid128[14] = 0xC3;
	srvc_uuid128.uuid128[15] = 0x17;
	
	err_code = sd_ble_uuid_vs_add(m_adapter, &amp;amp;srvc_uuid128, &amp;amp;srvc_uuid.type);
	
	if (err_code != NRF_SUCCESS)
    {
        printf(&amp;quot;Failed to add custom 128-bit UUID\n&amp;quot;);
        fflush(stdout);
    }

    // Initiate procedure to find the primary BLE_UUID_HEART_RATE_SERVICE.
    err_code = sd_ble_gattc_primary_services_discover(m_adapter,
                                                      m_connection_handle, start_handle,
                                                      &amp;amp;srvc_uuid);
                                                      //NULL);
    if (err_code != NRF_SUCCESS)
    {
        printf(&amp;quot;Failed to initiate or continue a GATT Primary Service Discovery procedure\n&amp;quot;);
        fflush(stdout);
    }

    return err_code;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;on_connected&amp;quot; routine is identical to what you&amp;#39;ve posted. As you can see, I&amp;#39;ve changed the type parameter of the srvc_uuid struct to BLE_UUID_TYPE_VENDOR_BEGIN, and I&amp;#39;ve defined a new struct (srvc_uuid128) which I&amp;#39;ve populated with the values of my device&amp;#39;s 128-bit UUID. I&amp;#39;ve added a call to &amp;quot;sd_ble_uuid_vs_add&amp;quot; to add this 128-bit UUID to the list of available UUIDs, and this does not return an error code.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also changed the value of BLE_UUID_HEART_RATE_SERVICE to 0x0100, to match with octets 12-13 of my service UUID. For reference, the full UUID of the service is 17C30001EB0747848BF33212453B0D32.&lt;/p&gt;
&lt;p&gt;I have been using this code as my base because it is the only example in the pc-ble-driver. I&amp;#39;ve been told multiple times, by multiple different Nordic reps, that this is what I need to use. So that is why I am using it. This UART example is not in the pc-ble-driver. I need to be able to make a C program that can connect to my device&amp;#39;s service, and read/write to its characteristics. From all I&amp;#39;ve been told, I need the pc-ble-driver to be able to do that. If there is other code that can do this, that can be built into a C project, please let me know. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248251?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 14:55:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:956717a5-1126-4240-ab8c-0444c009a826</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What does your on_connected() look like, then?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="mmercier"]If it helps, the only code I&amp;#39;ve modified is the &amp;quot;on_adv_report&amp;quot; routine[/quote]
&lt;p&gt;&amp;nbsp;That is probably the issue, because this example will by default look for the HRS UUID in the service discovery. This is why I keep pointing to the &lt;strong&gt;SDK example&lt;/strong&gt; ble_app_uart_c, because it shows you how to look for a long (128-bit) UUID, which you then need to modify to your own.&lt;/p&gt;
&lt;p&gt;If you haven&amp;#39;t changed it, your on_connected() function looks like this, right?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void on_connected(const ble_gap_evt_t * const p_ble_gap_evt)
{
    printf(&amp;quot;Connection established\n&amp;quot;);
    fflush(stdout);

    m_connected_devices++;
    m_connection_handle         = p_ble_gap_evt-&amp;gt;conn_handle;
    m_connection_is_in_progress = false;

    service_discovery_start();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And your service_discover_start() looks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static uint32_t service_discovery_start()
{
    uint32_t   err_code;
    uint16_t   start_handle = 0x01;
    ble_uuid_t srvc_uuid;

    printf(&amp;quot;Discovering primary services\n&amp;quot;);
    fflush(stdout);

    srvc_uuid.type = BLE_UUID_TYPE_BLE;
    srvc_uuid.uuid = BLE_UUID_HEART_RATE_SERVICE;

    // Initiate procedure to find the primary BLE_UUID_HEART_RATE_SERVICE.
    err_code = sd_ble_gattc_primary_services_discover(m_adapter,
                                                      m_connection_handle, start_handle,
                                                      &amp;amp;srvc_uuid);
    if (err_code != NRF_SUCCESS)
    {
        printf(&amp;quot;Failed to initiate or continue a GATT Primary Service Discovery procedure\n&amp;quot;);
        fflush(stdout);
    }

    return err_code;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What does service_discover_start()? And did you modify it somehow? If not, I suggest you try to change BLE_UUID_TYPE_BLE and BLE_UUID_HEART_RATE_SERVICE according to the device that you are trying to connect to.&lt;/p&gt;
&lt;p&gt;Don&amp;#39;t use BLE_UUID_TYPE_BLE, because these are the 16-bit UUIDs defined by Bluetooth. You want to use&amp;nbsp;BLE_UUID_TYPE_VENDOR_BEGIN, which are the 128-bit UUIDs. Then you need to change the BLE_UUID_HEART_RATE_SERVICE to a variable containing the UUID that you are expecting to find.&lt;/p&gt;
&lt;p&gt;Look at how this is done in SDK16.0.0\examples\ble_central\ble_app_uart_c.&lt;/p&gt;
&lt;p&gt;If you look in&amp;nbsp;ble_nus_c_init(). the base_uuid is added as&amp;nbsp;NUS_BASE_UUID, and the discovery is registered as&amp;nbsp;uart_uuid.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now, I have not tried this with pc-ble-driver, which works a bit different, but you need to change the srvc_uuid that you pass on in service_discovery_start. Try to do this, and see if you can manage to make it discover the custom uuid.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248242?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 14:37:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:477331ed-907a-4c93-80d7-9f3b7bb863e6</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Adding your code using insert-&amp;gt;code for readability:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ble_evt_dispatch(adapter_t * adapter, ble_evt_t * p_ble_evt)
{
    if (p_ble_evt == NULL)
    {
        printf(&amp;quot;Received an empty BLE event\n&amp;quot;);
        fflush(stdout);
        return;
    }
    
    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            on_connected(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));
            break;
        
        case BLE_GAP_EVT_DISCONNECTED:
            printf(&amp;quot;Disconnected, reason: 0x%02X\n&amp;quot;,
            p_ble_evt-&amp;gt;evt.gap_evt.params.disconnected.reason);
            fflush(stdout);
            m_connected_devices--;
            m_connection_handle = 0;
            break;
        
        case BLE_GAP_EVT_ADV_REPORT:
            on_adv_report(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));
            break;
        
        case BLE_GAP_EVT_TIMEOUT:
            on_timeout(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));
            break;
        
        case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP:
            on_service_discovery_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));
            break;
        
        case BLE_GATTC_EVT_CHAR_DISC_RSP:
            on_characteristic_discovery_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));
            break;
        
        case BLE_GATTC_EVT_DESC_DISC_RSP:
            on_descriptor_discovery_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));
            break;
        
        case BLE_GATTC_EVT_WRITE_RSP:
            on_write_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));
            break;
        
        case BLE_GATTC_EVT_HVX:
            on_hvx(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));
            break;
        
        case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
            on_conn_params_update_request(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));
            break;
        
        case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST:
            on_exchange_mtu_request(&amp;amp;(p_ble_evt-&amp;gt;evt.gatts_evt));
            break;
        
        case BLE_GATTC_EVT_EXCHANGE_MTU_RSP:
            on_exchange_mtu_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));
            break;
        
        default:
            printf(&amp;quot;Received an un-handled event with ID: %d\n&amp;quot;, p_ble_evt-&amp;gt;header.evt_id);
            fflush(stdout);
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248187?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 12:53:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b67a8b4c-72af-4346-b341-87a461b78fc1</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;My code is based on the Heart Rate Collector example from the pc-ble-driver package, and has not been changed in terms of the event handler and any setup functions. Here is the event handler, for reference:&lt;/p&gt;
&lt;p&gt;static void ble_evt_dispatch(adapter_t * adapter, ble_evt_t * p_ble_evt)&lt;br /&gt;{&lt;br /&gt; if (p_ble_evt == NULL)&lt;br /&gt; {&lt;br /&gt; printf(&amp;quot;Received an empty BLE event\n&amp;quot;);&lt;br /&gt; fflush(stdout);&lt;br /&gt; return;&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;switch (p_ble_evt-&amp;gt;header.evt_id)&lt;br /&gt; {&lt;br /&gt; case BLE_GAP_EVT_CONNECTED:&lt;br /&gt; on_connected(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GAP_EVT_DISCONNECTED:&lt;br /&gt; printf(&amp;quot;Disconnected, reason: 0x%02X\n&amp;quot;,&lt;br /&gt; p_ble_evt-&amp;gt;evt.gap_evt.params.disconnected.reason);&lt;br /&gt; fflush(stdout);&lt;br /&gt; m_connected_devices--;&lt;br /&gt; m_connection_handle = 0;&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GAP_EVT_ADV_REPORT:&lt;br /&gt; on_adv_report(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GAP_EVT_TIMEOUT:&lt;br /&gt; on_timeout(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP:&lt;br /&gt; on_service_discovery_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GATTC_EVT_CHAR_DISC_RSP:&lt;br /&gt; on_characteristic_discovery_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GATTC_EVT_DESC_DISC_RSP:&lt;br /&gt; on_descriptor_discovery_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GATTC_EVT_WRITE_RSP:&lt;br /&gt; on_write_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GATTC_EVT_HVX:&lt;br /&gt; on_hvx(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:&lt;br /&gt; on_conn_params_update_request(&amp;amp;(p_ble_evt-&amp;gt;evt.gap_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST:&lt;br /&gt; on_exchange_mtu_request(&amp;amp;(p_ble_evt-&amp;gt;evt.gatts_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;case BLE_GATTC_EVT_EXCHANGE_MTU_RSP:&lt;br /&gt; on_exchange_mtu_response(&amp;amp;(p_ble_evt-&amp;gt;evt.gattc_evt));&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;default:&lt;br /&gt; printf(&amp;quot;Received an un-handled event with ID: %d\n&amp;quot;, p_ble_evt-&amp;gt;header.evt_id);&lt;br /&gt; fflush(stdout);&lt;br /&gt; break;&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Previously, my issue with the UUIDs had occurred within the &amp;quot;on_connected&amp;quot; routine, but now, with the changes I described above, I&amp;#39;ve been able to move past this routine without errors. On the next pass through the event handler, I am entering the case for the &amp;quot;on_service_discovery_response&amp;quot; routine, and this is where I run into the error.&lt;/p&gt;
&lt;p&gt;The very first thing done in the &amp;quot;on_service_discovery_response&amp;quot; routine is to check the &amp;quot;gatt_status&amp;quot; parameter of the struct being passed to the function (in this case, p_ble_evt-&amp;gt;evt.gattc_evt is being passed, as can be seen above). If gatt_status is equal to 0, then the routine continues on, but displays an error message if it is anything else. In my case, I am getting error message 0x10A, which seems to correspond to BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND.&lt;/p&gt;
&lt;p&gt;I stepped through the code using breakpoints to monitor this value, and see if I can figure out where it is being changed to 0x10A. As I mentioned, the event handler goes through the case for &amp;quot;on_connected&amp;quot; immediately before the case where I am seeing the error. During this entire pass through the event handler, the &amp;quot;gatt_status&amp;quot; parameter of p_ble_evt-&amp;gt;evt.gattc_evt is equal to 0. This is true for when the &amp;quot;on_connected&amp;quot; routine is being executed, and for afterward, when the event handler case ends and goes to the end of the function.&lt;/p&gt;
&lt;p&gt;However, when the event handler then enters its next pass, the &amp;quot;gatt_status&amp;quot; suddenly changes to 0x10A. I do not know what all is going on between passes through the event handler. I am assuming it is done using the library functions, but just stepping through, I don&amp;#39;t see anything occurring between passes. Either way, something is occurring, since the value of p_ble_evt-&amp;gt;header.evt_id is changing (so that the event handler enters a different case), and I am assuming whatever changes this value is also responsible for setting the gatt_status.&lt;/p&gt;
&lt;p&gt;If it helps, the only code I&amp;#39;ve modified is the &amp;quot;on_adv_report&amp;quot; routine (to check for Manufacturer Specific Data rather than Device Name) and the &amp;quot;service_discovery_start&amp;quot; routine (to add the 128-bit UUID, as described above). Other than that, my code is effectively identical to the heart rate collector example in the pc-ble-driver github page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248099?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 08:59:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dae1933-341f-4379-9b29-7504fce4c64e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Where exactly does the BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND appear?&lt;/p&gt;
&lt;p&gt;Is&amp;nbsp;db_disc_handler() called? Or whatever function that is set to the event handler that is passed onto ble_db_discovery_init():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/** @brief Function for initializing the database discovery module. */
static void db_discovery_init(void)
{
    ble_db_discovery_init_t db_init;

    memset(&amp;amp;db_init, 0, sizeof(ble_db_discovery_init_t));

    db_init.evt_handler  = db_disc_handler;
    db_init.p_gatt_queue = &amp;amp;m_ble_gatt_queue;

    ret_code_t err_code = ble_db_discovery_init(&amp;amp;db_init);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Does it have:&lt;/p&gt;
&lt;p&gt;p_evt-&amp;gt;evt_type ==&amp;nbsp;BLE_DB_DISCOVERY_COMPLETE?&lt;/p&gt;
&lt;p&gt;If so, what is&amp;nbsp;p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If this event does not occur, can you show me how you initialize the central service on your central?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="mmercier"]Doing more studying with breakpoints, it looks like this &amp;quot;gatt_status&amp;quot; variable remains at 0 through the entire &amp;quot;on_connected&amp;quot;[/quote]
&lt;p&gt;&amp;nbsp;What do you mean by gatt_status? Can you show some snippets? In what event do you expect this to change? Are you talking about the&amp;nbsp;&lt;/p&gt;
&lt;p&gt;p_ble_gattc_evt-&amp;gt;gatt_status? If so, 0 means&amp;nbsp;BLE_GATT_STATUS_SUCCESS, so this being 0 is not unexpected.&lt;/p&gt;
&lt;p&gt;Are you talking about the&amp;nbsp;on_primary_srv_discovery_rsp()? If so, does it print anything from this callback?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248021?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 19:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eedbce7-5c0f-41fc-96d2-bf0d221425fd</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;I believe I&amp;#39;ve found the error, I needed to search for 0x0100 instead of 0x100.&lt;/p&gt;
&lt;p&gt;It looks like this error message is called BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND. So there is some attribute not being found when the service is being discovered. Unfortunately, since this is not in response to any function call, I have no idea what is setting this variable. It is the &amp;quot;gatt_status&amp;quot; parameter of the ble_evt object&amp;#39;s evt.gattc_evt parameter, which is passed to the &amp;quot;on_service_discovery_response&amp;quot; function by the event handler.&lt;/p&gt;
&lt;p&gt;Doing more studying with breakpoints, it looks like this &amp;quot;gatt_status&amp;quot; variable remains at 0 through the entire &amp;quot;on_connected&amp;quot; routine, even after finishing and ending the pass through the event handler&amp;#39;s loop. But then, when the event handler enters its next pass (going to the case for BLE_GATTC_EVT_PRIM_SRVC_DISC_RESP), this value is now set to 0x10A.&lt;/p&gt;
&lt;p&gt;So whatever is changing the evt_id, I&amp;#39;m assuming, is responsible for changing the &amp;quot;gatt_status&amp;quot; parameter, and it&amp;#39;s being set to this error code.&lt;/p&gt;
&lt;p&gt;Could you please help me figure out what attribute is not being found? Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/248019?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 19:33:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3c55d38-aac9-4fdd-a312-96aa474ab0a0</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;I did some more experimenting with different functions. I found a function called &amp;quot;sd_ble_uuid_vs_add&amp;quot;, which is supposed to add a vendor specific UUID to the program. I defined a struct of type ble_uuid128_t, and assigned its 16-length array to be my device&amp;#39;s full 128-bit UUID (in little endian format, ie, srvc_uuid128[0] = 0x32, srvc_uuid128[1] = 0x0D, etc). &lt;/p&gt;
&lt;p&gt;I assigned this function to return an error code and print a fail message if it isn&amp;#39;t equal to NRF_SUCCESS, and I made it past this function with no errors. I am also now making it past the &amp;quot;sd_ble_gattc_primary_services_discover&amp;quot; function without error (using 0x0100 as my 16-bit UUID, based on the service).&lt;/p&gt;
&lt;p&gt;However, I am now receiving an error message at the &amp;quot;on_service_discovery_response&amp;quot; function. The very first thing checked is the &amp;quot;gatt_status&amp;quot; parameter of the &amp;quot;p_ble_gattc_evt&amp;quot; object. This is failing with an error code of 0x10A. I tried searching the header files for an 0x10A, with no results, and for an 0x100. The only result I found was an error code that corresponds to 0x100 + some constant, which is defined as 0x3000, so this clearly isn&amp;#39;t my error message.&lt;/p&gt;
&lt;p&gt;So I am now at the point where I began, before trying to make changes to the UUID properties. Could you please help me to determine what this 0x10A error message means, and what to do about this? Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/247992?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 16:41:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6172e883-5a34-418d-9f72-e0004e8c44b4</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;Would you be able to let me know the functions I need to call in order to connect to this service using the pc-ble-driver C program? Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/247958?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 15:10:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d00bd0e-6828-45fc-b07a-fb68fc001692</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/BLE-Image.png" /&gt;&lt;/p&gt;
&lt;p&gt;Here is the product when connected in nRF Connect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/247953?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 15:03:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8dea168d-299b-4eec-b35c-2c0e59d271eb</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;The product has the service UUID of 17C30001EB0747848BF33212453B0D32. It is not a heart rate monitor. I am using the heart rate collector example because it is the only example that exists in the pc-ble-driver package.&lt;/p&gt;
&lt;p&gt;According to the description of the struct definition, this struct &amp;quot;encapsulates both 16-bit and 128-bit UUIDs&amp;quot;. For 128-bit UUIDs, I need to define the &amp;#39;uuid&amp;#39; parameter of the struct as &amp;quot;octets 12-13 of 128-bit UUID&amp;quot;, according to the description.&lt;/p&gt;
&lt;p&gt;It is worth noting that there is another struct type defined in this header file called &amp;quot;ble_uuid128_t&amp;quot;, which only has a single parameter made up of an array of 8-bit values. However, the &amp;quot;sd_ble_gattc_primary_services_discover&amp;quot; is expecting to be passed a parameter of type &amp;quot;ble_uuid_t&amp;quot;, not &amp;quot;ble_uuid128_t&amp;quot;. And this function is defined in the pc-ble-driver libraries, so it&amp;#39;s not as if I can simply modify it to take the other struct instead.&lt;/p&gt;
&lt;p&gt;Considering that the &amp;quot;ble_uuid_t&amp;quot; struct has a parameter for type, and this can be set to &amp;quot;BLE_UUID_TYPE_VENDOR_BEGIN&amp;quot;, this seems to suggest to me that this struct should be usable for defining 128-bit UUID services. I am wondering, then, if there needs to be some other function call that sets the rest of the 128-bit UUID. If there is, though, I can&amp;#39;t find it. The program calls &amp;quot;sd_ble_gattc_primary_services_discover&amp;quot; as its first function call on connection.&lt;/p&gt;
&lt;p&gt;Could you please let me know if there is either a function I need to use to set the rest of the UUID, or if there is a function I can use to pass a &amp;quot;ble_uuid128_t&amp;quot; struct instead of a &amp;quot;ble_uuid_t&amp;quot;? Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/247945?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 14:52:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18190f3d-ef79-4993-8a71-8df99c0b1bb5</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Let&amp;#39;s keep this in one ticket. If I understand correctly, we are currently discussing the same issue in both the tickets that you have with me. I&amp;#39;ll close the other one, and we can continue here.&lt;/p&gt;
&lt;p&gt;What does the service of your peripheral look like in nRF Connect -&amp;gt; Bluetooth? Can you show me a screenshot? Didn&amp;#39;t you say that it was a custom UUID?`Please note that you can&amp;#39;t just change UUIDs from the standard Bluetooth UUIDs, such as the heart rate monitor UUID, and keep it as a short UUID. If you customize it, you must use a 128-bit UUID.&lt;/p&gt;
&lt;p&gt;However, if you have a standard Heart rate UUID, look at how the UUID is implemented in the ble_app_hrs example and how it appears in the nRF Connect -&amp;gt; Bluetooth Low Energy.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, what does your peripheral look like in nRF Connect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Failed using pc-ble-driver</title><link>https://devzone.nordicsemi.com/thread/247938?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 14:41:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab4ef915-6ce1-42fa-9873-750e77c90fdd</guid><dc:creator>mmercier</dc:creator><description>&lt;p&gt;For further info, here is the definition of the struct being used, defined in ble_types.h:&lt;/p&gt;
&lt;p&gt;/** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */&lt;br /&gt;typedef struct&lt;br /&gt;{&lt;br /&gt; uint16_t uuid; /**&amp;lt; 16-bit UUID value or octets 12-13 of 128-bit UUID. */&lt;br /&gt; uint8_t type; /**&amp;lt; UUID type, see @ref BLE_UUID_TYPES. If type is @ref BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */&lt;br /&gt;} ble_uuid_t;&lt;/p&gt;
&lt;p&gt;The &amp;quot;service_discovery_start&amp;quot; routine is creating a struct of this type and passing it to the function &amp;quot;sd_ble_gattc_primary_services_discover&amp;quot;, which is defined in the pc-ble-driver libraries. I currently have the &amp;#39;type&amp;#39; parameter of this struct set to BLE_UUID_TYPE_VENDOR_BEGIN, and I&amp;#39;m trying to figure out what value to set for the &amp;#39;uuid&amp;#39; parameter.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>