<!-- iframe showing the search results (closed by default) -->
<divid="MSearchResultsWindow">
<iframesrc="javascript:void(0)"frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<divclass="PageDoc"><divclass="header">
<divclass="headertitle">
<divclass="title">Improvements and updates </div></div>
</div><!--header-->
<divclass="contents">
<divclass="textblock"><p>Many improvements have been made to this library vs the original, this is a brief overview of the most significant changes. <br/>
Refer to the <ahref="https://h2zero.github.io/esp-nimble-cpp/annotated.html">class documentation</a> for futher information on class specifics. <br/>
<p><code><aclass="el"href="class_nim_b_l_e_characteristic.html#aba05898f446e31222fbe509fa357c730"title="Convenience template to set the characteristic value to <type>val.">NimBLECharacteristic::setValue(const T &s)</a></code><br/>
<code><aclass="el"href="class_nim_b_l_e_descriptor.html#a9136cc9e4b41110b3dd99d1c9553a477"title="Convenience template to set the descriptor value to <type>val.">NimBLEDescriptor::setValue(const T &s)</a></code><br/>
</p>
<p>Now use a template to accomodate standard and custom types/values. <br/>
</div><!-- fragment --><p> This will send the struct to the recieving client when read or a notification sent. <br/>
</p>
<p><code><aclass="el"href="class_nim_b_l_e_characteristic.html#a37e908d114f6ad2b4bf19c7cc4db9c54"title="Retrieve the current value of the characteristic.">NimBLECharacteristic::getValue</a></code> now takes an optional timestamp parameter which will update it's value with <br/>
the time the last value was recieved. In addition an overloaded template has been added to retrieve the value <br/>
<p><b>Advertising will automatically start when a client disconnects.</b><br/>
</p>
<p>A new method <code><aclass="el"href="class_nim_b_l_e_server.html#a6bfd923ecd0ea06d5564343ab7209122"title="Set the server to automatically start advertising when a client disconnects.">NimBLEServer::advertiseOnDisconnect(bool)</a></code> has been implemented to control this, true(default) = enabled. <br/>
<br/>
</p>
<p><code><aclass="el"href="class_nim_b_l_e_server.html#a00c92f62f41ec1c499dfaf042b487d75"title="Remove a service from the server.">NimBLEServer::removeService</a></code> takes an additional parameter <code>bool deleteSvc</code> that if true will delete the service <br/>
and all characteristics / descriptors belonging to it and invalidating any pointers to them. <br/>
</p>
<p>If false the service is only removed from visibility by clients. The pointers to the service and <br/>
it's characteristics / descriptors will remain valid and the service can be re-added in the future <br/>
using <code><aclass="el"href="class_nim_b_l_e_server.html#a6eda4c9e0ac1dd031c678d4bf7da1d56"title="Adds a service which was either already created but removed from availability, or created and later a...">NimBLEServer::addService</a></code>. <br/>
<p>Now takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a callback <br/>
that is invoked when advertsing ends and takes a pointer to a <code><aclass="el"href="class_nim_b_l_e_advertising.html"title="Perform and manage BLE advertising.">NimBLEAdvertising</a></code> object (similar to the <code><aclass="el"href="class_nim_b_l_e_scan.html#a21b1e27816717b77533755f31dfaa820"title="Start scanning.">NimBLEScan::start</a></code> API). <br/>
</p>
<p>This provides an opportunity to update the advertisment data if desired. <br/>
</p>
<p>Also now returns a bool value to indicate if advertising successfully started or not. <br/>
<p><code><aclass="el"href="class_nim_b_l_e_remote_characteristic.html#a7e10fa37095d7c80dc36c768fe783e67"title="Read the value of the remote characteristic.">NimBLERemoteCharacteristic::readValue</a>(time_t\*, bool)</code><br/>
<code><aclass="el"href="class_nim_b_l_e_remote_descriptor.html#ac4e3a21818903b69ace41c36a58d3c46"title="A template to convert the remote descriptor data to <type>.">NimBLERemoteDescriptor::readValue(bool)</a></code><br/>
</p>
<p>Have been added as templates to allow reading the values as any specified type. <br/>
<p><code><aclass="el"href="class_nim_b_l_e_remote_characteristic.html#ab4f54eabe90a416546b7b3fc3477f49c"title="backward-compatibility method for subscribe/unsubscribe notifications/indications">NimBLERemoteCharacteristic::registerForNotify</a></code><br/>
Has been <b>deprecated</b> as now the internally stored characteristic value is updated when notification/indication is recieved. <br/>
</p>
<p><code><aclass="el"href="class_nim_b_l_e_remote_characteristic.html#aa08b2f62376568e1fc833e4ff91e8aa7"title="Subscribe for notifications or indications.">NimBLERemoteCharacteristic::subscribe</a></code> and <code><aclass="el"href="class_nim_b_l_e_remote_characteristic.html#a6e331afdbdbc32bf461c9866236a97aa"title="Unsubscribe for notifications or indications.">NimBLERemoteCharacteristic::unsubscribe</a></code> have been implemented to replace it. <br/>
A callback is no longer requred to get the most recent value unless timing is important. Instead, the application can call <code><aclass="el"href="class_nim_b_l_e_remote_characteristic.html#add1a1daed14b5f3e729e284dbd369257"title="Get the value of the remote characteristic.">NimBLERemoteCharacteristic::getValue</a></code> to <br/>
get the last updated value any time. <br/>
<br/>
<br/>
</p>
<p>The <code>notifiy_callback</code> function is now defined as a <code>std::function</code> to take advantage of using <code>std::bind</code> to specifiy a class member function for the callback. <br/>
</div><!-- fragment --><p><code><aclass="el"href="class_nim_b_l_e_remote_characteristic.html#a7e10fa37095d7c80dc36c768fe783e67"title="Read the value of the remote characteristic.">NimBLERemoteCharacteristic::readValue</a></code> and <code><aclass="el"href="class_nim_b_l_e_remote_characteristic.html#add1a1daed14b5f3e729e284dbd369257"title="Get the value of the remote characteristic.">NimBLERemoteCharacteristic::getValue</a></code> take an optional timestamp parameter which will update it's value with <br/>
the time the last value was recieved. <br/>
</p>
<blockquoteclass="doxtable">
<p><aclass="el"href="class_nim_b_l_e_client.html#ae22379ab10bd82932d2303fb3753c366"title="Get the service BLE Remote Service instance corresponding to the uuid.">NimBLEClient::getService</a><br/>
<aclass="el"href="class_nim_b_l_e_remote_service.html#ab12d195a2239a3808d60457184f0c487"title="Get the remote characteristic object for the characteristic UUID.">NimBLERemoteService::getCharacteristic</a><br/>
<aclass="el"href="class_nim_b_l_e_remote_characteristic.html#a6178e1c58361b957be3c48548c1c4366"title="Get the descriptor instance with the given UUID that belongs to this characteristic.">NimBLERemoteCharacteristic::getDescriptor</a><br/>
</p>
</blockquote>
<p>These methods will now check the respective vectors for the attribute object and, if not found, will retrieve (only) <br/>
the specified attribute from the peripheral. <br/>
</p>
<p>These changes allow more control for the user to manage the resources used for the attributes. <br/>
<br/>
</p>
<p><code><aclass="el"href="class_nim_b_l_e_client.html#aab311f0a8af21fb63f78e7fbac29951a"title="Connect to an advertising device.">NimBLEClient::connect()</a></code> can now be called without an address or advertised device parameter. This will connect to the <br/>
device with the address previously set when last connected or set with <code>NimBLEDevice::setPeerAddress()</code>.</p>
<p>To reduce resource use all instances of <code>std::map</code> have been replaced with <code>std::vector</code>. <br/>
</p>
<p>Use of <code>FreeRTOS::Semaphore</code> has been removed as it was consuming too much ram, the related files have been left in place to accomodate application use. <br/>
</p>
<p>Operators <code>==</code>, <code>!=</code> and <code>std::string</code> have been added to <code><aclass="el"href="class_nim_b_l_e_address.html"title="A BLE device address.">NimBLEAddress</a></code> and <code><aclass="el"href="class_nim_b_l_e_u_u_i_d.html"title="A model of a BLE UUID.">NimBLEUUID</a></code> for easier comparison and logging. <br/>
</p>
<p>New constructor for <code><aclass="el"href="class_nim_b_l_e_u_u_i_d.html"title="A model of a BLE UUID.">NimBLEUUID(uint32_t, uint16_t, uint16_t, uint64_t)</a></code> added to lower memory use vs string construction. See: <ahref="https://github.com/h2zero/NimBLE-Arduino/pull/21">#21</a>. <br/>
</p>
<p>Security/pairing operations are now handled in the respective <code><aclass="el"href="class_nim_b_l_e_client_callbacks.html"title="Callbacks associated with a BLE client.">NimBLEClientCallbacks</a></code> and <code><aclass="el"href="class_nim_b_l_e_server_callbacks.html"title="Callbacks associated with the operation of a BLE server.">NimBLEServerCallbacks</a></code> classes, <code><aclass="el"href="class_nim_b_l_e_security.html"title="A class to handle BLE security operations. Deprecated - provided for backward compatibility only.">NimBLESecurity</a></code>(deprecated) remains for backward compatibility. <br/>
</p>
<p>Configuration options have been added to add or remove debugging information, when disabled (default) significatly reduces binary size. <br/>
In ESP-IDF the options are in menuconfig: <code>Main menu -> ESP-NimBLE-cpp configuration</code>. <br/>
For Arduino the options must be commented / uncommented in <aclass="el"href="nimconfig_8h.html">nimconfig.h</a>. <br/>
<br/>
<br/>
</p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.9.1 </li>