<?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>How to printf to BLE Central (iPhone)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84963/how-to-printf-to-ble-central-iphone</link><description>Unfortunately it is only ever explained here how printf is possible via UART. I wonder how printf is possible over BLE. I would like to send messages (strings) with numerical values to a logging app on the phone (and commands from the phone to the BLE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Feb 2022 20:09:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84963/how-to-printf-to-ble-central-iphone" /><item><title>RE: How to printf to BLE Central (iPhone)</title><link>https://devzone.nordicsemi.com/thread/354220?ContentTypeID=1</link><pubDate>Mon, 21 Feb 2022 20:09:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40276c85-c4ff-4fca-91ce-ac9eec127d41</guid><dc:creator>Stefan_B</dc:creator><description>&lt;p&gt;Yes, thank you!&lt;br /&gt;I overlooked that the sprintf function is present. Documentation can also be found on the Segger website: &lt;a href="http://studio.segger.com/index.htm?http://studio.segger.com/stdio_h.htm"&gt;studio.segger.com/index.htm&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to printf to BLE Central (iPhone)</title><link>https://devzone.nordicsemi.com/thread/354138?ContentTypeID=1</link><pubDate>Mon, 21 Feb 2022 12:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85b06ba5-7227-4cec-b206-cda07640c227</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="Stefan_B"]thanks for your response![/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="Stefan_B"]Is there a &lt;strong&gt;sprintf&lt;/strong&gt;?[/quote]
&lt;p&gt;Yes, this is the function you should use for the purpose you describe.&lt;br /&gt;Generate the string using sprintf and transfer it using the NUS service.&lt;/p&gt;
[quote user="Stefan_B"]Where can I find documentation on the supported standard string functions?[/quote]
&lt;p&gt;You read about and see all the standard IO functions in the stdio.h file included in the Segger Embedded Studio files.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to printf to BLE Central (iPhone)</title><link>https://devzone.nordicsemi.com/thread/354100?ContentTypeID=1</link><pubDate>Mon, 21 Feb 2022 10:50:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6353b42-e45b-4006-ba3a-da7be4b69eab</guid><dc:creator>Stefan_B</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;thanks for your response!&lt;/p&gt;
&lt;p&gt;Yes, the nus service does not seem to be a problem. I have already tested that (with App_uart).&lt;/p&gt;
&lt;p&gt;But I would have to recode the printf function. How else should I embed numerical values, e.g. &amp;quot;speed(kmh)=%d&amp;quot; or &amp;quot;battery voltage=%d V&amp;quot; etc.?&lt;/p&gt;
&lt;p&gt;Where can I find documentation on the supported standard string functions? Is there a &lt;strong&gt;sprintf&lt;/strong&gt;?&lt;/p&gt;
&lt;p&gt;Somehow I have to &lt;strong&gt;convert numbers to strings&lt;/strong&gt;. (That&amp;#39;s what I mean by &amp;quot;having to reinvent the wheel&amp;quot;. That would be sad).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to printf to BLE Central (iPhone)</title><link>https://devzone.nordicsemi.com/thread/354068?ContentTypeID=1</link><pubDate>Mon, 21 Feb 2022 09:20:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dbd31b1-71bb-4645-a32c-12a82eca6dd2</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]So how would I use printf to embed the numbers into strings and send them using the nus service? (without having to reinvent the wheel).[/quote]
&lt;p&gt;Could it be an option to just use the BLE NUS service directly, with no use of the printf function?&lt;br /&gt;The printf function are retargetted to the UART using the retarget library, but there is no implementation for it to retarget to the BLE NUS service.&lt;br /&gt;&lt;br /&gt;Are you already familiar with the BLE NUS service and how to use it?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>