Exemple #1
0
        public Boolean saveHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
        {
            Boolean success;

            OleDbCommand cmd = DBConnection.getInstance.getDbCommand();

            cmd.CommandText = "INSERT INTO HARDWARE_CONFIGURATION (ID_COMPANY, ID_HARDWARE, CRYPTOGRAPHIC_KEY, SERIAL_NUMBER, MODEL, VERSION, PORT, IP, CPF) VALUES (?,?,?,?,?,?,?,?,?)";

            cmd.Parameters.Add("ID_COMPANY", OleDbType.Integer).Value        = hardwareConfiguration.company != null ? hardwareConfiguration.company.idCompany : 0;
            cmd.Parameters.Add("ID_HARDWARE", OleDbType.Integer).Value       = hardwareConfiguration.hardware != null ? hardwareConfiguration.hardware.idHardware : 0;
            cmd.Parameters.Add("CRYPTOGRAPHIC_KEY", OleDbType.VarChar).Value = hardwareConfiguration.cryptographicKey;
            cmd.Parameters.Add("SERIAL_NUMBER", OleDbType.VarChar).Value     = hardwareConfiguration.serialNumber;
            cmd.Parameters.Add("MODEL", OleDbType.VarChar).Value             = hardwareConfiguration.model;
            cmd.Parameters.Add("VERSION", OleDbType.VarChar).Value           = hardwareConfiguration.version;
            cmd.Parameters.Add("PORT", OleDbType.VarChar).Value = hardwareConfiguration.port;
            cmd.Parameters.Add("IP", OleDbType.VarChar).Value   = hardwareConfiguration.ip;
            cmd.Parameters.Add("CPF", OleDbType.VarChar).Value  = hardwareConfiguration.cpf;

            try
            {
                cmd.ExecuteNonQuery();
                success = true;
            }
            catch (Exception e)
            {
                Console.WriteLine("Erro ao salvar!" + e);
                success = false;
            }

            DBConnection.getInstance.closeConnection();

            return(success);
        }
Exemple #2
0
        public List <HardwareConfiguration> getAllHardwareConfigurations()
        {
            List <HardwareConfiguration> hardwareConfigurations = new List <HardwareConfiguration>();

            OleDbCommand cmd = DBConnection.getInstance.getDbCommand();

            cmd.CommandText = "SELECT * FROM HARDWARE_CONFIGURATION";
            OleDbDataReader result = cmd.ExecuteReader();

            if (result.HasRows)
            {
                while (result.Read())
                {
                    HardwareConfiguration hardwareConfiguration = new HardwareConfiguration();
                    hardwareConfiguration.idHardwareConfiguration = result.GetInt32(0);
                    hardwareConfiguration.company          = companyControl.getCompany(result.GetInt32(1));
                    hardwareConfiguration.hardware         = hardwareControl.getHardware(result.GetInt32(2));
                    hardwareConfiguration.cryptographicKey = result.GetString(3);
                    hardwareConfiguration.serialNumber     = result.GetString(4);
                    hardwareConfiguration.model            = result.GetString(5);
                    hardwareConfiguration.version          = result.GetString(6);
                    hardwareConfiguration.port             = result.GetString(7);
                    hardwareConfiguration.ip  = result.GetString(8);
                    hardwareConfiguration.cpf = result.GetString(9);

                    hardwareConfigurations.Add(hardwareConfiguration);
                }
            }

            result.Close();

            return(hardwareConfigurations);
        }
Exemple #3
0
        public Boolean updateHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
        {
            Boolean success;

            OleDbCommand cmd = DBConnection.getInstance.getDbCommand();

            cmd.CommandText = "UPDATE HARDWARE_CONFIGURATION SET ID_COMPANY=?, ID_HARDWARE=?, CRYPTOGRAPHIC_KEY=?, SERIAL_NUMBER=?, MODEL=?, VERSION=?, PORT=?, IP=?, CPF=? WHERE ID_HARDWARE_CONFIGURATION=?";

            cmd.Parameters.Add("ID_COMPANY", OleDbType.Integer).Value        = hardwareConfiguration.company != null ? hardwareConfiguration.company.idCompany : 0;
            cmd.Parameters.Add("ID_HARDWARE", OleDbType.Integer).Value       = hardwareConfiguration.hardware != null ? hardwareConfiguration.hardware.idHardware : 0;
            cmd.Parameters.Add("CRYPTOGRAPHIC_KEY", OleDbType.VarChar).Value = hardwareConfiguration.cryptographicKey;
            cmd.Parameters.Add("SERIAL_NUMBER", OleDbType.VarChar).Value     = hardwareConfiguration.serialNumber;
            cmd.Parameters.Add("MODEL", OleDbType.VarChar).Value             = hardwareConfiguration.model;
            cmd.Parameters.Add("VERSION", OleDbType.VarChar).Value           = hardwareConfiguration.version;
            cmd.Parameters.Add("PORT", OleDbType.VarChar).Value = hardwareConfiguration.port;
            cmd.Parameters.Add("IP", OleDbType.VarChar).Value   = hardwareConfiguration.ip;
            cmd.Parameters.Add("CPF", OleDbType.VarChar).Value  = hardwareConfiguration.cpf;
            cmd.Parameters.Add("ID_HARDWARE_CONFIGURATION", OleDbType.Integer).Value = hardwareConfiguration.idHardwareConfiguration;

            try
            {
                cmd.ExecuteNonQuery();
                success = true;
            }
            catch (Exception e)
            {
                Console.WriteLine("Erro ao alterar!" + e);
                success = false;
            }

            DBConnection.getInstance.closeConnection();

            return(success);
        }
        private void upsertHardwareConfiguration()
        {
            HardwareConfiguration hardwareConfiguration = getHardwareConfigurationFromControls();
            Boolean success;

            if (idHardwareConfigurationEditing != 0)
            {
                hardwareConfiguration.idHardwareConfiguration = idHardwareConfigurationEditing;
                success = hardwareConfigurationControl.updateHardwareConfiguration(hardwareConfiguration);
                saveModeControls();
            }
            else
            {
                success = hardwareConfigurationControl.saveHardwareConfiguration(hardwareConfiguration);
            }

            cleanControls();

            if (success)
            {
                DialogHost.Show(new SampleMessageDialog("Equipamento salvo com sucesso."), "DHMain");
                fillGridHardwareConfiguration();
            }
            else
            {
                DialogHost.Show(new SampleMessageDialog("Erro ao salvar Equipamento."), "DHMain");
            }
        }
Exemple #5
0
        public HardwareConfiguration getHardwareConfiguration(int idHardwareConfiguration)
        {
            HardwareConfiguration hardwareConfiguration = new HardwareConfiguration();

            OleDbCommand cmd = DBConnection.getInstance.getDbCommand();

            cmd.CommandText = "SELECT * FROM HARDWARE_CONFIGURATION WHERE ID_HARDWARE_CONFIGURATION=?";
            cmd.Parameters.Add("ID_HARDWARE_CONFIGURATION", OleDbType.Integer).Value = idHardwareConfiguration;
            OleDbDataReader result = cmd.ExecuteReader();

            if (result.HasRows)
            {
                if (result.Read())
                {
                    hardwareConfiguration.idHardwareConfiguration = result.GetInt32(0);
                    hardwareConfiguration.company          = companyControl.getCompany(result.GetInt32(1));
                    hardwareConfiguration.hardware         = hardwareControl.getHardware(result.GetInt32(2));
                    hardwareConfiguration.cryptographicKey = result.GetString(3);
                    hardwareConfiguration.serialNumber     = result.GetString(4);
                    hardwareConfiguration.model            = result.GetString(5);
                    hardwareConfiguration.version          = result.GetString(6);
                    hardwareConfiguration.port             = result.GetString(7);
                    hardwareConfiguration.ip  = result.GetString(8);
                    hardwareConfiguration.cpf = result.GetString(9);
                }
            }

            result.Close();

            return(hardwareConfiguration);
        }
Exemple #6
0
 private HardwareManager CreateHardwareManager(HardwareConfiguration configuration, IHardwareDriver driver)
 {
     return(new HardwareManager(
                Options.Create(configuration),
                Mock.Of <ILogger <HardwareManager> >(),
                driver));
 }
Exemple #7
0
        private void readEmployer(object sender, RoutedEventArgs e)
        {
            CommandReadEmployer   commandReadEmployer   = new CommandReadEmployer();
            HardwareConfiguration hardwareConfiguration = (HardwareConfiguration)CBCompanyReceive.SelectedItem;

            ErrorCommand ec      = commandReadEmployer.execute(hardwareConfiguration.ip, hardwareConfiguration.port, "05021923327", "");
            Company      company = commandReadEmployer.getCompany();
        }
        public void ControlSelectedCallback(HardwareConfiguration hardwareConfiguration)
        {
            _hardwareConfiguration = hardwareConfiguration;

            _ControlWizardWindow.OpenOrClose();

            SelectedControl = _hardwareConfiguration.ToString();
            RaisePropertyChanged("SelectedControl");
        }
Exemple #9
0
        private static HardwareConfiguration GetHardwareConfigurationResult(Response response)
        {
            if (response.Command != PrimaryResponseCommand.SystemCommands)
            {
                throw new InvalidDataException(string.Format("Expected response of {0} but received {1}.",
                                                             PrimaryResponseCommand.SystemCommands, response.Command));
            }

            return(HardwareConfiguration.Parse(response.Data));
        }
        private async void deleteHardwareConfiguration(object sender, RoutedEventArgs e)
        {
            OptionMessageDialog optionMessageDialog = new OptionMessageDialog("Deseja realmente excluir este Equipamento?");
            Boolean             result = (Boolean)await DialogHost.Show(optionMessageDialog, "DHMain");

            if (result == true)
            {
                HardwareConfiguration hardwareConfiguration = ((FrameworkElement)sender).DataContext as HardwareConfiguration;
                deleteHardwareConfiguration(hardwareConfiguration);
            }
        }
        private void FillForm(CommandControlMappingElement data)
        {
            void FillApplication()
            {
                switch (data.mode)
                {
                case CommandControlMappingElement.Mode.Indexed:
                    SelectedMode = Properties.Resources.IndexedText;
                    break;

                case CommandControlMappingElement.Mode.ApplicationSelection:
                    SelectedMode = Properties.Resources.ApplicationSelectionText;
                    break;
                }

                SelectedIndexesApplications = data.indexApplicationSelection;
            }

            SelectedDevice = data.audioDevice;

            switch (data.command)
            {
            case CommandControlMappingElement.Command.ApplicationMute:
                SelectedCommand = Properties.Resources.ApplicationMuteText;
                FillApplication();
                break;

            case CommandControlMappingElement.Command.ApplicationVolume:
                SelectedCommand = Properties.Resources.ApplicationVolumeText;
                FillApplication();
                break;

            case CommandControlMappingElement.Command.SystemMute:
                SelectedCommand = Properties.Resources.AudioDeviceMuteText;
                break;

            case CommandControlMappingElement.Command.SystemVolume:
                SelectedCommand = Properties.Resources.AudioDeviceVolumeText;
                break;

            case CommandControlMappingElement.Command.SetDefaultDevice:
                SelectedCommand = Properties.Resources.SetAsDefaultDevice;
                break;

            case CommandControlMappingElement.Command.CycleDefaultDevice:
                SelectedCommand = Properties.Resources.CycleDefaultDevices;
                break;
            }

            SelectedDeviceType     = HardwareManager.Current.GetConfigType(data);
            SelectedControl        = data.hardwareConfiguration.ToString();
            _hardwareConfiguration = data.hardwareConfiguration;
        }
Exemple #12
0
        public void ConfigurationMissingInputs()
        {
            var configuration = new HardwareConfiguration();

            // Add sensors
            foreach (var n in Enum.GetNames(typeof(TemperatureSensorName)))
            {
                configuration.TemperatureSensors.Add(new HardwareTemperatureSensorConfiguration(n, n));
            }

            CreateHardwareManager(configuration, Mock.Of <IHardwareDriver>())
            .OpenConfiguration();
        }
Exemple #13
0
 // Constructor
 public CommandControlMappingElement(
     HardwareConfiguration hardwareConfiguration,
     string audioDevice,
     Command command,
     Mode mode,
     string indexApplicationSelection)
 {
     this.hardwareConfiguration = hardwareConfiguration;
     this.audioDevice           = audioDevice;
     this.command = command;
     this.mode    = mode;
     this.indexApplicationSelection = indexApplicationSelection;
 }
Exemple #14
0
 private static void DisplayConfiguration(HardwareConfiguration config)
 {
     Debug.WriteLine("");
     Debug.WriteLine("Terminal ID:         {0}", config.TerminalId);
     Debug.WriteLine("Terminal Type:       {0}", config.TerminalType);
     Debug.WriteLine("Firmware Version:    {0} ({1:d})", config.FirmwareVersion, config.FirmwareDate);
     Debug.WriteLine("Keyboard Type:       {0}", config.KeyboardType);
     Debug.WriteLine("Display Type:        {0}", config.DisplayType);
     Debug.WriteLine("FPU Type:            {0}", config.FingerprintUnitType);
     Debug.WriteLine("FPU Mode:            {0}", config.FingerprintUnitMode);
     Debug.WriteLine("Serial Port Info:    {0} {1}", config.HostSerialBaudRate, config.HostSerialParameters.ToUpperInvariant());
     Debug.WriteLine("User Defined Field:  {0}", config.UserDefinedField);
     Debug.WriteLine("");
 }
        private void deleteHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
        {
            Boolean success = hardwareConfigurationControl.deleteHardwareConfiguration(hardwareConfiguration);

            if (success)
            {
                DialogHost.Show(new SampleMessageDialog("Equipamento excluído com sucesso."), "DHMain");
                fillGridHardwareConfiguration();
            }
            else
            {
                DialogHost.Show(new SampleMessageDialog("Erro ao excluir Equipamento."), "DHMain");
            }
        }
Exemple #16
0
        public bool Filter(object obj)
        {
            HardwareConfiguration data = (HardwareConfiguration)obj;

            if (obj is HardwareConfiguration)
            {
                if (!string.IsNullOrEmpty(_TBFilter))
                {
                    return(Util.contains(data.hardware.description, _TBFilter));
                }
                return(true);
            }
            return(false);
        }
        public HardwareConfigurationForm(HardwareConfiguration hwconfig)
        {
            InitializeComponent();

            this.hwconfig = hwconfig;

            checkedListBox1.Items.AddRange(expander_names);
            checkedListBox2.Items.AddRange(expander_names);

            for (int index_counter = 0; index_counter < 14; index_counter++)
            {
                checkedListBox1.SetItemChecked(index_counter, hwconfig.Expander0Configuration[index_counter]);
                checkedListBox2.SetItemChecked(index_counter, hwconfig.Expander1Configuration[index_counter]);
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     //edit hardware configuration
     if (listBox1.SelectedIndex > -1)
     {
         HardwareConfiguration     hwconfig   = ((ExpanderMonitor)listBox1.SelectedItem).HardwareConfiguration;
         HardwareConfigurationForm hwconfigfm = new HardwareConfigurationForm(hwconfig);
         hwconfigfm.ShowDialog(this);
         if (hwconfigfm.DialogResult == DialogResult.OK)
         {
             ((ExpanderMonitor)listBox1.SelectedItem).HardwareConfiguration = hwconfig;
         }
         hwconfigfm.Dispose();
     }
 }
Exemple #19
0
        public void ConfigurationMissingSensors()
        {
            var configuration = new HardwareConfiguration();

            // Add all pins
            int pinId = 0;

            foreach (var pinName in Enum.GetNames(typeof(PinName)))
            {
                configuration.Pins.Add(new HardwarePinConfiguration(pinName, pinId++, HardwarePinConfigurationMode.Input));
            }

            CreateHardwareManager(configuration, Mock.Of <IHardwareDriver>())
            .OpenConfiguration();
        }
        private HardwareConfiguration getHardwareConfigurationFromControls()
        {
            HardwareConfiguration hardwareConfiguration = new HardwareConfiguration();

            hardwareConfiguration.company          = (Company)CBCompany.SelectedItem;
            hardwareConfiguration.hardware         = (Hardware)CBHardware.SelectedItem;
            hardwareConfiguration.cryptographicKey = TBCryptographicKey.Text;
            hardwareConfiguration.serialNumber     = TBSerialNumber.Text;
            hardwareConfiguration.model            = TBModel.Text;
            hardwareConfiguration.version          = TBVersion.Text;
            hardwareConfiguration.port             = TBPort.Text;
            hardwareConfiguration.ip  = TBIp.Text;
            hardwareConfiguration.cpf = TBCpf.Text;

            return(hardwareConfiguration);
        }
Exemple #21
0
        public void ConfigurationDuplicatePinsInputs()
        {
            var configuration = new HardwareConfiguration();

            foreach (var pinName in Enum.GetNames(typeof(PinName)))
            {
                configuration.Pins.Add(new HardwarePinConfiguration(pinName, 1, HardwarePinConfigurationMode.Input));
            }

            // Add sensors
            foreach (var n in Enum.GetNames(typeof(TemperatureSensorName)))
            {
                configuration.TemperatureSensors.Add(new HardwareTemperatureSensorConfiguration(n, n));
            }


            CreateHardwareManager(configuration, Mock.Of <IHardwareDriver>())
            .OpenConfiguration();
        }
        private void loadHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
        {
            int index = -1;

            for (int i = 0; i < allCompanies.Count; i++)
            {
                Company cp = (Company)allCompanies[i];

                if (hardwareConfiguration.company.idCompany == cp.idCompany)
                {
                    index = i;
                    break;
                }
            }

            int indexHardware = -1;

            for (int i = 0; i < allHardwares.Count; i++)
            {
                Hardware hd = (Hardware)allHardwares[i];

                if (hardwareConfiguration.hardware.idHardware == hd.idHardware)
                {
                    indexHardware = i;
                    break;
                }
            }

            CBCompany.SelectedIndex  = index;
            CBHardware.SelectedIndex = indexHardware;
            TBCryptographicKey.Text  = hardwareConfiguration.cryptographicKey;
            TBSerialNumber.Text      = hardwareConfiguration.serialNumber;
            TBModel.Text             = hardwareConfiguration.model;
            TBVersion.Text           = hardwareConfiguration.version;
            TBPort.Text = hardwareConfiguration.port;
            TBIp.Text   = hardwareConfiguration.ip;
            TBCpf.Text  = hardwareConfiguration.cpf;

            idHardwareConfigurationEditing = hardwareConfiguration.idHardwareConfiguration;

            editModeControls();
        }
        public override Window GetConfigurationWindow(HardwareSettingsViewModel hardwareSettingsViewModel,
                                                      HardwareConfiguration loadedConfig = null)
        {
            MIDIControlWizardViewModel viewModel = null;

            if (!(loadedConfig is MidiConfiguration))
            {
                viewModel = new MIDIControlWizardViewModel(Properties.Resources.MidiControlWizardText,
                                                           hardwareSettingsViewModel);
            }
            else
            {
                viewModel = new MIDIControlWizardViewModel(Properties.Resources.MidiControlWizardText,
                                                           hardwareSettingsViewModel, (MidiConfiguration)loadedConfig);
            }

            return(new MIDIControlWizardWindow {
                DataContext = viewModel
            });
        }
Exemple #24
0
        private HardwareManager CreateHardwareManagerWithFullConfiguration(IHardwareDriver driver)
        {
            var configuration = new HardwareConfiguration();

            // Add all pins
            int pinId = 1;

            foreach (var pinName in Enum.GetNames(typeof(PinName)))
            {
                configuration.Pins.Add(new HardwarePinConfiguration(pinName, pinId++, HardwarePinConfigurationMode.Output));
            }

            // Add sensors
            foreach (var n in Enum.GetNames(typeof(TemperatureSensorName)))
            {
                configuration.TemperatureSensors.Add(new HardwareTemperatureSensorConfiguration(n, n));
            }

            return(new HardwareManager(
                       Options.Create(configuration),
                       Mock.Of <ILogger <HardwareManager> >(),
                       driver));
        }
Exemple #25
0
        public Boolean deleteHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
        {
            Boolean success;

            OleDbCommand cmd = DBConnection.getInstance.getDbCommand();

            cmd.CommandText = "DELETE FROM HARDWARE_CONFIGURATION WHERE ID_HARDWARE_CONFIGURATION=?";
            cmd.Parameters.Add("ID_HARDWARE", OleDbType.Integer).Value = hardwareConfiguration.idHardwareConfiguration;

            try
            {
                cmd.ExecuteNonQuery();
                success = true;
            }
            catch (Exception e)
            {
                Console.WriteLine("Erro ao excluir!" + e);
                success = false;
            }

            DBConnection.getInstance.closeConnection();

            return(success);
        }
Exemple #26
0
 public Boolean saveHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
 {
     return(hardwareConfigurationDAO.saveHardwareConfiguration(hardwareConfiguration));
 }
Exemple #27
0
 public Boolean updateHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
 {
     return(hardwareConfigurationDAO.updateHardwareConfiguration(hardwareConfiguration));
 }
Exemple #28
0
 public Boolean deleteHardwareConfiguration(HardwareConfiguration hardwareConfiguration)
 {
     return(hardwareConfigurationDAO.deleteHardwareConfiguration(hardwareConfiguration));
 }
        private void loadHardwareConfiguration(object sender, RoutedEventArgs e)
        {
            HardwareConfiguration hardwareConfiguration = ((FrameworkElement)sender).DataContext as HardwareConfiguration;

            loadHardwareConfiguration(hardwareConfiguration);
        }
Exemple #30
0
 public Scanner(ILogger logger)
 {
     _logger = logger;
     _waitEvents = new HybridDictionary();
     _recevedEvents = new HybridDictionary();
     _events = new Queue();
     _mre = new ManualResetEvent(false);
     _validPageLengths = new ValidPageLength[MAX_SHEET_FORMATS];
     _validPageOffsets = new ValidPageOffset[MAX_SHEET_FORMATS];
     _sheetScanning = false;
     _scannerBusy = false;
     foreach (HardwareConfiguration t in s_ports)
     {
         _currentConfiguration = t;
         Socket udpSocketSend = null;
         Socket udpSocketReceive = null;
         Socket tcpSocket = null;
         try
         {
             udpSocketSend = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Unspecified);
             udpSocketReceive = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Unspecified);
             udpSocketReceive.Bind(new IPEndPoint(System.Net.IPAddress.Any, _currentConfiguration.UdpPortReceive));
             byte[] data = { 1, 0, 0, 0 };
             var um = new UserMessage(Command.umConnect, data);
             EndPoint ep = new IPEndPoint(LOCAL_HOST, _currentConfiguration.UdpPortSend);
             udpSocketSend.SendTo(um.Buffer, ep);
             if (!udpSocketReceive.Poll(TIMEOUT, SelectMode.SelectRead))
             {
                 continue;
             }
             data = new byte[1024];
             udpSocketReceive.ReceiveFrom(data, ref ep);
             um = new UserMessage(data);
             if (um.Command != Command.umConnect)
             {
                 throw new Exception("ScannerWantNotConnect");
             }
             var cc = new UmConnectConfirmation(um.Data);
             if (cc.Answer != 1)
             {
                 throw new Exception("ScannerWantNotConnect");
             }
             _status = cc.Status;
             tcpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Unspecified);
             tcpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
             ep = new IPEndPoint(System.Net.IPAddress.Any, _currentConfiguration.TcpPport);
             tcpSocket.Bind(ep);
             tcpSocket.Listen(1);
             ScannerSocket.SetBuffers(tcpSocket);
             _scannerSocket = new ScannerSocket(tcpSocket.Accept());
             udpSocketSend.Close();
             udpSocketReceive.Close();
             tcpSocket.Close();
             _workThread = new Thread(Work);
             _workThread.Start();
             _sendEventsThread = new Thread(SendEvents);
             _sendEventsThread.Start();
             um = SendAndWaitAnswer(Command.umGetVersion);
             DriverVersion = (new Versions(um.Data)).Driver;
             switch (_currentConfiguration.ScannerVersion)
             {
                 case ScannerVersion.V2003:
                     _sh = new SIB2003.SharedMemory();
                     break;
                 case ScannerVersion.V2005:
                     _sh = new SIB2005.SharedMemory();
                     break;
                 case ScannerVersion.V2009:
                     _sh = new SIB2009.SharedMemory();
                     break;
                 case ScannerVersion.V2010:
                     _sh = new SIB2010.SharedMemory();
                     break;
             }
             _x = new short[NUMBER_OF_SIDES];
             _x[0] = _x[1] = 0;
             _y = new short[NUMBER_OF_SIDES];
             _y[0] = _y[1] = 0;
             ScanningEnabled = false;
             ReloadProperties();
             ReloadManufProps();
             ReloadWhiteCoeffs();
             logger.LogInfo(Message.ScannerManagerDetectedHardware,
                            _currentConfiguration.ScannerVersion, _currentConfiguration.MaxLines, _currentConfiguration.DotsOneLine,
                            _currentConfiguration.DotsOneSide, _currentConfiguration.SizeofBinaryBuffer, _currentConfiguration.SizeofHalftoneBuffer);
             break;
         }
         finally
         {
             if (udpSocketSend != null)
                 udpSocketSend.Close();
             if (udpSocketReceive != null)
                 udpSocketReceive.Close();
             if (tcpSocket != null)
                 tcpSocket.Close();
         }
     }
     if (_scannerSocket == null)
     {
         throw new Exception("не дождались соединения со сканером");
     }
 }