* Added new function API to hci_layer: hci_layer_cleanup_interface()
It can be used to cleanup after hci_layer_get_interface()
or hci_layer_get_test_interface()
* Fixed the unit tests inside HciLayerTest by removing usage of
allocation_tracker_reset() and adding hci_layer_cleanup_interface() .
The former was used as a hack to bypass the internal memory allocation
of hci_layer_get_test_interface(). The latter is used to properly
cleanup such allocation.
Bug:
26014740
Change-Id: I498b996a931c59dd3b4258f1a5741cfa6d302e42
const packet_fragmenter_t *packet_fragmenter_interface,
const vendor_t *vendor_interface,
const low_power_manager_t *low_power_manager_interface);
+
+void hci_layer_cleanup_interface();
}
}
+void hci_layer_cleanup_interface() {
+ if (interface_created) {
+ interface.send_low_power_command = NULL;
+ interface.do_postload = NULL;
+
+ data_dispatcher_free(interface.event_dispatcher);
+
+ interface.set_data_queue = NULL;
+ interface.transmit_command = NULL;
+ interface.transmit_command_futured = NULL;
+ interface.transmit_downward = NULL;
+ interface_created = false;
+ }
+}
+
static const hci_hal_callbacks_t hal_callbacks = {
hal_says_data_ready
};
protected:
virtual void SetUp() {
AlarmTestHarness::SetUp();
+ module_management_start();
hci = hci_layer_get_test_interface(
&buffer_allocator,
&low_power_manager
);
- // Make sure the data dispatcher allocation isn't tracked
- allocation_tracker_reset();
- module_management_start();
-
packet_index = 0;
data_size_sum = 0;
EXPECT_CALL_COUNT(vendor_close, 1);
semaphore_free(done);
+ hci_layer_cleanup_interface();
module_management_stop();
AlarmTestHarness::TearDown();
}