<?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>Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62377/adding-functionality-to-nrf-connect-desktop-bluetooth-low-energy-app</link><description>Hello, 
 Currently I would like to add a functionality to Bluetooth Low Energy App (BLE). I have a bluetooth slave device that require a specific sequence of sending string and receiving notification string to setup. I use a nRF52840 USB Dongle as an</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Jun 2020 02:30:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62377/adding-functionality-to-nrf-connect-desktop-bluetooth-low-energy-app" /><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/256793?ContentTypeID=1</link><pubDate>Thu, 25 Jun 2020 02:30:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1745a831-80f4-486a-8a99-41475927d652</guid><dc:creator>ThienVu</dc:creator><description>&lt;p&gt;Thanks everyone.&lt;/p&gt;
&lt;p&gt;I looked at the writeCharacteristic function and noticed that it already have dispatch() in there, so I&amp;#39;m thinking it is called just like a regular function when needed, and it will dispatch the appropriate action accordingly. I think my problem is maybe I&amp;#39;m using the wrong function to do what I want.&lt;/p&gt;
&lt;p&gt;And regarding states and reducers, for this app, what do I need to keep track of in the state?&lt;/p&gt;
&lt;p&gt;Sorry for asking many questions. There isn&amp;#39;t much documentation for nrf connect apps that I can find.&lt;/p&gt;
&lt;p&gt;This is the writeCharacteristic I&amp;#39;m talking about, located in deviceDetailsActions.js&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;export function writeCharacteristic(characteristic, value) {
    return (dispatch, getState) =&amp;gt; (
        new Promise((resolve, reject) =&amp;gt; {
            const adapterToUse = getState().app.adapter.bleDriver.adapter;

            if (adapterToUse === null) {
                reject(new Error(&amp;#39;No adapter selected&amp;#39;));
                return;
            }

            const ack = !characteristic.properties.writeWoResp;

            adapterToUse.writeCharacteristicValue(characteristic.instanceId, value, ack, error =&amp;gt; {
                if (error) {
                    dispatch(completedWritingAttributeAction(characteristic, null, error));
                    reject(new Error(error.message));
                    return;
                }
                dispatch(completedWritingAttributeAction(characteristic, value));
                resolve();
            });
        }).catch(error =&amp;gt; {
            dispatch(showErrorDialog(error));
        })
    );
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/256792?ContentTypeID=1</link><pubDate>Thu, 25 Jun 2020 02:12:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26649dcf-595e-447d-8671-529fd7d3c2f2</guid><dc:creator>ThienVu</dc:creator><description>&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;I looked at the writeCharacteristic function and noticed that it already have dispatch() in there, so I&amp;#39;m thinking it is called just like a regular function when needed, and it will dispatch the appropriate action accordingly. I think my problem is maybe I&amp;#39;m using the wrong function to do what I want.&lt;/p&gt;
&lt;p&gt;Sorry for asking many questions. There isn&amp;#39;t much documentation for nrf connect apps that I can find.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/256151?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 10:29:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be668110-877c-4dea-bd17-02bd5b51ac58</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Some feedback from our developers:&lt;/p&gt;
&lt;div style="font-family:&amp;#39;Segoe UI&amp;#39;, system-ui, &amp;#39;Apple Color Emoji&amp;#39;, &amp;#39;Segoe UI Emoji&amp;#39;, sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;"&gt;
&lt;div&gt;The correct way to implement the function is to&amp;nbsp;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Write the function, like calling deviceDetailActions and put it in a file&amp;nbsp;in lib/actions&lt;/li&gt;
&lt;li&gt;Create a container under lib/containers which pass the function to the component&lt;/li&gt;
&lt;li&gt;Import the function into the component and use it&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;So it is using React and Redux framework. And in redux you use dispatch() to trigger the actions and change the states. So furthermore, if you need to manage the states, you have to create a file under reducers to manage the state and put it in container so that component can update it whenever the state has been updated.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Br, &lt;br /&gt;Joakim&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/256077?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 02:15:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de23d0cd-9288-4213-9888-276b2b7d9b66</guid><dc:creator>ThienVu</dc:creator><description>&lt;p&gt;Hi.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for helping.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried that, but it didn&amp;#39;t work. The value on the &amp;#39;1234&amp;#39; characteristic of the advertising device didn&amp;#39;t change. I think I need to call this function a very specific way.&lt;/p&gt;
&lt;p&gt;Have anyone modified this app? Any help?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/255943?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2020 10:57:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15fdbffb-58cc-45e4-af1e-35cede6d9aed</guid><dc:creator>Bence</dc:creator><description>&lt;p&gt;In your code &lt;em&gt;onPairDevice&lt;/em&gt; is a property of &lt;em&gt;ConnectedDevice&lt;/em&gt;&amp;nbsp;which must be a function, but you did not provide a function but rather the return value of a function (&lt;em&gt;writeCharacteristic&lt;/em&gt;). Try this way:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;// onPairDevice={writeCharacteristic(&amp;#39;1234&amp;#39;, 0x22)}
onPairDevice={() =&amp;gt; { writeCharacteristic(&amp;#39;1234&amp;#39;, 0x22); }}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/255862?ContentTypeID=1</link><pubDate>Fri, 19 Jun 2020 01:59:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c62cc400-7234-4948-af4c-55100eb2d416</guid><dc:creator>ThienVu</dc:creator><description>&lt;p&gt;Can someone please help? I&amp;#39;m very close now and only need a little push&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/255375?ContentTypeID=1</link><pubDate>Wed, 17 Jun 2020 03:33:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2314d43-bb32-44bf-a364-486bb9b7599c</guid><dc:creator>ThienVu</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve looked at the source code and was able to render a button and assigned a logger.info() in ConnectedDevice Component and DeviceDetails Component.&lt;/p&gt;
&lt;p&gt;I also found the writeCharacteristic(characteristic, value) in deviceDetailActions, that corresponds to my needs. However, how do I call this function the correct way. I tried this in DeviceDetails Component but didn&amp;#39;t work. onPairDevice is the extra function I want. I only post the part that I changed in each Component:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;const DeviceDetailsView = ({
    device,
    [snipped]
    onPairDevice,
})

&amp;lt;ConnectedDevice
                id={`${instanceId}_details`}
                sourceId={`${adapter.instanceId}_details`}
                [snipped]
                onPairDevice={writeCharacteristic(&amp;#39;1234&amp;#39;, 0x22)}
            /&amp;gt;
            
DeviceDetailsView.propTypes = {
    device: PropTypes.object.isRequired,
    [snipped]
    onPairDevice: PropTypes.func.isRequired,
};

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;this is in ConnectedDevice Component:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="javascript"&gt;const ConnectedDevice = ({
    id,
    [snipped]
    onPairDevice,
}) =&amp;gt; {

const onSelect = eventKey =&amp;gt; {
        switch (eventKey) {
            case &amp;#39;Disconnect&amp;#39;:
                onDisconnect();
                break;
            [snipped]
            case &amp;#39;pairDevice&amp;#39;:
                onPairDevice();
                break;
            default:
                console.log(&amp;#39;Unknown eventKey received:&amp;#39;, eventKey);
        }
    };
    
    
    ConnectedDevice.propTypes = {
    id: PropTypes.string.isRequired,
    [snipped]
    onPairDevice: PropTypes.func.isRequired,
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/254833?ContentTypeID=1</link><pubDate>Sat, 13 Jun 2020 14:56:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e45a38a9-814a-42a7-b355-a571798e717d</guid><dc:creator>ThienVu</dc:creator><description>&lt;p&gt;Thanks for the reply.&lt;/p&gt;
&lt;p&gt;I downloaded the BLE source code.&lt;/p&gt;
&lt;p&gt;My question is how do I use the bluetooth library in the BLE app? Where is it in the source code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/254632?ContentTypeID=1</link><pubDate>Fri, 12 Jun 2020 08:59:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c7c33c9-e833-487b-983f-8c3cf13480fd</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Talked to one of our developers;&lt;/p&gt;
&lt;div style="font-family:&amp;#39;Segoe UI&amp;#39;, system-ui, &amp;#39;Apple Color Emoji&amp;#39;, &amp;#39;Segoe UI Emoji&amp;#39;, sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;"&gt;
&lt;div&gt;You can start from here: &lt;br /&gt;&lt;a title="https://nordicsemiconductor.github.io/pc-nrfconnect-docs/" href="https://nordicsemiconductor.github.io/pc-nrfconnect-docs/" rel="noopener noreferrer" target="_blank"&gt;https://nordicsemiconductor.github.io/pc-nrfconnect-docs/&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;And then get the existing BLE app following the example here: &lt;br /&gt;&lt;a title="https://nordicsemiconductor.github.io/pc-nrfconnect-docs/get_an_existing_app_s_sources" href="https://nordicsemiconductor.github.io/pc-nrfconnect-docs/get_an_existing_app_s_sources" rel="noopener noreferrer" target="_blank"&gt;https://nordicsemiconductor.github.io/pc-nrfconnect-docs/get_an_existing_app_s_sources&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;The BLE source is at: &lt;br /&gt;&lt;a title="https://github.com/nordicsemiconductor/pc-nrfconnect-ble" href="https://github.com/NordicSemiconductor/pc-nrfconnect-ble" rel="noopener noreferrer" target="_blank"&gt;https://github.com/NordicSemiconductor/pc-nrfconnect-ble&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Just can just find the place you would like to update and change it.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;If you need more information, let me know and I&amp;#39;ll forward your questions to our developers. &lt;/div&gt;
&lt;div&gt;Br, &lt;br /&gt;Joakim&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding functionality to nRF Connect Desktop Bluetooth Low Energy App</title><link>https://devzone.nordicsemi.com/thread/254583?ContentTypeID=1</link><pubDate>Fri, 12 Jun 2020 04:05:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a6b6a28-74a6-4c96-affe-1a892142a2a4</guid><dc:creator>ThienVu</dc:creator><description>&lt;p&gt;Anyone can help? I really don&amp;#39;t understand the structure of the included library in the BLE App. What library/component do I need to look into to use the Bluetooth driver to do what I need (send/receive notification string)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>