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

            return(DateConversions.ByteArrayToDateTime(response.DATA));
        }
Exemplo n.º 3
0
        public async Task <string> GetDeviceTypeCode()
        {
            var response = await DeviceStream.SendCommand(new GetDeviceTypeCommand(DeviceId));

            DeviceId = response.DeviceID;
            return(Bytes.GetAsciiString(response.DATA));
        }
Exemplo n.º 4
0
        public async Task <ulong> GetDeviceID()
        {
            var response = await DeviceStream.SendCommand(new GetDeviceIDCommand(DeviceId));

            DeviceId = Bytes.Read(response.DATA);
            return(DeviceId);
        }
Exemplo n.º 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));
        }
Exemplo n.º 6
0
        public async Task SetDeviceID(ulong newDeviceId)
        {
            await DeviceStream.SendCommand(new SetDeviceIDCommand(DeviceId, newDeviceId));

            if (DeviceId != 0)
            {
                DeviceId = newDeviceId;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 public async Task UnlockDoor()
 {
     await DeviceStream.SendCommand(new UnlockDoorCommand(DeviceId));
 }
Exemplo n.º 12
0
 public async Task SetRecords(Record record)
 {
     await DeviceStream.SendCommand(new SetRecordsCommand(DeviceId, record));
 }
Exemplo n.º 13
0
        public async Task <AdvancedSettings> GetAdvancedSettings()
        {
            var response = await DeviceStream.SendCommand(new GetAdvancedSettingsCommand(DeviceId));

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

            return(new Statistic(response.DATA));
        }
Exemplo n.º 22
0
 public async Task SetDeviceSN(string value)
 {
     await DeviceStream.SendCommand(new SetDeviceSNCommand(DeviceId, value));
 }
Exemplo n.º 23
0
 public async Task SetTimeZoneInfo(byte number, AnvizTimeZone value)
 {
     await DeviceStream.SendCommand(new SetTimeZoneInfoCommand(DeviceId, number, value));
 }
Exemplo n.º 24
0
        public async Task <byte[]> GetFaceTemplate(ulong employeeID)
        {
            var response = await DeviceStream.SendCommand(new GetFaceTemplateCommand(DeviceId, employeeID));

            return(response.DATA);
        }
Exemplo n.º 25
0
 public async Task SetAdvancedSettings(AdvancedSettings value)
 {
     await DeviceStream.SendCommand(new SetAdvancedSettingsCommand(DeviceId, value));
 }
Exemplo n.º 26
0
 public async Task SetDateTime(DateTime dateTime)
 {
     var cmd = new SetDateTimeCommand(DeviceId, dateTime);
     await DeviceStream.SendCommand(cmd);
 }
Exemplo n.º 27
0
 public async Task ClearNewRecords()
 {
     await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.CLEAR_ALL, 0));
 }
Exemplo n.º 28
0
 public async Task SetConnectionPassword(string user, string password)
 {
     var cmd = new SetConnectionPassword(DeviceId, user, password);
     await DeviceStream.SendCommand(cmd);
 }
Exemplo n.º 29
0
 public async Task DeleteAllRecords()
 {
     await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.DELETE_ALL, 0));
 }
Exemplo n.º 30
0
        public async Task <TcpParameters> GetTcpParameters()
        {
            var response = await DeviceStream.SendCommand(new GetTCPParametersCommand(DeviceId));

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