<?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>Turn off print to terminal with NUS data handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50773/turn-off-print-to-terminal-with-nus-data-handler</link><description>Hi! 
 I&amp;#39;m using the ble_app_uart example with SDK 15.0.3 and nRF52840 DK. I&amp;#39;m using Termite as the terminal. 
 When receiving data from an iPad to the nRF, with the nRF as the peripheral, the nus_data_handler is invoked. I want to print the data received</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Aug 2019 10:02:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50773/turn-off-print-to-terminal-with-nus-data-handler" /><item><title>RE: Turn off print to terminal with NUS data handler</title><link>https://devzone.nordicsemi.com/thread/203021?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 10:02:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:904495ef-066c-4eb9-85ae-2e93172146f9</guid><dc:creator>Marius</dc:creator><description>&lt;p&gt;Thank you. This solved my problem.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Turn off print to terminal with NUS data handler</title><link>https://devzone.nordicsemi.com/thread/202982?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 08:20:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd23bd93-7a94-4ab9-9d03-096f7e50a31d</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;The UART prints whatever it gets, so you just have to convert the ASCII characters to HEX before app_uart_put().&lt;/p&gt;
&lt;p&gt;For example by making a function that converts and calling it before you call app_uart_put:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

//function to convert ascii char[] to hex-string (char[])
void string2hexString(char* input, char* output)
{
    int loop;
    int i; 
    
    i=0;
    loop=0;
    
    while(input[loop] != &amp;#39;\0&amp;#39;)
    {
        sprintf((char*)(output+i),&amp;quot;%02X&amp;quot;, input[loop]);
        loop+=1;
        i+=2;
    }
    //insert NULL at the end of the output string
    output[i++] = &amp;#39;\0&amp;#39;;
}

int main(){
    char ascii_str[] = &amp;quot;Hello world!&amp;quot;;
    //declare output string with double size of input string
    //because each character of input string will be converted
    //in 2 bytes
    int len = strlen(ascii_str);
    char hex_str[(len*2)+1];
    
    //converting ascii string to hex string
    string2hexString(ascii_str, hex_str);
    
    printf(&amp;quot;ascii_str: %s\n&amp;quot;, ascii_str);
    printf(&amp;quot;hex_str: %s\n&amp;quot;, hex_str);
    
    return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>