• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
17 #define LOG_TAG "classic"
18 
19 #include "classic.h"
20 #include "model/setup/device_boutique.h"
21 #include "osi/include/log.h"
22 
23 using std::vector;
24 
25 namespace test_vendor_lib {
26 
27 bool Classic::registered_ = DeviceBoutique::Register(LOG_TAG, &Classic::Create);
28 
Classic()29 Classic::Classic() {
30   advertising_interval_ms_ = std::chrono::milliseconds(0);
31   properties_.SetClassOfDevice(0x30201);
32 
33   properties_.SetExtendedInquiryData({0x10,                             // Length
34                                       BT_EIR_COMPLETE_LOCAL_NAME_TYPE,  // Type
35                                       'g', 'D', 'e', 'v', 'i', 'c', 'e', '-', 'c', 'l', 'a', 's', 's', 'i', 'c',
36                                       '\0'});  // End of data
37   properties_.SetPageScanRepetitionMode(0);
38   properties_.SetSupportedFeatures(0x87593F9bFE8FFEFF);
39 
40   page_scan_delay_ms_ = std::chrono::milliseconds(600);
41 }
42 
Initialize(const vector<std::string> & args)43 void Classic::Initialize(const vector<std::string>& args) {
44   if (args.size() < 2) return;
45 
46   Address addr;
47   if (Address::FromString(args[1], addr)) properties_.SetAddress(addr);
48 
49   if (args.size() < 3) return;
50 
51   properties_.SetClockOffset(std::stoi(args[2]));
52 }
53 
54 }  // namespace test_vendor_lib
55