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); } } } } }
async private void GPIOConnector_ChangeGPIOs(object sender, IPropertySet propertys) { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { // your code should be here m_GPIOEnvironmentConnectors.ProcessPropertysFromGPIOConnector(propertys); var con = m_GPIOEnvironmentConnectors.getGPIOOConnectorByOutputPropertySet(propertys); if (con == null) { return; } if (m_ProcessGPIOEvents == null) { return; } for (int i = 0; i < m_ProcessGPIOEvents.Count; i++) { ProcessGPIOEvents item = m_ProcessGPIOEvents[i]; if (item.InputActiv()) { removeOldEvents(); // ältere löschen, welche nach 5 sec. nicht beantwortet waren if ((item.AccessRights > 0) && m_Environment.ConnectorSEN0188Enable) { if (m_Environment.SensorConnecorInitialized) { ProcessGPIOEvents Processitem = new ProcessGPIOEvents(item); m_EventQueue.Enqueue(Processitem); SensorCMDs.VerifyFingerId(m_Environment.SensorInputServiceConnectorConfig); } else { string cmdState = "Fingerprint Connector not initialized!"; int state = -1; FingerEvent eventSet = createSensorEvent("John", "Doe", -1, -1, item.Ident, state, cmdState); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); eventSet.SensorId = enc.GetBytes(m_SensorID); bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet); NotifyEvent?.Invoke(this, eventSet); } } else { item.UpdateState(0); item.ProcessOutput(); item.UpdateState(1); int state = -1; string cmdState = "no FingerSensor used"; FingerEvent eventSet = createSensorEvent("John", "Doe", -1, -1, item.Ident, state, cmdState); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); eventSet.SensorId = enc.GetBytes(m_SensorID); bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet); NotifyEvent?.Invoke(this, eventSet); } } } }); }