<?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>comparision of uart received  data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40567/comparision-of-uart-received-data</link><description>hi, 
 i am using nrf51422 ble_app_uart(sdk 12.3.0) example 
 i am receiving a string through app_uart_get() function, i want to compare it then i have to send some predefined string using ble_nus_string_send() function. how can i do it?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Nov 2018 16:02:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40567/comparision-of-uart-received-data" /><item><title>RE: comparision of uart received  data</title><link>https://devzone.nordicsemi.com/thread/158244?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 16:02:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0048b11b-ce69-401d-94a9-dd39932c8a6e</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;This is basic program design - nothing specifically to do with Nordic!&lt;/p&gt;
&lt;p&gt;Think about it: If nothing writes to the data_array[], then it will continue to contain the same data - so your strings will match each time round the main loop.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you want the string to be handled only once, then you will need some way to know that you have already handled it - won&amp;#39;t you ... ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: comparision of uart received  data</title><link>https://devzone.nordicsemi.com/thread/158169?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 12:49:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24987099-940a-42d6-99f1-08017bf9559e</guid><dc:creator>shrushruta</dc:creator><description>&lt;p&gt;Thanks for your reply, ya i am&amp;nbsp;able to compare string using if statement.&lt;/p&gt;
&lt;p&gt;please check my code, here once i transmit&amp;nbsp;a string&amp;nbsp;&amp;nbsp;through terminal i am receiving the values(defined my me) continuously. But what i want is if i transmit data through terminal i should receive it only one time in my mobile app&lt;/p&gt;
&lt;p&gt;thank you.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{
    uint32_t err_code;
    bool erase_bonds;

    // Initialize.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    uart_init();

    buttons_leds_init(&amp;amp;erase_bonds);
    ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();

    printf(&amp;quot;\r\nUART Start!\r\n&amp;quot;);
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);
	
    // Enter main loop.
    for (;;)
    {
			power_manage();
			 
			if ((data_array[0] == &amp;#39;u&amp;#39;) &amp;amp;&amp;amp; (data_array[1] == &amp;#39;p&amp;#39;))
					{
						err_code = ble_nus_string_send(&amp;amp;m_nus, up, 3);
						index = 0;
								
					}
		 if((data_array[0] == &amp;#39;d&amp;#39;) &amp;amp;&amp;amp; (data_array[1] == &amp;#39;o&amp;#39;)&amp;amp;&amp;amp;(data_array[2]==&amp;#39;w&amp;#39;)==(data_array[3]==&amp;#39;n&amp;#39;))
          {
						err_code = ble_nus_string_send(&amp;amp;m_nus, down, 3);
						index = 0;
          }			
      
            
   }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: comparision of uart received  data</title><link>https://devzone.nordicsemi.com/thread/158093?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 06:17:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d2c4f38-708a-4fe3-af36-f8fc3cfb9123</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;br /&gt;&lt;br /&gt;Not quite sure what you mean by &amp;quot;compare it&amp;quot;, you can use memcmp (compare two blocks of memory) or an if-sentence to compare it?&lt;br /&gt;&lt;br /&gt;If sentence explained &lt;a href="https://www.cprogramming.com/tutorial/c/lesson2.html"&gt;here&lt;/a&gt;.&lt;br /&gt;memcmp explained &lt;a href="http://www.cplusplus.com/reference/cstring/memcmp/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The ble_nus_string_send() function and the Nordic UART Service API for SDK 12.3 can be found &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v12.3.0%2Fgroup__ble__nus.html&amp;amp;resultof=%22%62%6c%65%5f%6e%75%73%5f%73%74%72%69%6e%67%5f%73%65%6e%64%22%20"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>