Пример #1
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;
             */
        }
Пример #2
0
 private string[] SchemaTypes()
 {
     string[] types = new string[1];
     types[0] = keeleCard.getName();
     return(types);
 }