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

hw_info = HW_INFORMATION()

device = WECG400(get_lib_path())
if device.connect(-1, 5000) == False:
    print('Error: device is not connected')
    device.free()
    sys.exit()

    
version = device.get_version()
print('SDK Version: {:d}.{:d}.{:d}.{:d}'.format ((version>>24)&0xff, (version>>16)&0xff, (version>>8)&0xff, version&0xff))
print('Serial Number: ', device.get_serial_number())

device.get_hw_information(pointer(hw_info))
print('FW Ver.: {:d}.{:d}.{:d}'.format(
    hw_info.FWMajorVersion, hw_info.FWMinorVersion, hw_info.FWBuildVersion))

print('HW Ver.: {:d}.{:d}'.format(
    hw_info.HWMajorVersion, hw_info.HWMinorVersion))


device.free ()
