2 * Copyright 2016 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define LOG_TAG "keyboard"
23 namespace test_vendor_lib {
24 Keyboard::Keyboard() {
25 advertising_type_ = BTM_BLE_CONNECT_EVT;
26 adv_data_ = {0x11, // Length
27 BTM_BLE_AD_TYPE_NAME_CMPL,
54 BTM_BLE_BREDR_NOT_SPT | BTM_BLE_GEN_DISC_FLAG};
56 scan_data_ = {0x04, // Length
57 BTM_BLE_AD_TYPE_NAME_SHORT, 'k', 'e', 'y'};
60 std::string Keyboard::GetTypeString() const { return "keyboard"; }
62 void Keyboard::Initialize(const vector<std::string>& args) {
63 if (args.size() < 2) return;
66 if (addr.FromString(args[1])) SetBtAddress(addr);
68 if (args.size() < 3) return;
70 SetAdvertisementInterval(std::chrono::milliseconds(std::stoi(args[2])));
73 bool Keyboard::LeConnect() { return true; }
75 bool Keyboard::IsPageScanAvailable() const { return false; }
76 } // namespace test_vendor_lib