1#/usr/bin/env python3.4 2# 3# Copyright (C) 2016 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); you may not 6# use this file except in compliance with the License. You may obtain a copy of 7# the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14# License for the specific language governing permissions and limitations under 15# the License. 16 17from acts.logger import LoggerProxy 18from subprocess import call 19import time 20 21log = LoggerProxy() 22 23def setup_native_bluetooth(native_devices): 24 for n in native_devices: 25 droid = n.droid 26 pid = n.adb.shell("ps | grep bluetoothtbd | awk '{print $2}'").decode( 27 'ascii') 28 if not pid: 29 call( 30 ["adb -s " + n.serial + " shell sh -c \"bluetoothtbd\" &"], 31 shell=True) 32 droid.BluetoothBinderInitInterface() 33 time.sleep(5) #temporary sleep statement 34 droid.BluetoothBinderEnable() 35 time.sleep(5) #temporary sleep statement 36 droid.BluetoothBinderRegisterBLE() 37 time.sleep(5) #temporary sleep statement 38 39