from ctypes import *
from secg40 import *
import sys
import time

device = SECG40(get_lib_path())


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


connectedCb = ConnectedCallback(DeviceConnectedHandler)
if not device.init(connectedCb):
    print('Error: init failed')
    sys.exit()


pause()
device.close()
