This commit clears_id->gatt_h and _id->callback names mappings from
BluetoothGATTServerService when the server is stopped.
[Verification] This change is tested together with the commit
implementing reregistration of read/write callbacks and works fine.
Change-Id: I4c16674f4856bb1fa74f4db74b6bbe9119f3b29f
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
return PlatformResult{ErrorCode::INVALID_STATE_ERR};
}
+ service_.ClearGATTData();
+
auto ret = bt_gatt_server_unregister_all_services(handle_);
if (BT_ERROR_NONE != ret) {
LoggerE("bt_gatt_server_unregister_all_services(): %d (%s)", ret, get_error_message(ret));
return common::PlatformResult{};
}
+void BluetoothGATTServerService::ClearGATTData() {
+ ScopeLogger();
+
+ LoggerD("Removing %zu old GATT handles and %zu callback names",
+ gatt_objects_.size(), callback_names_.size());
+ gatt_objects_.clear();
+ callback_names_.clear();
+}
+
} // namespace bluetooth
} // namespace extension
PlatformResult SetWriteValueRequestCallback(const picojson::value& args);
PlatformResult SendResponse(const picojson::value& args);
PlatformResult NotifyAboutValueChange(const picojson::value& args);
+ void ClearGATTData();
private:
BluetoothInstance& instance_;