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

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

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

            DeviceId = Bytes.Read(response.DATA);
            return(DeviceId);
        }
Esempio 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));
        }
Esempio n. 6
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);
        }
Esempio 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));
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 11
0
 public async Task UnlockDoor()
 {
     await DeviceStream.SendCommand(new UnlockDoorCommand(DeviceId));
 }
Esempio n. 12
0
 public async Task SetRecords(Record record)
 {
     await DeviceStream.SendCommand(new SetRecordsCommand(DeviceId, record));
 }
Esempio n. 13
0
        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));
 }
Esempio n. 15
0
 public async Task ClearNewRecords(ulong amount)
 {
     await DeviceStream.SendCommand(new ClearRecordsCommand(DeviceId, ClearRecordsCommand.CLEAR_AMOUNT, amount));
 }
Esempio n. 16
0
 public async Task SetFaceTemplate(ulong employeeID, byte[] template)
 {
     await DeviceStream.SendCommand(new SetFaceTemplateCommand(DeviceId, employeeID, template));
 }
Esempio n. 17
0
 public async Task RebootDevice()
 {
     await DeviceStream.SendCommand(new RebootDeviceCommand(DeviceId));
 }
 public async Task ResetToFactorySettings()
 {
     await DeviceStream.SendCommand(new ResetToFactorySettingsCommand(DeviceId));
 }
Esempio n. 19
0
 public async Task DeleteEmployeesData(ulong employeeID)
 {
     await DeviceStream.SendCommand(new DeleteStaffDataCommand(DeviceId, employeeID));
 }
Esempio n. 20
0
 public async Task SetBasicSettings(BasicSettings value)
 {
     await DeviceStream.SendCommand(new SetBasicSettingsCommand(DeviceId, value));
 }
Esempio n. 21
0
        public async Task <Statistic> GetDownloadInformation()
        {
            var response = await DeviceStream.SendCommand(new GetRecordInfoCommand(DeviceId));

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

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

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