<?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>Send struct of data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5838/send-struct-of-data</link><description>Hi all, 
 If I want to send a table that contains a structure in each of his cases using sd_ble_gatts_hvx(), can I get it ? 
Knowing that the second parametre of sd_ble_gatts_hvx() contains a ble_gatts_hvx_params_t variable, which has the uint8* p_data</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 Mar 2015 16:49:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5838/send-struct-of-data" /><item><title>RE: Send struct of data</title><link>https://devzone.nordicsemi.com/thread/20398?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2015 16:49:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c06e50ef-3b08-4579-9694-2215f3b8a5b0</guid><dc:creator>mohBOSS</dc:creator><description>&lt;p&gt;Hi John, thanks for your helps and time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send struct of data</title><link>https://devzone.nordicsemi.com/thread/20397?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2015 16:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13ea3054-98f7-4221-b0d0-c28ba409634b</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Hi, I&amp;#39;m guessing you can&amp;#39;t cast due to a coding standard? Not that it matters, another solution would be to change your rssi_mac struct into a union of your structure with a uint8_t array. Then you could assign the uint8_t portion of the union to p_data without a warning.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send struct of data</title><link>https://devzone.nordicsemi.com/thread/20396?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2015 16:22:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db678938-af70-43d2-ab2f-f0b4085ca94d</guid><dc:creator>mohBOSS</dc:creator><description>&lt;p&gt;typedef struct&lt;/p&gt;
&lt;p&gt;{
int8_t rssi;
ble_gap_addr_t  advertisor_addr;
}rssi_mac;&lt;/p&gt;
&lt;p&gt;uint32_t ble_rssi_mac_send(ble_rssi_mac_t * p_lbs, rssi_mac data_to_send)
{&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_gatts_hvx_params_t params;
uint16_t len = sizeof(data_to_send);

memset(&amp;amp;params, 0, sizeof(params));
params.type = BLE_GATT_HVX_NOTIFICATION;
params.handle = p_lbs-&amp;gt;rssi_mac_char_handles.value_handle;
params.p_data = &amp;amp;data_to_send;
params.p_len = &amp;amp;len;

return sd_ble_gatts_hvx(p_lbs-&amp;gt;conn_handle, &amp;amp;params); 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;I was wrong, it&amp;#39;s not an error but a warning about non compatible types.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send struct of data</title><link>https://devzone.nordicsemi.com/thread/20395?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2015 16:02:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0c3682d-f247-42b7-bf64-3cdaa752c75e</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Can you post the relevant code and the error?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send struct of data</title><link>https://devzone.nordicsemi.com/thread/20394?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2015 13:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14c9812e-e9f9-4b8c-91a3-c2e80b7bc8e3</guid><dc:creator>mohBOSS</dc:creator><description>&lt;p&gt;Hi, thanks for your reply. The problem is that I have an error of type, when I assign the table of struct to the uint8* p_data attribute. I can not do a cast also.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send struct of data</title><link>https://devzone.nordicsemi.com/thread/20393?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2015 13:15:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36028a8e-5b22-448e-84c1-1d181c12883a</guid><dc:creator>John</dc:creator><description>&lt;p&gt;The short answer is yes, you can transfer anything you want.&lt;/p&gt;
&lt;p&gt;The BLE transport only knows it is transporting bytes from peripheral to central or vice versa. It doesn&amp;#39;t know or care what those bytes represent, they can be anything you want them to be. There are limitations such as the need to fragment things over 20 bytes in size, the speed at which you can do the transfer, and things like that, but there is nothing to prevent you from transferring anything you want to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>