<?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>writing to an attribute without a server connection?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39222/writing-to-an-attribute-without-a-server-connection</link><description>Good afternoon, 
 I have a question regarding the ble_app_hrs_rscs_relay example. I am using this example to read scan response data from a peripheral without pairing with it. I am parsing the data and would like to send it to a cell phone that connects</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Oct 2018 11:53:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39222/writing-to-an-attribute-without-a-server-connection" /><item><title>RE: writing to an attribute without a server connection?</title><link>https://devzone.nordicsemi.com/thread/152036?ContentTypeID=1</link><pubDate>Mon, 08 Oct 2018 11:53:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:474a83a6-e403-4d84-8769-5c3602d1b968</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Gianfranco,&lt;/p&gt;
&lt;p&gt;Yes, you can do scan request to other sensors to collect data and then send data to the phone via a connection.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you send data to the phone in a connection, the easiest way is to call&amp;nbsp;&lt;span&gt;sd_ble_gatts_hvx() as you mentioned. This function will send a notification to the phone and the phone then can display/store the data on the app.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But the&amp;nbsp;conn_handle you need to provide to the function is not the connection to the sensor but the connection handle to the phone. And you should have a valid conn_handle to the phone to be able to send the notification. Make sure you enable notification on the phone prior to that.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I would suggest you to study the ble_app_hrs example in the SDK where it send notification to the phone using the *_hvx function. The ble_app_uart example is also useful.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note that you would need to find a way in your relay application to tell the app on the phone the data was from which sensor. Maybe by using one extra byte in the notification payload.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>