コード例 #1
0
 public async Task SetEmployeesData(List <UserInfo> users)
 {
     while (users.Count > 0)
     {
         await DeviceStream.SendCommand(new SetStaffDataCommand(DeviceId, users));
     }
 }
コード例 #2
0
        public async Task <DateTime> GetDateTime()
        {
            var cmd      = new GetDateTimeCommand(DeviceId);
            var response = await DeviceStream.SendCommand(cmd);

            return(DateConversions.ByteArrayToDateTime(response.DATA));
        }
コード例 #3
0
        public async Task <string> GetDeviceTypeCode()
        {
            var response = await DeviceStream.SendCommand(new GetDeviceTypeCommand(DeviceId));

            DeviceId = response.DeviceID;
            return(Bytes.GetAsciiString(response.DATA));
        }
コード例 #4
0
        public async Task <ulong> GetDeviceID()
        {
            var response = await DeviceStream.SendCommand(new GetDeviceIDCommand(DeviceId));

            DeviceId = Bytes.Read(response.DATA);
            return(DeviceId);
        }
コード例 #5
0
        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));
        }
コード例 #6
0
ファイル: SetDeviceIDCommand.cs プロジェクト: xiltoos/Anviz
        public async Task SetDeviceID(ulong newDeviceId)
        {
            await DeviceStream.SendCommand(new SetDeviceIDCommand(DeviceId, newDeviceId));

            if (DeviceId != 0)
            {
                DeviceId = newDeviceId;
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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));
        }
コード例 #9
0
ファイル: GetRecordsCommand.cs プロジェクト: xiltoos/Anviz
        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);
        }
コード例 #10
0
ファイル: GetStaffDataCommand.cs プロジェクト: xiltoos/Anviz
        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);
        }
コード例 #11
0
 public async Task UnlockDoor()
 {
     await DeviceStream.SendCommand(new UnlockDoorCommand(DeviceId));
 }
コード例 #12
0
ファイル: SetRecordsCommand.cs プロジェクト: xiltoos/Anviz
 public async Task SetRecords(Record record)
 {
     await DeviceStream.SendCommand(new SetRecordsCommand(DeviceId, record));
 }
コード例 #13
0
        public async Task <AdvancedSettings> GetAdvancedSettings()
        {
            var response = await DeviceStream.SendCommand(new GetAdvancedSettingsCommand(DeviceId));

            return(new AdvancedSettings(response.DATA));
        }
コード例 #14
0
 public async Task SetFingerprintTemplate(ulong employeeID, Finger finger, byte[] template)
 {
     await DeviceStream.SendCommand(new SetFingerprintTemplateCommand(DeviceId, employeeID, finger, template));
 }
コード例 #15
0
 public async Task ClearNewRecords(ulong amount)
 {
     await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.CLEAR_AMOUNT, amount));
 }
コード例 #16
0
 public async Task SetFaceTemplate(ulong employeeID, byte[] template)
 {
     await DeviceStream.SendCommand(new SetFaceTemplateCommand(DeviceId, employeeID, template));
 }
コード例 #17
0
 public async Task RebootDevice()
 {
     await DeviceStream.SendCommand(new RebootDeviceCommand(DeviceId));
 }
コード例 #18
0
 public async Task ResetToFactorySettings()
 {
     await DeviceStream.SendCommand(new ResetToFactorySettingsCommand(DeviceId));
 }
コード例 #19
0
 public async Task DeleteEmployeesData(ulong employeeID)
 {
     await DeviceStream.SendCommand(new DeleteStaffDataCommand(DeviceId, employeeID));
 }
コード例 #20
0
 public async Task SetBasicSettings(BasicSettings value)
 {
     await DeviceStream.SendCommand(new SetBasicSettingsCommand(DeviceId, value));
 }
コード例 #21
0
        public async Task <Statistic> GetDownloadInformation()
        {
            var response = await DeviceStream.SendCommand(new GetRecordInfoCommand(DeviceId));

            return(new Statistic(response.DATA));
        }
コード例 #22
0
ファイル: SetDeviceSNCommand.cs プロジェクト: xiltoos/Anviz
 public async Task SetDeviceSN(string value)
 {
     await DeviceStream.SendCommand(new SetDeviceSNCommand(DeviceId, value));
 }
コード例 #23
0
 public async Task SetTimeZoneInfo(byte number, AnvizTimeZone value)
 {
     await DeviceStream.SendCommand(new SetTimeZoneInfoCommand(DeviceId, number, value));
 }
コード例 #24
0
        public async Task <byte[]> GetFaceTemplate(ulong employeeID)
        {
            var response = await DeviceStream.SendCommand(new GetFaceTemplateCommand(DeviceId, employeeID));

            return(response.DATA);
        }
コード例 #25
0
 public async Task SetAdvancedSettings(AdvancedSettings value)
 {
     await DeviceStream.SendCommand(new SetAdvancedSettingsCommand(DeviceId, value));
 }
コード例 #26
0
ファイル: SetDateTimeCommand.cs プロジェクト: xiltoos/Anviz
 public async Task SetDateTime(DateTime dateTime)
 {
     var cmd = new SetDateTimeCommand(DeviceId, dateTime);
     await DeviceStream.SendCommand(cmd);
 }
コード例 #27
0
 public async Task ClearNewRecords()
 {
     await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.CLEAR_ALL, 0));
 }
コード例 #28
0
 public async Task SetConnectionPassword(string user, string password)
 {
     var cmd = new SetConnectionPassword(DeviceId, user, password);
     await DeviceStream.SendCommand(cmd);
 }
コード例 #29
0
 public async Task DeleteAllRecords()
 {
     await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.DELETE_ALL, 0));
 }
コード例 #30
0
        public async Task <TcpParameters> GetTcpParameters()
        {
            var response = await DeviceStream.SendCommand(new GetTCPParametersCommand(DeviceId));

            return(new TcpParameters(response.DATA));
        }