OSDN Git Service

Pull various Inits into parent tBTM_CB::Init structure
authorChris Manton <cmanton@google.com>
Sun, 17 Jan 2021 19:12:08 +0000 (11:12 -0800)
committerChris Manton <cmanton@google.com>
Wed, 20 Jan 2021 07:12:57 +0000 (23:12 -0800)
Towards encapsulation

Bug: 163134718
Tag: #refactor
Test: gd/cert/run

Change-Id: I7be4efb156e1f84904f69b38763f6527e9764f23

stack/btm/btm_int_types.h

index 1528d0e..b380989 100644 (file)
@@ -343,9 +343,24 @@ typedef struct {
     security_mode = initial_security_mode;
     pairing_bda = RawAddress::kAny;
     sec_dev_rec = list_new(osi_free);
+
+    /* Initialize BTM component structures */
+    btm_inq_vars.Init(); /* Inquiry Database and Structures */
+    acl_cb_.Init();      /* ACL Database and Structures */
+    sco_cb.Init();       /* SCO Database and Structures (If included) */
+    devcb.Init();
+
+    history_ = std::make_shared<TimestampedStringCircularBuffer>(40);
+    CHECK(history_ != nullptr);
+    history_->Push(std::string("Initialized btm history"));
   }
 
   void Free() {
+    history_.reset();
+
+    devcb.Free();
+    btm_inq_vars.Free();
+
     fixed_queue_free(page_queue, nullptr);
     page_queue = nullptr;