public async Task SetEmployeesData(List <UserInfo> users) { while (users.Count > 0) { await DeviceStream.SendCommand(new SetStaffDataCommand(DeviceId, users)); } }
public async Task <DateTime> GetDateTime() { var cmd = new GetDateTimeCommand(DeviceId); var response = await DeviceStream.SendCommand(cmd); return(DateConversions.ByteArrayToDateTime(response.DATA)); }
public async Task <string> GetDeviceTypeCode() { var response = await DeviceStream.SendCommand(new GetDeviceTypeCommand(DeviceId)); DeviceId = response.DeviceID; return(Bytes.GetAsciiString(response.DATA)); }
public async Task <ulong> GetDeviceID() { var response = await DeviceStream.SendCommand(new GetDeviceIDCommand(DeviceId)); DeviceId = Bytes.Read(response.DATA); return(DeviceId); }
public async Task <byte[]> EnrollFingerprint(ulong employeeID) { await DeviceStream.SendCommand(new EnrollFingerprintCommand(DeviceId, employeeID, true)); await DeviceStream.SendCommand(new EnrollFingerprintCommand(DeviceId, employeeID, false)); return(await GetFingerprintTemplate(employeeID, 0)); }
public async Task SetDeviceID(ulong newDeviceId) { await DeviceStream.SendCommand(new SetDeviceIDCommand(DeviceId, newDeviceId)); if (DeviceId != 0) { DeviceId = newDeviceId; } }
public async Task <List <ScheduledBell> > GetScheduledBells() { var response = await DeviceStream.SendCommand(new GetScheduledBellsCommand(DeviceId)); var bells = new List <ScheduledBell>(ScheduledBell.MAX_SCHEDULED_BELL_SLOT); var counter = 0; while (counter < response.DATA.Length) { bells.Add(new ScheduledBell(response.DATA, counter)); counter += ScheduledBell.RECORD_LENGTH; } return(bells); }
public async Task <byte[]> EnrollFingerprint(ulong employeeID, int verifyCount = 2) { if (verifyCount < 1) { throw new ArgumentException("verifyCount should be at least 1"); } var first = true; while (verifyCount-- > 0) { await DeviceStream.SendCommand(new EnrollFingerprintCommand(DeviceId, employeeID, first)); first = false; } return(await GetFingerprintTemplate(employeeID, 0)); }
public async Task <List <Record> > DownloadRecords(bool onlyNew = false) { var statistics = await GetDownloadInformation(); var recordAmount = onlyNew ? statistics.NewRecordAmount : statistics.AllRecordAmount; var records = new List <Record>((int)recordAmount); var isFirst = true; while (recordAmount > 0) { var response = await DeviceStream.SendCommand(new GetRecordsCommand(DeviceId, isFirst, onlyNew, recordAmount)); var counter = response.DATA[0]; recordAmount -= counter; for (var i = 0; i < counter; i++) { records.Add(new Record(response.DATA, 1 + i * Record.RECORD_LENGTH)); } isFirst = false; } return(records); }
public async Task <List <UserInfo> > GetEmployeesData() { var statistics = await GetDownloadInformation(); var userAmount = statistics.UserAmount; var users = new List <UserInfo>((int)userAmount); var isFirst = true; while (userAmount > 0) { var response = await DeviceStream.SendCommand(new GetStaffDataCommand(DeviceId, isFirst, userAmount)); var counter = response.DATA[0]; userAmount -= counter; for (var i = 0; i < counter; i++) { users.Add(new UserInfo(response.DATA, 1 + i * UserInfo.RECORD_LENGTH)); } isFirst = false; } return(users); }
public async Task UnlockDoor() { await DeviceStream.SendCommand(new UnlockDoorCommand(DeviceId)); }
public async Task SetRecords(Record record) { await DeviceStream.SendCommand(new SetRecordsCommand(DeviceId, record)); }
public async Task <AdvancedSettings> GetAdvancedSettings() { var response = await DeviceStream.SendCommand(new GetAdvancedSettingsCommand(DeviceId)); return(new AdvancedSettings(response.DATA)); }
public async Task SetFingerprintTemplate(ulong employeeID, Finger finger, byte[] template) { await DeviceStream.SendCommand(new SetFingerprintTemplateCommand(DeviceId, employeeID, finger, template)); }
public async Task ClearNewRecords(ulong amount) { await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.CLEAR_AMOUNT, amount)); }
public async Task SetFaceTemplate(ulong employeeID, byte[] template) { await DeviceStream.SendCommand(new SetFaceTemplateCommand(DeviceId, employeeID, template)); }
public async Task RebootDevice() { await DeviceStream.SendCommand(new RebootDeviceCommand(DeviceId)); }
public async Task ResetToFactorySettings() { await DeviceStream.SendCommand(new ResetToFactorySettingsCommand(DeviceId)); }
public async Task DeleteEmployeesData(ulong employeeID) { await DeviceStream.SendCommand(new DeleteStaffDataCommand(DeviceId, employeeID)); }
public async Task SetBasicSettings(BasicSettings value) { await DeviceStream.SendCommand(new SetBasicSettingsCommand(DeviceId, value)); }
public async Task <Statistic> GetDownloadInformation() { var response = await DeviceStream.SendCommand(new GetRecordInfoCommand(DeviceId)); return(new Statistic(response.DATA)); }
public async Task SetDeviceSN(string value) { await DeviceStream.SendCommand(new SetDeviceSNCommand(DeviceId, value)); }
public async Task SetTimeZoneInfo(byte number, AnvizTimeZone value) { await DeviceStream.SendCommand(new SetTimeZoneInfoCommand(DeviceId, number, value)); }
public async Task <byte[]> GetFaceTemplate(ulong employeeID) { var response = await DeviceStream.SendCommand(new GetFaceTemplateCommand(DeviceId, employeeID)); return(response.DATA); }
public async Task SetAdvancedSettings(AdvancedSettings value) { await DeviceStream.SendCommand(new SetAdvancedSettingsCommand(DeviceId, value)); }
public async Task SetDateTime(DateTime dateTime) { var cmd = new SetDateTimeCommand(DeviceId, dateTime); await DeviceStream.SendCommand(cmd); }
public async Task ClearNewRecords() { await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.CLEAR_ALL, 0)); }
public async Task SetConnectionPassword(string user, string password) { var cmd = new SetConnectionPassword(DeviceId, user, password); await DeviceStream.SendCommand(cmd); }
public async Task DeleteAllRecords() { await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.DELETE_ALL, 0)); }
public async Task <TcpParameters> GetTcpParameters() { var response = await DeviceStream.SendCommand(new GetTCPParametersCommand(DeviceId)); return(new TcpParameters(response.DATA)); }