예제 #1
0
        /// <summary>
        /// This method is required for Windows Forms designer support.
        /// Do not change the method contents inside the source code editor. The Forms designer might
        /// not be able to load this method if it was changed manually.
        /// </summary>
        private void InitializeComponent()
        {
            readConfig = NotificationIcon.readConfiguration;
            acr122     = new ACR122();
            acr122_sim = new ACR122_Sim();
            acr122_v2  = new ACR122_v2();
            ls8000     = new LS8000();
            keeleCard  = new KeeleCard(acr122);
            ConfigDeviceLoad();
            ConfigTypeLoad();
            SchemaLoad();
            BtnOKLoad();
            BtnCancelLoad();

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize          = new System.Drawing.Size(284, 168);
            this.Name  = "frmSerial";
            this.Text  = "Reader Configuration";
            this.Load += new System.EventHandler(this.FrmSerialLoad);

            this.SuspendLayout();
            this.ResumeLayout(false);
        }
예제 #2
0
        public bool connectReader()
        {
            string configType   = readConfiguration.getString("type");
            string configDevice = readConfiguration.getString("device");
            string configSchema = readConfiguration.getString("schema");

            if (configType == null || configDevice == null || configSchema == null)
            {
                return(false);
            }

            LS8000 ls8000 = new LS8000();

            if (ls8000.getName().CompareTo(configType) == 0)
            {
                device = ls8000;
            }

            ACR122 acr122 = new ACR122();

            if (acr122.getName().CompareTo(configType) == 0)
            {
                device = acr122;
            }

            ACR122_Sim acr122_sim = new ACR122_Sim();

            if (acr122_sim.getName().CompareTo(configType) == 0)
            {
                device = acr122_sim;
            }

            ACR122_v2 acr122_v2 = new ACR122_v2();

            if (acr122_v2.getName().CompareTo(configType) == 0)
            {
                device = acr122_v2;
            }

            if (device == null)
            {
                return(false);
            }

            KeeleCard keeleCard = new KeeleCard(device, configDevice);

            if (keeleCard.getName().CompareTo(configSchema) == 0)
            {
                schema = keeleCard;
            }

            if (schema == null)
            {
                return(false);
                //return device.connect(configDevice);
            }
            return(true);

            /*
             * if (_serialPort == -1)
             *      return false;
             * int val = LS8000CommsLib.Comms.rf_init_com(_serialPort,NotificationIcon.baud);
             * if (val == 0)
             *      return true;
             *
             * else
             *      MessageBox.Show("Failed to connect to reader on Com " + _serialPort, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *      return false;
             */
        }