from ctypes import *
from secg40 import *

device1 = SECG40(get_lib_path())
device2 = SECG40("./SECG40x64.2.dll") # duplicate the lib file to control another WhaleTeq device

def Device1ConnectedHandler(connected):
    if connected:
        print('device1 is connected ({})'.format(device1.get_serial_number()))
    else:
        print('device1 is disconnected')

def Device2ConnectedHandler(connected):
    if connected:
        print('device2 is connected ({})'.format(device2.get_serial_number()))
    else:
        print('device2 is disconnected')

connectedCb1 = ConnectedCallback(Device1ConnectedHandler)
connectedCb2 = ConnectedCallback(Device2ConnectedHandler)

device1.init(connectedCb1)
device2.init(connectedCb2)

input("Press Enter to exit...")

device1.close()
device2.close()