Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bleManager = BleManager(devMgr)
try:
bleManager.ble_adapter_select(identifier=options.bleSrcAddr)
except WeaveDeviceMgr.DeviceManagerException, ex:
print ex
exit()
try:
line = ' ' + str(options.bleDstAddr)
bleManager.scan_connect(line)
except WeaveDeviceMgr.DeviceManagerException, ex:
print ex
exit()
devMgr.ConnectBle(bleConnection=FAKE_CONN_OBJ_VALUE,
pairingCode=options.pairingCode,
accessToken=options.accessToken)
try:
devMgr.Close()
devMgr.CloseEndpoints()
bleManager.disconnect()
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
exit()
print "WoBLE central is good to go"
print "Shutdown complete"
exit()
else:
devMgr.ConnectDevice(deviceId=nodeId, deviceAddr=addr,
remainingArgs.pop(0)
if (len(remainingArgs)):
nodeId = int(remainingArgs[0], 16)
remainingArgs.pop(0)
else:
nodeId = 1
if (options.useDummyAccessToken and not options.accessToken):
options.accessToken = base64.standard_b64decode(dummyAccessToken)
if (options.pairingCode and options.accessToken):
print "Cannot specify both pairing code and access token"
return
try:
if options.useBle:
self.devMgr.ConnectBle(bleConnection=FAKE_CONN_OBJ_VALUE,
pairingCode=options.pairingCode,
accessToken=options.accessToken)
else:
self.devMgr.ConnectDevice(deviceId=nodeId, deviceAddr=addr,
pairingCode=options.pairingCode,
accessToken=options.accessToken)
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
return
print "Connected to device."
def do_blediagtest(self, line):
return
if options.local:
local = 1
else:
local = 0
if not self.bleMgr:
self.bleMgr = BleManager(self.devMgr)
if not self.bleMgr.isConnected():
print "BLE not connected"
return
try:
self.devMgr.TestResultBle(FAKE_CONN_OBJ_VALUE, local)
except WoBleTestMgr.DeviceManagerException, ex:
print str(ex)
return