<?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>characteristic value as a structure</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4207/characteristic-value-as-a-structure</link><description>Hello,
I am working with S130 softdevice. I am using SDK v6. I want to send multiple data as a single characteristic value (possibly as a structure). But it is seen that p_value in ble_gatts_attr_t is uint8_t*. Can I modify it to a structure pointer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Jun 2015 21:16:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4207/characteristic-value-as-a-structure" /><item><title>RE: characteristic value as a structure</title><link>https://devzone.nordicsemi.com/thread/15025?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2015 21:16:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a480e06b-393d-4760-b541-cbd9f10bb0cc</guid><dc:creator>kerem</dc:creator><description>&lt;p&gt;Thanks for the union hint.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: characteristic value as a structure</title><link>https://devzone.nordicsemi.com/thread/15024?ContentTypeID=1</link><pubDate>Tue, 28 Oct 2014 04:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:885f6a5e-ea5f-4d18-a2c0-6e50ea5e4df2</guid><dc:creator>Anjaly</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: characteristic value as a structure</title><link>https://devzone.nordicsemi.com/thread/15023?ContentTypeID=1</link><pubDate>Mon, 27 Oct 2014 16:28:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd122699-cfbc-49c6-8a7b-39a6d5834811</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;I believe the two most common ways to solve this issue is:&lt;/p&gt;
&lt;p&gt;a) As John says you could always cast your struct pointer to a uint8_t pointer, and assign it to p_value.&lt;/p&gt;
&lt;p&gt;b) Declare your struct as a union between a uint8_t array and a sub-struct containing all your fields.
Then you can refer to the uint8_t array when passing the data to the BLE stack, and refer to the sub-struct when assigning your data fields.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: characteristic value as a structure</title><link>https://devzone.nordicsemi.com/thread/15022?ContentTypeID=1</link><pubDate>Mon, 27 Oct 2014 14:53:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efc80f1f-b6be-407a-b67c-a8ec33659ad6</guid><dc:creator>John</dc:creator><description>&lt;p&gt;I had the opposite problem when receiving our proprietary commands on a characteristic. It was relatively simple to create a pointer to a structure of our command and then assign it the address of the uint8 * in the write event. It looks like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    ble_gatts_evt_write_t	* p_evt_write = &amp;amp;p_ble_evt-&amp;gt;evt.gatts_evt.params.write;
    onset_recv_command_t	* p_received_command = (onset_recv_command_t *)&amp;amp;p_evt_write-&amp;gt;data[0];
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You could do the opposite and fill in your structure and then assign the address to your uint8_t pointer for your write command.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>