Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
devMgr.Close()
devMgr.CloseEndpoints()
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
exit()
print ''
print '#################################rendezvous2#################################'
try:
devMgr.RendezvousDevice(
pairingCode=options.pairingCode,
targetFabricId=WeaveDeviceMgr.TargetFabricId_AnyFabric,
targetModes=WeaveDeviceMgr.TargetDeviceMode_Any,
targetVendorId=WeaveDeviceMgr.TargetVendorId_Any,
targetProductId=WeaveDeviceMgr.TargetProductId_Any,
targetDeviceId=WeaveDeviceMgr.TargetDeviceId_Any)
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
exit()
print "Connected to device %X at %s" % (nodeId, addr)
print ''
print '#################################close#################################'
try:
devMgr.Close()
devMgr.CloseEndpoints()
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
try:
devMgr.SetConnectTimeout(timeoutMS)
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
exit()
print "Done."
print ''
print '#################################rendezvous1#################################'
try:
devMgr.RendezvousDevice(
accessToken=options.accessToken,
targetFabricId=WeaveDeviceMgr.TargetFabricId_AnyFabric,
targetModes=WeaveDeviceMgr.TargetDeviceMode_Any,
targetVendorId=WeaveDeviceMgr.TargetVendorId_Any,
targetProductId=WeaveDeviceMgr.TargetProductId_Any,
targetDeviceId=WeaveDeviceMgr.TargetDeviceId_Any)
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
exit()
print "Connected to device %X at %s" % (nodeId, addr)
print ''
print '#################################close#################################'
try:
devMgr.Close()
devMgr.CloseEndpoints()
except WeaveDeviceMgr.DeviceManagerException, ex:
print str(ex)
--target-device
Specifies that only the device with the given Weave node id should respond.
A value of 0xFFFFFFFFFFFFFFFF (the default) specifies that all devices should
respond.
"""
args = shlex.split(line)
optParser = OptionParser(usage=optparse.SUPPRESS_USAGE, option_class=ExtendedOption)
optParser.add_option("-p", "--pairing-code", action="store", dest="pairingCode", type="string")
optParser.add_option("-a", "--access-token", action="store", dest="accessToken", type="base64")
optParser.add_option("-d", "--use-dummy-access-token", action="store_true", dest="useDummyAccessToken")
optParser.add_option("", "--target-fabric", action="store", dest="targetFabricId", type="hexint", default=WeaveDeviceMgr.TargetFabricId_AnyFabric)
optParser.add_option("", "--target-modes", action="store", dest="targetModes", type="hexint", default=WeaveDeviceMgr.TargetDeviceMode_Any)
optParser.add_option("", "--target-vendor", action="store", dest="targetVendorId", type="hexint", default=WeaveDeviceMgr.TargetVendorId_Any)
optParser.add_option("", "--target-product", action="store", dest="targetProductId", type="hexint", default=WeaveDeviceMgr.TargetProductId_Any)
optParser.add_option("", "--target-device", action="store", dest="targetDeviceId", type="hexint", default=WeaveDeviceMgr.TargetDeviceId_Any)
try:
(options, remainingArgs) = optParser.parse_args(args)
except SystemExit:
return
if (len(remainingArgs) > 1):
print "Unexpected argument: " + remainingArgs[1]
return
if (len(remainingArgs) == 1):
options.pairingCode = remainingArgs[0]
if (options.useDummyAccessToken and not options.accessToken):
options.accessToken = base64.standard_b64decode(dummyAccessToken)