1#!/usr/bin/env python3 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 17import logging 18 19from subprocess import call 20import time 21 22log = logging 23 24 25def setup_native_bluetooth(native_devices): 26 for n in native_devices: 27 droid = n.droid 28 pid = n.adb.shell("pidof -s bluetoothtbd") 29 if not pid: 30 call( 31 ["adb -s " + n.serial + " shell sh -c \"bluetoothtbd\" &"], 32 shell=True) 33 droid.BtBinderInitInterface() 34 time.sleep(5) #temporary sleep statement 35 droid.BtBinderEnable() 36 time.sleep(5) #temporary sleep statement 37 droid.BtBinderRegisterBLE() 38 time.sleep(5) #temporary sleep statement 39