import pysfm import io import time print pysfm.__version__ module = pysfm.Module("COM6") if module.connect() == False: exit(-100) print ('Start >>') f = open('template.dat', 'rb') data = f.read() data_list = [] for x in data: data_list.append(ord(x)) f.close() user_id = 123456 # Enroll by template module.send_command(command=pysfm.UF_COM_ET, param=user_id, size=384, flag=0x79) module.send_data(data) module.send_end_packet() module.read_response_command(1) # If Scan success option in system parameter is enabled, module.read_response_command(1)
import pysfm import wtd # form: wtd.test(module, OperTime, command, param, size, flag, i, timetest) import time from pprint import pprint print pysfm.__version__ module = pysfm.Module("COM5", 115200) if module.connect() == False: exit(-100) wtd.test(module, 30, 0x03, 0, 0, 0x62) OperTime = module.response_command.size + 50 print('Start >> ' '%X' % OperTime) OperTime = OperTime - 0x30 print('Operation Timeout = ' '%d' % OperTime) i = 0 while i < 10: wtd.test(module, OperTime, 0x05, 1, 0, 0x79) # AutoID i = i + 1 i = 0 while i < 10: wtd.test(module, OperTime, 0x05, i + 1, 0, 0x71) # AddNew i = i + 1 i = 0 while i < 10: wtd.test(module, OperTime, 0x05, i + 1, 0, 0x70) # Check ID