Пример #1
0
def main():
	createDB()

	try:
		manager = Manager()
	except RuntimeError as e:
		print("RuntimeException: %s" % e.details)
		print("Exiting...")
		exit(1)

	try:
		manager.setOnAttachHandler(managerDeviceAttached)
		manager.setOnDetachHandler(managerDeviceDetached)
		manager.setOnErrorHandler(managerErrorHandler)
		manager.setOnServerConnectHandler(managerServerConnect)
		manager.setOnServerDisconnectHandler(managerServerDisconnect)
		manager.openManager()

	except PhidgetException as e:
		print("Phidget Exception %i: %s" % (e.code, e.details))
		print("Exiting...")
		exit(1)
	try:
		manager.openManager()
	except PhidgetException as e:
		print("Phidget Exception %i: %s" % (e.code, e.details))
		print("Exiting...")
		exit(1)

	print("Press Enter to quit...")
	chr = sys.stdin.read(1)
	print("Closing...")

	try:
		manager.closeManager()
	except PhidgetException as e:
		print("Phidget Exception %i: %s" % (e.code, e.details))
		print("Exiting...")
		exit(1)
	print("Done.")
	exit(0)
Пример #2
0
        print('   - Disconnecting inter | ' + str(serial))
        global interC
        interC.closePhidget()

def ConnectHandler(e):
    print('[C+] Connected to Server!')
def DisconnectHandler(e):
    print('[C-] Disconnected from Server')

manager = Manager()

manager.setOnAttachHandler(AttachHandler)
manager.setOnDetachHandler(DetachHandler)

manager.setOnServerConnectHandler(ConnectHandler)
manager.setOnServerDisconnectHandler(DisconnectHandler)

manager.openRemoteIP(config.SBCIP, 5001)

print("phidAPI @ :"+str(config.myPort))
try:
    s = zerorpc.Server(rpc())
    s.bind("tcp://" + str(config.myIP) + ":" + str(config.myPort))
    s.run()

except KeyboardInterrupt:
    print(" KeyboardInterrupt")

print("Shutting down...")
manager.closeManager()
exit(0)
Пример #3
0
def ConnectHandler(e):
    print('[C+] Connected to Server!')


def DisconnectHandler(e):
    print('[C-] Disconnected from Server')


manager = Manager()

manager.setOnAttachHandler(AttachHandler)
manager.setOnDetachHandler(DetachHandler)

manager.setOnServerConnectHandler(ConnectHandler)
manager.setOnServerDisconnectHandler(DisconnectHandler)

manager.openRemoteIP(config.SBCIP, 5001)

print("phidAPI @ :" + str(config.myPort))
try:
    s = zerorpc.Server(rpc())
    s.bind("tcp://" + str(config.myIP) + ":" + str(config.myPort))
    s.run()

except KeyboardInterrupt:
    print(" KeyboardInterrupt")

print("Shutting down...")
manager.closeManager()
exit(0)