<?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>What&amp;#39;s the nRF Connect data format when writing chraracteristics ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112180/what-s-the-nrf-connect-data-format-when-writing-chraracteristics</link><description>Here is a stacktrace from a device I got using the nRF Connect mobile app on Android. 
 nRF Connect, 2024-05-11 Device Name (A4:XX:XX:XX:XX:7C) D 13:40:23.035 [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0) E 13:40:23</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Jul 2024 10:36:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112180/what-s-the-nrf-connect-data-format-when-writing-chraracteristics" /><item><title>RE: What's the nRF Connect data format when writing chraracteristics ?</title><link>https://devzone.nordicsemi.com/thread/491558?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2024 10:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f32877f-f1f3-45a4-aa1d-d6a5b9fd4de5</guid><dc:creator>flexbox</dc:creator><description>&lt;p&gt;Thanks for the&amp;nbsp;explanations Aleksander&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f64c.svg" title="Raised hands"&gt;&amp;#x1f64c;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Following your advice I try to get&amp;nbsp;returned values&amp;nbsp;without any success&lt;/p&gt;
&lt;p&gt;one case is always null&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;&lt;span&gt; const result = await BLEService.writeCharacteristicWithoutResponseForDevice(&lt;br /&gt;   SPP_SERVICE_UUID,&lt;br /&gt;   SPP_CHARACTERISTIC_UUID, // characteristic UUID read and write&lt;br /&gt;   valueToWrite // sends as byte array.&lt;br /&gt; );&lt;br /&gt;&lt;br /&gt; // Result is always null&lt;br /&gt; // {&lt;br /&gt; //   deviceID: &amp;quot;71511EB2-XXXX-XXXX-XXXX-77B2FAC78495&amp;quot;&lt;br /&gt; //   id: 12928767904&lt;br /&gt; //   isIndicatable: false&lt;br /&gt; //   isNotifiable: false&lt;br /&gt; //   isNotifying: false&lt;br /&gt; //   isReadable: true&lt;br /&gt; //   isWritableWithResponse: false&lt;br /&gt; //   isWritableWithoutResponse: true&lt;br /&gt; //   serviceID: 12909164416&lt;br /&gt; //   serviceUUID: &amp;quot;0c6b000a-2f43-7eb4-0646-e5c28162cf6c&amp;quot;&lt;br /&gt; //   uuid: &amp;quot;0c6b000c-2f43-7eb4-0646-e5c28162cf6c&amp;quot;&lt;br /&gt; //   value: null&lt;br /&gt;&lt;/span&gt; //  }&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;the other one is an error&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;&lt;span&gt; const result = await BLEService.writeCharacteristicWithResponseForDevice(&lt;br /&gt;   SPP_SERVICE_UUID,&lt;br /&gt;   SPP_CHARACTERISTIC_UUID, // characteristic UUID read and write&lt;br /&gt;  valueToWrite // sends as byte array.&lt;br /&gt; );&lt;br /&gt; // return an error&lt;br /&gt;&amp;nbsp;//&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/274c.svg" title="X"&gt;&amp;#x274c;&lt;/span&gt;&amp;nbsp;~ showErrorToast: {&lt;br /&gt; //   &amp;quot;message&amp;quot;: &amp;quot;Characteristic 0c6b000c-2f43-7eb4-0646-e5c28162cf6c write failed for device 71511EB2-D2BC-D5F8-4DF7-77B2FAC78495 and service 0c6b000a-2f43-7eb4-0646-e5c28162cf6c&amp;quot;,&lt;br /&gt; //   &amp;quot;errorCode&amp;quot;: 401,&lt;br /&gt; //   &amp;quot;attErrorCode&amp;quot;: 3,&lt;br /&gt; //   &amp;quot;iosErrorCode&amp;quot;: null,&lt;br /&gt; //   &amp;quot;androidErrorCode&amp;quot;: null,&lt;br /&gt; //   &amp;quot;reason&amp;quot;: &amp;quot;Writing is not permitted.&amp;quot;,&lt;br /&gt; //   &amp;quot;name&amp;quot;: &amp;quot;BleError&amp;quot;&lt;br /&gt; // }&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit:&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;I finally found how to get data from the device!&lt;br /&gt;On my case, I need to&amp;nbsp;&lt;a href="https://github.com/dotintent/react-native-ble-plx/wiki/Characteristic-Notifying"&gt;setup a monitor&lt;/a&gt; &lt;strong&gt;on another characteristics.&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;1. send data to characteristicA&lt;br /&gt;2. get result from&amp;nbsp;&lt;span&gt;characteristicB&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;pre&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What's the nRF Connect data format when writing chraracteristics ?</title><link>https://devzone.nordicsemi.com/thread/489914?ContentTypeID=1</link><pubDate>Fri, 21 Jun 2024 10:07:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36a50824-c9e8-4f73-b32d-c2c21800b8f4</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;that &amp;quot;0x&amp;quot; indicates, that following data are shown in hex. You just need to send an array of bytes with values: 0x30, 0x05, 0x51, etc. and you&amp;#39;ll get an array as return. Don&amp;#39;t send them as string, but as byte array.&lt;/p&gt;
&lt;p&gt;A byte value can be displayed in multiple formats, for example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;64 (decimal)&lt;/li&gt;
&lt;li&gt;0x41 (hex)&lt;/li&gt;
&lt;li&gt;0101 (octal)&amp;nbsp;&lt;/li&gt;
&lt;li&gt;0b01000001 (binary)&lt;/li&gt;
&lt;li&gt;&amp;#39;A&amp;#39; (character)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Assuming you&amp;#39;re using&amp;nbsp;&lt;a href="https://github.com/dotintent/react-native-ble-plx/wiki/=--FAQ:-Passing-And-Retrieving-Of-Characteristic-Value"&gt;= FAQ: Passing And Retrieving Of Characteristic Value &amp;middot; dotintent/react-native-ble-plx Wiki (github.com)&lt;/a&gt;&amp;nbsp;you need to Base64 the byte array.&lt;/p&gt;
&lt;p&gt;By using&amp;nbsp;&lt;a href="https://base64.guru/converter/encode/hex"&gt;Hex to Base64 | Base64 Encode | Base64 Converter | Base64&lt;/a&gt;&amp;nbsp;and putting the above hex, we get:&amp;nbsp;MAVRdRRennI=&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What's the nRF Connect data format when writing chraracteristics ?</title><link>https://devzone.nordicsemi.com/thread/489539?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2024 13:24:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90c55caa-c564-4d97-b567-6ad0a45b78bf</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hi David,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll get back to you on this tomorrow.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>