from ctypes import *
from wecg400 import *
import sys
import time

device = WECG400(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.free()
