system/bt
Révision | 0dc155f78d23cdc7ffa38f6121ccd4c56d1e1056 (tree) |
---|---|
l'heure | 2019-06-28 05:53:01 |
Auteur | Myles Watson <mylesgw@goog...> |
Commiter | android-build-merger |
DO NOT MERGE RootCanal: Always add default devices
am: 6160b51adc
Change-Id: I11a3328b78eb69c85ab98038aa2558c442d659cb
@@ -120,6 +120,11 @@ Return<void> BluetoothHci::initialize(const sp<IBluetoothHciCallbacks>& cb) { | ||
120 | 120 | // Add the controller as a device in the model. |
121 | 121 | test_model_.Add(controller_); |
122 | 122 | |
123 | + // Send responses to logcat if the test channel is not configured. | |
124 | + test_channel_.RegisterSendResponse([](const std::string& response) { | |
125 | + ALOGI("No test channel yet: %s", response.c_str()); | |
126 | + }); | |
127 | + | |
123 | 128 | if (BtTestConsoleEnabled()) { |
124 | 129 | SetUpTestChannel(6111); |
125 | 130 | SetUpHciServer(6211, |
@@ -128,6 +133,16 @@ Return<void> BluetoothHci::initialize(const sp<IBluetoothHciCallbacks>& cb) { | ||
128 | 133 | 6311, [this](int fd) { test_model_.IncomingLinkLayerConnection(fd); }); |
129 | 134 | } |
130 | 135 | |
136 | + // Add some default devices for easier debugging | |
137 | + test_channel_.AddDefaults(); | |
138 | + | |
139 | + // This should be configurable in the future. | |
140 | + ALOGI("Adding Beacons so the scan list is not empty."); | |
141 | + test_channel_.Add({"beacon", "be:ac:10:00:00:01", "1000"}); | |
142 | + test_channel_.AddDeviceToPhy({"1", "0"}); | |
143 | + test_channel_.Add({"beacon", "be:ac:10:00:00:02", "1000"}); | |
144 | + test_channel_.AddDeviceToPhy({"2", "0"}); | |
145 | + | |
131 | 146 | unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) { |
132 | 147 | if (death_recipient->getHasDied()) |
133 | 148 | ALOGI("Skipping unlink call, service died."); |
@@ -261,16 +276,6 @@ void BluetoothHci::SetUpTestChannel(int port) { | ||
261 | 276 | test_channel_.RegisterSendResponse( |
262 | 277 | [](const std::string& response) { ALOGI("No test channel: %s", response.c_str()); }); |
263 | 278 | |
264 | - // Add some default devices for easier debugging | |
265 | - test_channel_.AddDefaults(); | |
266 | - | |
267 | - // This should be configurable in the future. | |
268 | - ALOGI("Adding Beacons so the scan list is not empty."); | |
269 | - test_channel_.Add({"beacon", "be:ac:10:00:00:01", "1000"}); | |
270 | - test_channel_.AddDeviceToPhy({"1", "0"}); | |
271 | - test_channel_.Add({"beacon", "be:ac:10:00:00:02", "1000"}); | |
272 | - test_channel_.AddDeviceToPhy({"2", "0"}); | |
273 | - | |
274 | 279 | if (socket_fd == -1) { |
275 | 280 | ALOGE("Test channel SetUp(%d) failed.", port); |
276 | 281 | return; |