<?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>Differentiate between different writes</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7713/differentiate-between-different-writes</link><description>I have a few characteristics under a service, and I&amp;#39;m trying to store the value if any of these characteristics is written to. However I run into an issue where if I enable services on the Master Control Panel, my code thinks that the value of the characteristic</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 05 Jul 2016 03:41:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7713/differentiate-between-different-writes" /><item><title>RE: Differentiate between different writes</title><link>https://devzone.nordicsemi.com/thread/27483?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2016 03:41:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c9c3c91-c776-4399-bb5f-85c77f30f2fc</guid><dc:creator>Tony Garland</dc:creator><description>&lt;p&gt;I&amp;#39;m working with s13x_nrf5x_2.0.0 and the migration document indicates that write.context has been replaced by write.uuid.  The write.uuid has a type field, but that appears to be the type of UUID, not the GATT server attribute type.  So, when working with the s132, how can one check that the write is to a characteristic value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiate between different writes</title><link>https://devzone.nordicsemi.com/thread/27482?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2015 14:20:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3140d55e-dae7-4818-a124-bf644b3533e6</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;You should be able use the GATT Server Attribute Types:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/** @defgroup BLE_GATTS_ATTR_TYPES GATT Server Attribute Types
 * @{ */
#define BLE_GATTS_ATTR_TYPE_INVALID         0x00  /**&amp;lt; Invalid Attribute Type. */
#define BLE_GATTS_ATTR_TYPE_PRIM_SRVC_DECL  0x01  /**&amp;lt; Primary Service Declaration. */
#define BLE_GATTS_ATTR_TYPE_SEC_SRVC_DECL   0x02  /**&amp;lt; Secondary Service Declaration. */
#define BLE_GATTS_ATTR_TYPE_INC_DECL        0x03  /**&amp;lt; Include Declaration. */
#define BLE_GATTS_ATTR_TYPE_CHAR_DECL       0x04  /**&amp;lt; Characteristic Declaration. */
#define BLE_GATTS_ATTR_TYPE_CHAR_VAL        0x05  /**&amp;lt; Characteristic Value. */
#define BLE_GATTS_ATTR_TYPE_DESC            0x06  /**&amp;lt; Descriptor. */
#define BLE_GATTS_ATTR_TYPE_OTHER           0x07  /**&amp;lt; Other, non-GATT specific type. */
/** @} */
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When you get a write event check that the write is to the characteristic value, not the descriptor.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if(p_ble_evt-&amp;gt;evt.gatts_evt.params.write.context.type == BLE_GATTS_ATTR_TYPE_CHAR_VAL)
{
      //Your code
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiate between different writes</title><link>https://devzone.nordicsemi.com/thread/27481?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 21:30:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20b88d81-8426-4fed-8b8a-9042ced8b68b</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;When you initialize your service, you pass in this structure, like in hrs;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; err_code = ble_hrs_init(&amp;amp;m_hrs, &amp;amp;hrs_init);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That m_hrs struct is also passed from ble_evt_dispatch()&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
dm_ble_evt_handler(p_ble_evt);
ble_hrs_on_ble_evt(&amp;amp;m_hrs, p_ble_evt);
(...)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Maybe you should post more of your code if this doesn&amp;#39;t get you on your way :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiate between different writes</title><link>https://devzone.nordicsemi.com/thread/27480?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 21:11:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d229896-d285-48ee-8e16-99d43cea57e6</guid><dc:creator>danbujak</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure how I could do this. I&amp;#39;m calling check_status() from ble_evt_dispatch()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiate between different writes</title><link>https://devzone.nordicsemi.com/thread/27479?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 21:02:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9dd4ad1-39ac-4cf8-a00f-a6012a67b3e5</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;I see in the heart rate service example, in hrs.c -&amp;gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void on_write(ble_hrs_t * p_hrs, ble_evt_t * p_ble_evt)
{
ble_gatts_evt_write_t * p_evt_write = &amp;amp;p_ble_evt-&amp;gt;evt.gatts_evt.params.write;

if (p_evt_write-&amp;gt;handle == p_hrs-&amp;gt;hrm_handles.cccd_handle)
{
    on_hrm_cccd_write(p_hrs, p_evt_write);
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Could you get your service structure passed into your check_status()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiate between different writes</title><link>https://devzone.nordicsemi.com/thread/27478?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 20:52:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:970c7bdb-3838-4289-b06c-62c90e77f1e9</guid><dc:creator>danbujak</dc:creator><description>&lt;p&gt;Yes that&amp;#39;s the behaviour I see, but I&amp;#39;d like to know how to differentiate between a write to the value vs a write to some other parameter. I intentionally do advertising init when anything contained in the DEVICE_STATUS_SERVICE_UUID service is written to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Differentiate between different writes</title><link>https://devzone.nordicsemi.com/thread/27477?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2015 20:48:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e1ae099-feb4-4286-b7f8-1c44bced70f7</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;MCP is doing a write to CCCD to enable services, which will enter this case, and you are doing advertising init no matter what is written to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>