<?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>What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52838/what-variable-and-struct-does-the-write-characteristic-store-its-data-in-after-a-write-command-from-an-application-on-nrf-connect</link><description>Hello, 
 I have followed the BLE tutorial on characteristics to make my own 2 custom characteristics that successfully read and write uint8 data to my nRF52832, however I want to take that data that was written from each characteristic to my chip and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 14 Oct 2019 12:43:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52838/what-variable-and-struct-does-the-write-characteristic-store-its-data-in-after-a-write-command-from-an-application-on-nrf-connect" /><item><title>RE: What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/thread/214838?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2019 12:43:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acd525dd-b604-4fc2-8c7d-ff6b30f90c90</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Write is a GATT event. I&amp;#39;d recommend you to take a look at existing services such as NUS and Blinky&amp;nbsp;and see how these forward GATT&amp;nbsp;&amp;quot;write&amp;quot; events to the application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Code snippet below is from the ble_nus.c service used by the ble_app_uart example&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ble_nus_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context)
{
    if ((p_context == NULL) || (p_ble_evt == NULL))
    {
        return;
    }

    ble_nus_t * p_nus = (ble_nus_t *)p_context;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            on_connect(p_nus, p_ble_evt);
            break;

        case BLE_GATTS_EVT_WRITE:
            on_write(p_nus, p_ble_evt); //&amp;lt;-- Received write event. Run on_write to see if belongs to the NUS service
            break;

        case BLE_GATTS_EVT_HVN_TX_COMPLETE:
            on_hvx_tx_complete(p_nus, p_ble_evt);
            break;

        default:
            // No implementation needed.
            break;
    }
}
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here you can see how the&amp;nbsp;BLE_GATTS_EVT_WRITE event is processed and how it&amp;#39;s being forwarded to the event handler registered by the application during service init.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/thread/214678?ContentTypeID=1</link><pubDate>Sat, 12 Oct 2019 18:59:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7101561e-3afc-47cd-bfd8-949673e3f96c</guid><dc:creator>RyanA</dc:creator><description>&lt;p&gt;Ok, I am looking through all the events in the same location as BLE_GAP_EVT (ble_gap.h), and I see this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief GAP Event IDs.
 * IDs that uniquely identify an event coming from the stack to the application.
 */
enum BLE_GAP_EVTS
{
  BLE_GAP_EVT_CONNECTED                   = BLE_GAP_EVT_BASE,       /**&amp;lt; Connected to peer.                              \n See @ref ble_gap_evt_connected_t             */
  BLE_GAP_EVT_DISCONNECTED                = BLE_GAP_EVT_BASE + 1,   /**&amp;lt; Disconnected from peer.                         \n See @ref ble_gap_evt_disconnected_t.         */
  BLE_GAP_EVT_CONN_PARAM_UPDATE           = BLE_GAP_EVT_BASE + 2,   /**&amp;lt; Connection Parameters updated.                  \n See @ref ble_gap_evt_conn_param_update_t.    */
  BLE_GAP_EVT_SEC_PARAMS_REQUEST          = BLE_GAP_EVT_BASE + 3,   /**&amp;lt; Request to provide security parameters.         \n Reply with @ref sd_ble_gap_sec_params_reply.  \n See @ref ble_gap_evt_sec_params_request_t. */
  BLE_GAP_EVT_SEC_INFO_REQUEST            = BLE_GAP_EVT_BASE + 4,   /**&amp;lt; Request to provide security information.        \n Reply with @ref sd_ble_gap_sec_info_reply.    \n See @ref ble_gap_evt_sec_info_request_t.   */
  BLE_GAP_EVT_PASSKEY_DISPLAY             = BLE_GAP_EVT_BASE + 5,   /**&amp;lt; Request to display a passkey to the user.       \n In LESC Numeric Comparison, reply with @ref sd_ble_gap_auth_key_reply. \n See @ref ble_gap_evt_passkey_display_t. */
  BLE_GAP_EVT_KEY_PRESSED                 = BLE_GAP_EVT_BASE + 6,   /**&amp;lt; Notification of a keypress on the remote device.\n See @ref ble_gap_evt_key_pressed_t           */
  BLE_GAP_EVT_AUTH_KEY_REQUEST            = BLE_GAP_EVT_BASE + 7,   /**&amp;lt; Request to provide an authentication key.       \n Reply with @ref sd_ble_gap_auth_key_reply.    \n See @ref ble_gap_evt_auth_key_request_t.   */
  BLE_GAP_EVT_LESC_DHKEY_REQUEST          = BLE_GAP_EVT_BASE + 8,   /**&amp;lt; Request to calculate an LE Secure Connections DHKey. \n Reply with @ref sd_ble_gap_lesc_dhkey_reply.  \n See @ref ble_gap_evt_lesc_dhkey_request_t */
  BLE_GAP_EVT_AUTH_STATUS                 = BLE_GAP_EVT_BASE + 9,   /**&amp;lt; Authentication procedure completed with status. \n See @ref ble_gap_evt_auth_status_t.          */
  BLE_GAP_EVT_CONN_SEC_UPDATE             = BLE_GAP_EVT_BASE + 10,  /**&amp;lt; Connection security updated.                    \n See @ref ble_gap_evt_conn_sec_update_t.      */
  BLE_GAP_EVT_TIMEOUT                     = BLE_GAP_EVT_BASE + 11,  /**&amp;lt; Timeout expired.                                \n See @ref ble_gap_evt_timeout_t.              */
  BLE_GAP_EVT_RSSI_CHANGED                = BLE_GAP_EVT_BASE + 12,  /**&amp;lt; RSSI report.                                    \n See @ref ble_gap_evt_rssi_changed_t.         */
  BLE_GAP_EVT_ADV_REPORT                  = BLE_GAP_EVT_BASE + 13,  /**&amp;lt; Advertising report.                             \n See @ref ble_gap_evt_adv_report_t.           */
  BLE_GAP_EVT_SEC_REQUEST                 = BLE_GAP_EVT_BASE + 14,  /**&amp;lt; Security Request.                               \n See @ref ble_gap_evt_sec_request_t.          */
  BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST   = BLE_GAP_EVT_BASE + 15,  /**&amp;lt; Connection Parameter Update Request.            \n Reply with @ref sd_ble_gap_conn_param_update. \n See @ref ble_gap_evt_conn_param_update_request_t. */
  BLE_GAP_EVT_SCAN_REQ_REPORT             = BLE_GAP_EVT_BASE + 16,  /**&amp;lt; Scan request report.                            \n See @ref ble_gap_evt_scan_req_report_t. */
  BLE_GAP_EVT_PHY_UPDATE_REQUEST          = BLE_GAP_EVT_BASE + 17,  /**&amp;lt; PHY Update Request.                             \n Reply with @ref sd_ble_gap_phy_update. \n See @ref ble_gap_evt_phy_update_request_t. */
  BLE_GAP_EVT_PHY_UPDATE                  = BLE_GAP_EVT_BASE + 18,  /**&amp;lt; PHY Update Procedure is complete.               \n See @ref ble_gap_evt_phy_update_t.           */
  BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST = BLE_GAP_EVT_BASE + 19,   /**&amp;lt; Data Length Update Request.                     \n Reply with @ref sd_ble_gap_data_length_update.\n See @ref ble_gap_evt_data_length_update_request_t. */
  BLE_GAP_EVT_DATA_LENGTH_UPDATE         = BLE_GAP_EVT_BASE + 20,   /**&amp;lt; LL Data Channel PDU payload length updated.     \n See @ref ble_gap_evt_data_length_update_t. */
  BLE_GAP_EVT_QOS_CHANNEL_SURVEY_REPORT  = BLE_GAP_EVT_BASE + 21,   /**&amp;lt; Channel survey report.                          \n See @ref ble_gap_evt_qos_channel_survey_report_t. */
  BLE_GAP_EVT_ADV_SET_TERMINATED         = BLE_GAP_EVT_BASE + 22,   /**&amp;lt; Advertising set terminated.                     \n See @ref ble_gap_evt_adv_set_terminated_t. */
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Looking through each of these I can&amp;#39;t determine which one is applicable to reacting to &amp;quot;write&amp;quot; events.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/thread/214223?ContentTypeID=1</link><pubDate>Wed, 09 Oct 2019 17:46:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5662a29e-886b-4346-8042-53aedff19df7</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;That&amp;#39;s the one!&lt;/p&gt;
&lt;p&gt;If you go to the definitions of those events, you will find that there are also other events - including one for &amp;#39;Write&amp;#39;.&lt;/p&gt;
&lt;p&gt;In the event structure, you get (a pointer to) the data that was written ...&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/0564._5F00_Insert-Code-_2D00_-Nordic-2.png" /&gt;&lt;/p&gt;
&lt;p&gt;Not as pictures!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/thread/214222?ContentTypeID=1</link><pubDate>Wed, 09 Oct 2019 17:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd099e5b-5bb9-4308-8292-a131ea7297d4</guid><dc:creator>RyanA</dc:creator><description>&lt;p&gt;I read the characteristics tutorial and I can see they have a handler for the BLE event in this function:&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/BLE_5F00_Observer.PNG" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In that handler we get this definition:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Event-handler.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Where in here are we updating our actual write value data? I want to take that written value and print it in the debug window to verify my app write function is working.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/thread/213608?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2019 10:55:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27f90fc1-20e2-4ea6-becb-f6dca6133680</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Have you looked at the Service &amp;amp; Characteristic tutorials?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-services-a-beginners-tutorial"&gt;https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-services-a-beginners-tutorial&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial"&gt;https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;they include the event handler ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/thread/213529?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2019 03:29:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25d89367-b0e9-4090-88c5-7711fbff5c5d</guid><dc:creator>RyanA</dc:creator><description>&lt;p&gt;Ok, is there a specific function or struct that I can see that in?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What variable and struct does the write characteristic store its data in after a write command from an application on nrf connect?</title><link>https://devzone.nordicsemi.com/thread/213131?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2019 08:56:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36e8887f-c18b-4554-97e5-c7f32c8c3fe4</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;When the Central (any Central - not specific to nRF Connect) writes a Characteristic, you will get a BLE Event - and the data is in that event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>