擅长:python、mysql、java
<p>我使用os.system解决了我的解决方案,并立即停止扫描:</p>
<pre><code>sensortag=0
while sensortag != "B4:99:4C:64:33:E0":
#call the command and write to scan.txt file and then fill the process.
#loop to find if the MAC address given is available
os.system("hcitool lescan> scan.txt & pkill --signal SIGINT hcitool")
scan = open("scan.txt","r")
readscan = scan.read()
if "B4:99:4C:64:33:E0" in readscan:
print "SensorTag found."
sensortag = "B4:99:4C:64:33:E0"
</code></pre>