2015-04-17 51 views

回答

0

找到並使用測試進行驗證。 以下是做到這一點的方法。

ble = bglib.BGLib() 
ser = serial.Serial(port="/dev/ttyACM1", baudrate=115200, timeout=1) 
ble.send_command(ser, ble.ble_cmd_gap_set_mode(0x82, 0x01) 

def handler(sender, earg): 
    print earg['address'] 

ble.ble_rsp_system_address_get += handle 

while (1): 
     # check for all incoming data (no timeout, non-blocking) 
     ble.check_activity(ser) 

     # don't burden the CPU 
     time.sleep(0.01) 

更多信息,可以發現here