import isystem.connect as ic
def main():
winidea_id = ''
connectionMgr = ic.ConnectionMgr()
connectionMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
ideCtrl = ic.CIDEController(connectionMgr)
debugCtrl = ic.CDebugFacade(connectionMgr)
emulatorSerialNumbers = ['#84379']
ideCtrl.setOption('/IOPEN/Communication.Mode', 'TCP')
isConnected = False
for serialNumber in emulatorSerialNumbers:
ideCtrl.setOption('/IOPEN/Communication.IPAddress', serialNumber)
try:
debugCtrl.download()
isConnected = True
print('Found emulator with serial number: ', serialNumber)
break
except OSError:
print('Emulator with serial number ' + serialNumber + ' is not available.')
if isConnected:
print('Connected!')
else:
print('No free emulators found!')
ideCtrl.setOption('/IOPEN/Communication.Mode', 'USB')
if __name__ == "__main__":
main()