static public void DeleteFingerId(IPropertySet Inputpropertys, UInt16 fingerId)
        {
            Inputpropertys["UpdateState"] = PropertyValue.CreateInt32(0);
            Int32 CMD = Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerDeleteId");

            Inputpropertys["FingerPrint.CMD"] = PropertyValue.CreateInt32(CMD);

            Inputpropertys["FingerPrint.FingerID"] = PropertyValue.CreateUInt16((UInt16)fingerId);
            Inputpropertys["UpdateState"]          = PropertyValue.CreateInt32(1);
        }
        static public void SetSensorID(IPropertySet Inputpropertys, byte[] SensorID)
        {
            Inputpropertys["UpdateState"] = PropertyValue.CreateInt32(0);
            Int32 CMD = Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerWriteSensorID");

            Inputpropertys["FingerPrint.CMD"]      = PropertyValue.CreateInt32(CMD);
            Inputpropertys["FingerPrint.SensorID"] = PropertyValue.CreateUInt8Array(SensorID);
            Inputpropertys["FingerPrint.PageID"]   = PropertyValue.CreateUInt8(0);

            Inputpropertys["UpdateState"] = PropertyValue.CreateInt32(1);
        }
        static public void DownloadFingerId(IPropertySet Inputpropertys, UInt16 fingerId, byte[] array)
        {
            Inputpropertys["UpdateState"] = PropertyValue.CreateInt32(0);
            Int32 CMD = Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerCharDownLoad");

            Inputpropertys["FingerPrint.CMD"] = PropertyValue.CreateInt32(CMD);

            Inputpropertys["FingerPrint.FingerID"]     = PropertyValue.CreateUInt16((UInt16)fingerId);
            Inputpropertys["FingerPrint.CHARDownLoad"] = PropertyValue.CreateUInt8Array(array);

            Inputpropertys["UpdateState"] = PropertyValue.CreateInt32(1);
        }
        void Update_SEN0188_NotifyChangeState(IPropertySet Outputpropertys)
        {
            bool   doactFilledFingerLib = false;
            bool   doactFilledSensorId  = false;
            Object Valout;
            Int16  state = -1;

            if (Outputpropertys.TryGetValue("FingerPrint.CMDState", out Valout))
            {
                if (Valout != null)
                {
                    state = (Int16)Valout;
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMD", out Valout))
            {
                if (Valout != null)
                {
                    Int32 CMD = (Int32)Valout;

                    if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerSensorInitialize"))
                    {
                        if (state == 0)
                        {
                            doactFilledFingerLib            = true;
                            doactFilledSensorId             = true;
                            m_Environment.SensorInitialized = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerRegistration") || CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoRegistration"))
                    {
                        if (Outputpropertys.TryGetValue("FingerPrint.RegististrationState", out Valout))
                        {
                            if (Valout != null)
                            {
                                Int32 regState = (Int32)Valout;
                                if (regState >= 5)
                                {
                                    if (Outputpropertys.TryGetValue("FingerPrint.Registration_FingerID", out Valout))
                                    {
                                        UInt16 PageId = (UInt16)Valout;
                                        if (state == 0)
                                        {
                                            if (Outputpropertys.TryGetValue("FingerPrint.CHARUpLoad", out Valout))
                                            {
                                                if (Valout != null)
                                                {
                                                    byte[] array = Valout as byte[];
                                                    if (array != null)
                                                    {
                                                        DBDataSet dataset = m_SEN0188SQLite.getDatabyId(PageId);
                                                        if (dataset != null)
                                                        {
                                                            dataset.FingerTemplate = array;

                                                            if (SensorIDValue.Text.Length > 0)
                                                            {
                                                                dataset.SensorId = System.Text.Encoding.UTF8.GetBytes(SensorIDValue.Text);
                                                            }


                                                            this.m_SEN0188SQLite.UpdateFingerTemplateDataSet(dataset);
                                                            DataSets.SelectedItem = dataset;
                                                            doactFilledFingerLib  = true;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerDeleteId"))
                    {
                        if (state == 0)
                        {
                            doactFilledFingerLib = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoVerifiying"))
                    {
                        if (state == 0)
                        {
                            if (Outputpropertys.TryGetValue("FingerPrint.FingerID", out Valout))
                            {
                                if (Valout != null)
                                {
                                    UInt16 fingerId = (UInt16)Valout;
                                    if (Outputpropertys.TryGetValue("FingerPrint.Search_MatchScore", out Valout))
                                    {
                                        UInt16    MatchScore = (UInt16)Valout;
                                        DBDataSet dataset    = m_SEN0188SQLite.getDatabyId(fingerId);
                                        if (dataset != null)
                                        {
                                            if (MatchScore > dataset.MatchScore)
                                            {
                                                dataset.MatchScore = MatchScore;
                                                this.m_SEN0188SQLite.UpdateMatchScoreDataSet(dataset);
                                            }
                                            DataSets.SelectedItem = dataset;
                                        }
                                        else
                                        {
                                            DataSets.SelectedItem = null;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerCharDownLoad"))
                    {
                        if (state == 0)
                        { // dowwload succesfull
                            if (Outputpropertys.TryGetValue("FingerPrint.Registration_FingerID", out Valout))
                            {
                                UInt16 FingerId = (UInt16)Valout;
                                if (state == 0)
                                {
                                    DBDataSet dataset = m_SEN0188SQLite.getDatabyId(FingerId);
                                    if (dataset != null)
                                    {
                                        DataSets.SelectedItem = dataset;
                                        doactFilledFingerLib  = true;
                                    }
                                    else
                                    {
                                        DataSets.SelectedItem = null;
                                    }
                                }
                            }
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerWriteSensorID"))// write Sensor-ID
                    {
                        if (state == 0)
                        { // dowwload succesfull
                            doactFilledSensorId = true;
                        }
                    }
                }
            }



            if (doactFilledSensorId)
            {
                //   m_SensorId.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.SensorID", out Valout))
                {
                    if (Valout != null)
                    {
                        byte[] array = Valout as byte[];
                        if (array != null)
                        {
                            /*
                             * for (uint i = 0; i < array.Length; i++)
                             * {
                             *  m_SensorId.Add(array[i]);
                             * }
                             */
                            SensorIDValue.Text = System.Text.Encoding.UTF8.GetString(array, 0, array.Length);
                        }
                    }
                }
            }

            if (doactFilledFingerLib)
            {
                m_FilledFingerLib.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.FilledFingerLib", out Valout))
                {
                    if (Valout != null)
                    {
                        UInt32[] array = Valout as UInt32[];
                        if (array != null)
                        {
                            for (uint i = 0; i < array.Length; i++)
                            {
                                m_FilledFingerLib.Add(array[i]);
                            }
                        }
                    }
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMDTextState", out Valout))
            {
                String cmd = Valout as String;
                if (cmd != null)
                {
                    SensorCmdState.Text = cmd;
                }
            }
        }
Esempio n. 5
0
        void Update_SEN0188_NotifyChangeState(IPropertySet Outputpropertys)
        {
            ProcessFingerEvent ev = m_EventQueue.Dequeue(); // get Event

            Object Valout;
            Int16  state               = -1;
            String cmdState            = "...";
            bool   doactFilledSensorId = false;

            if (Outputpropertys.TryGetValue("FingerPrint.CMDState", out Valout))
            {
                if (Valout != null)
                {
                    state = (Int16)Valout;
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMDTextState", out Valout))
            {
                String cmd = Valout as String;
                if (cmd != null)
                {
                    cmdState = cmd;
                }
            }


            if (Outputpropertys.TryGetValue("FingerPrint.CMD", out Valout))
            {
                if (Valout != null)
                {
                    Int32 CMD = (Int32)Valout;

                    if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerSensorInitialize"))
                    {
                        if (state == 0)
                        {
                            //        SensorInitialized = true;
                            doactFilledSensorId = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoVerifiying"))
                    {
                        if (state == 0)
                        {
                            if (Outputpropertys.TryGetValue("FingerPrint.FingerID", out Valout))
                            {
                                if (Valout != null)
                                {
                                    UInt16 fingerId = (UInt16)Valout;
                                    if (Outputpropertys.TryGetValue("FingerPrint.Search_MatchScore", out Valout))
                                    {
                                        UInt16    MatchScore = (UInt16)Valout;
                                        DBDataSet dataset    = m_SEN0188SQLite.getDatabyId(fingerId);
                                        if (dataset != null)
                                        {
                                            if (dataset.AccessRights_Bit0 || (dataset.AccessRights & ev.AccessRights) != 0) // Master Bit
                                            {
                                                for (int i = 0; i < ev.GPIOOutputs.Count; i++)
                                                {
                                                    //                         ev.GPIOOutputs[i].GPIOEnvironmentConnector.UpdateState(0);
                                                    ev.GPIOOutputs[i].GPIOObject.SetValue = (ev.GPIOOutputs[i].GPIOObject.InitValue > 0) ? 1:0;
                                                    ev.GPIOOutputs[i].GPIOEnvironmentConnector.UpdateInputPropertySets(ev.GPIOOutputs[i].GPIOObject);
                                                }

                                                FingerEvent eventSet = new FingerEvent();
                                                eventSet.FirstName      = dataset.FirstName;
                                                eventSet.SecondName     = dataset.SecondName;
                                                eventSet.MatchScore     = MatchScore;
                                                eventSet.FingerID       = fingerId;
                                                eventSet.EventType      = 0;
                                                eventSet.SensorState    = state;
                                                eventSet.SensorTxtState = cmdState;
                                                System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
                                                eventSet.SensorId = enc.GetBytes(m_SensorID);

                                                bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet);

                                                ConfigProcessItem outstate = m_ConfigProcessItems.getConfigItemByIdent("State_OK");
                                                if (outstate != null)
                                                {
                                                    for (int i = 0; i < outstate.GPIOOutputProcessItems.Count; i++)
                                                    {
//                                                        outstate.GPIOOutputProcessItems[i].GPIOName
                                                    }
                                                }


                                                //             GetEventData();
                                            }
                                            else
                                            {
                                                ConfigProcessItem outstate = m_ConfigProcessItems.getConfigItemByIdent("State_NoPermiss");
                                                if (outstate != null)
                                                {
                                                    for (int i = 0; i < outstate.GPIOOutputProcessItems.Count; i++)
                                                    {
                                                        //                                                        outstate.GPIOOutputProcessItems[i].GPIOName
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (doactFilledSensorId)
            {
                //   m_SensorId.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.SensorID", out Valout))
                {
                    if (Valout != null)
                    {
                        byte[] array = Valout as byte[];
                        if (array != null)
                        {
                            m_SensorID = System.Text.Encoding.UTF8.GetString(array, 0, array.Length);
                        }
                    }
                }
            }
        }
        void Update_SEN0188_NotifyChangeState(IPropertySet Outputpropertys)
        {
            ProcessGPIOEvents ev;

            Object Valout;
            Int16  state               = -1;
            String cmdState            = "...";
            bool   doactFilledSensorId = false;

            if (Outputpropertys.TryGetValue("FingerPrint.CMDState", out Valout))
            {
                if (Valout != null)
                {
                    state = (Int16)Valout;
                }
            }

            if (Outputpropertys.TryGetValue("FingerPrint.CMDTextState", out Valout))
            {
                String cmd = Valout as String;
                if (cmd != null)
                {
                    cmdState = cmd;
                }
            }


            if (Outputpropertys.TryGetValue("FingerPrint.CMD", out Valout))
            {
                if (Valout != null)
                {
                    Int32 CMD = (Int32)Valout;

                    if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerSensorInitialize"))
                    {
                        if (state == 0)
                        {
                            m_Environment.SensorInitialized = true;
                            //   m_SensorInitialized = true;
                            doactFilledSensorId = true;
                        }
                    }
                    else if (CMD == Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoVerifiying"))
                    {
                        if (m_EventQueue.Count > 0)
                        {
                            ev = m_EventQueue.Dequeue(); // get Event
                        }
                        else
                        {
                            return;
                        }

                        if (state == 0)
                        {
                            if (Outputpropertys.TryGetValue("FingerPrint.FingerID", out Valout))
                            {
                                if (Valout != null)
                                {
                                    UInt16 fingerId = (UInt16)Valout;
                                    if (Outputpropertys.TryGetValue("FingerPrint.Search_MatchScore", out Valout))
                                    {
                                        UInt16    MatchScore = (UInt16)Valout;
                                        DBDataSet dataset    = m_SEN0188SQLite.getDatabyId(fingerId);
                                        if (dataset != null)
                                        {
                                            FingerEvent eventSet;
                                            if (dataset.AccessRights_Bit0 || (dataset.AccessRights & ev.AccessRights) != 0) // Master Bit
                                            {
                                                ev.UpdateState(0);                                                          // update inativ setzen

                                                ev.ProcessOutput();

                                                cmdState = String.Format("Permission to Access: {0}", ev.Ident);
                                                eventSet = createSensorEvent(dataset.FirstName, dataset.SecondName, MatchScore, fingerId, ev.Ident, state, cmdState);

                                                ProcessGPIOEvents evOk = getProcessGPIOEventsByIdent("State_OK");
                                                if (evOk != null)
                                                {
                                                    evOk.ProcessOutput();
                                                }
                                                ev.UpdateState(1); // update aktiv setzen
                                            }
                                            else
                                            {
                                                cmdState = String.Format("no Permission to Access: {0}", ev.Ident);
                                                state    = -2;
                                                eventSet = createSensorEvent(dataset.FirstName, dataset.SecondName, MatchScore, fingerId, ev.Ident, state, cmdState);

                                                ProcessGPIOEvents evNoPermiss = getProcessGPIOEventsByIdent("State_NoPermiss");
                                                if (evNoPermiss != null)
                                                {
                                                    evNoPermiss.UpdateState(0); // update inativ setzen
                                                    evNoPermiss.ProcessOutput();
                                                    evNoPermiss.UpdateState(1); // update aktiv setzen
                                                }
                                            }

                                            bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet);
                                            NotifyEvent?.Invoke(this, eventSet);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            FingerEvent       eventSet     = createSensorEvent("John", "Doe", -1, -1, ev.Ident, state, cmdState);
                            ProcessGPIOEvents evStateError = getProcessGPIOEventsByIdent("State_Error");
                            if (evStateError != null)
                            {
                                evStateError.UpdateState(0); // update inativ setzen
                                evStateError.ProcessOutput();
                                evStateError.UpdateState(1); // update aktiv setzen
                            }
                            ;

                            bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet);
                            NotifyEvent?.Invoke(this, eventSet);
                        }
                    }
                }
            }

            if (doactFilledSensorId)
            {
                //   m_SensorId.Clear();
                if (Outputpropertys.TryGetValue("FingerPrint.SensorID", out Valout))
                {
                    if (Valout != null)
                    {
                        byte[] array = Valout as byte[];
                        if (array != null)
                        {
                            m_SensorID = System.Text.Encoding.UTF8.GetString(array, 0, array.Length);
                        }
                    }
                }
            }
        }
        static public void InitSensor(IPropertySet Inputpropertys)
        {
            Int32 CMD = Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerSensorInitialize");

            Inputpropertys["FingerPrint.CMD"] = PropertyValue.CreateInt32(CMD);
        }
        static public void VerifyFingerId(IPropertySet Inputpropertys)
        {
            Int32 CMD = Connector_SEN0188_CMDs.getFingerPrintCmd("_doFingerAutoVerifiying");

            Inputpropertys["FingerPrint.CMD"] = PropertyValue.CreateInt32(CMD);
        }