Home | History | Annotate | Download | only in src
      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 "osi/include/log.h"
     21 #include "stack/include/hcidefs.h"
     22 
     23 using std::vector;
     24 
     25 namespace test_vendor_lib {
     26 
     27 Classic::Classic() {
     28   advertising_interval_ms_ = std::chrono::milliseconds(0);
     29   device_class_ = 0x30201;
     30 
     31   extended_inquiry_data_ = {0x10,  // Length
     32                             BT_EIR_COMPLETE_LOCAL_NAME_TYPE,
     33                             'g',
     34                             'D',
     35                             'e',
     36                             'v',
     37                             'i',
     38                             'c',
     39                             'e',
     40                             '-',
     41                             'c',
     42                             'l',
     43                             'a',
     44                             's',
     45                             's',
     46                             'i',
     47                             'c'};
     48   page_scan_repetition_mode_ = 0;
     49   page_scan_delay_ms_ = std::chrono::milliseconds(600);
     50 }
     51 
     52 void Classic::Initialize(const vector<std::string>& args) {
     53   if (args.size() < 2) return;
     54 
     55   BtAddress addr;
     56   if (addr.FromString(args[1])) SetBtAddress(addr);
     57 
     58   if (args.size() < 3) return;
     59 
     60   SetClockOffset(std::stoi(args[2]));
     61 }
     62 
     63 }  // namespace test_vendor_lib
     64