<?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>Check notification status / toggle notification status Mutilink Central Example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6986/check-notification-status-toggle-notification-status-mutilink-central-example</link><description>Hello, 
 can someone share a piece of code or a hint to the right functions that can enable/disable notifications on all peers? All I want is that the central toggles notifications for all peers on key press. All I&amp;#39;ve got so far is the keypress. 
 As</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 May 2015 06:57:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6986/check-notification-status-toggle-notification-status-mutilink-central-example" /><item><title>RE: Check notification status / toggle notification status Mutilink Central Example</title><link>https://devzone.nordicsemi.com/thread/24639?ContentTypeID=1</link><pubDate>Tue, 19 May 2015 06:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60b1f09e-81cd-4fc6-9d85-3997813ab8d3</guid><dc:creator>muhkuhns</dc:creator><description>&lt;p&gt;It basically works fine as far as I have just tried with one peripheral. But I would like to add a &amp;quot;Notif. enabled/disabled&amp;quot; printf command.. The problem is, that after the printf(Notf disabled) always one more measurement comes in. So I guess I would need to send that message after the notification disabled ack came in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check notification status / toggle notification status Mutilink Central Example</title><link>https://devzone.nordicsemi.com/thread/24638?ContentTypeID=1</link><pubDate>Mon, 18 May 2015 18:32:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0769a4b-c108-47df-8842-4bd0d8c6bf39</guid><dc:creator>Chaiwat Sungkhobol</dc:creator><description>&lt;p&gt;Looks good.
I am not sure about the message that has to be sent out.  check if the data in the buffer to send out is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check notification status / toggle notification status Mutilink Central Example</title><link>https://devzone.nordicsemi.com/thread/24637?ContentTypeID=1</link><pubDate>Sat, 16 May 2015 10:06:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:473bb60d-468e-4658-942f-d251c6fe606f</guid><dc:creator>muhkuhns</dc:creator><description>&lt;p&gt;Thank you very much! This was way more than needed but it will help me a lot! I don&amp;#39;t have my DK at home at the moment so testing will take till Monday. But I am 100% sure that it won&amp;#39;t be a big problem any longer!&lt;/p&gt;
&lt;p&gt;Something like this should do I guess:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void toggle_notif(bool toggle_bool)
{
		client_t *p_client;
		ble_gattc_write_params_t write_params;
    uint8_t                  buf[2];

	for(int i=0; i&amp;lt;m_client_count; i++)
	{
		p_client = &amp;amp;m_client[i];
    p_client-&amp;gt;state = STATE_NOTIF_ENABLE;

    buf[0] = toggle_bool;
    buf[1] = 0;

    write_params.write_op = BLE_GATT_OP_WRITE_REQ;
    write_params.handle   = p_client-&amp;gt;srv_db.services[0].charateristics[p_client-&amp;gt;char_index].cccd_handle;
    write_params.offset   = 0;
    write_params.len      = sizeof(buf);
    write_params.p_value  = buf;

    sd_ble_gattc_write(p_client-&amp;gt;srv_db.conn_handle, &amp;amp;write_params);
	}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I am only wondering about what to do with the clients state..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check notification status / toggle notification status Mutilink Central Example</title><link>https://devzone.nordicsemi.com/thread/24636?ContentTypeID=1</link><pubDate>Sat, 16 May 2015 09:06:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fab6ba51-e3b7-40ba-b363-626957a6f2fa</guid><dc:creator>Chaiwat Sungkhobol</dc:creator><description>&lt;p&gt;What u need to do is create the function that you need to call to disable the notification in the c file and then put the function prototype into the h file. The main.c should already have the h file included already. In your function u would just call it with a void argument since u are going to go through all the connected device.  U might want to have it return the status. Your function will be in the client_handle.c and it should use m_client variable. Since the p_client you are trying to use is not in the scope of your new function you would have to declare it in the new function.
It would be something like.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t client_handle_set_all_notification(bool arg)
{
Uint32_t err_code = NRF _SUCCESS;
  client_t *p_client;
  for(int i =0; i&amp;lt;m_client_count; i++)
  {
If(arg = 0) 
{ 
err_code = notif_disabled(p_client);
}
else
{
err_code = notif_enable(p_client);
}
If(err_code != NRF_Success) break;
}
return err_code;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will have to do your own disabling function. Should be the same as notif_enable but different parameter.
You would be the function prototype in the h file and call the function with argument 0 to turn off notification and other to enable all notification.
I am not at a computer and typing this from my phone.  So might not be correct. But it should be something along this line.
Hope it help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check notification status / toggle notification status Mutilink Central Example</title><link>https://devzone.nordicsemi.com/thread/24635?ContentTypeID=1</link><pubDate>Sat, 16 May 2015 08:24:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbf2832f-15cf-4948-af16-e366120044d4</guid><dc:creator>muhkuhns</dc:creator><description>&lt;p&gt;Thank you very much for your answer! But my main problem is much more basic.&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t figure out how do declare a function in client_handling.c &lt;strong&gt;so that I can call it from main.c&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I somewhat need to declare it in client_handling.h too? But inside this file I get the error &lt;code&gt;client_t unkown type&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;the other way I would need to get &lt;code&gt;p_client&lt;/code&gt; known in main.c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check notification status / toggle notification status Mutilink Central Example</title><link>https://devzone.nordicsemi.com/thread/24634?ContentTypeID=1</link><pubDate>Fri, 15 May 2015 19:29:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:648f371d-3144-4298-9390-a1739b82d464</guid><dc:creator>Chaiwat Sungkhobol</dc:creator><description>&lt;p&gt;It seem you are on the right path.  I have not implement the code but I have briefly looked at it.
This is how i would do it.&lt;/p&gt;
&lt;p&gt;Create a function in client_handling.c to start disabling notification.(client_handling_disable_all_notification())
in that you would run a loop on m_client with max value of m_client_count. And set disable notification function.&lt;/p&gt;
&lt;p&gt;Then you would call the new function when a button is press.&lt;/p&gt;
&lt;p&gt;Hope that help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>