/// <summary> /// Check status of connection and restore, if down /// </summary> public static void CheckConnection() { if (!subscriptionsDone) { Utility.PowerManager.PowerNotify += new PowerManager.PowerEventHandler(PowerManager_PowerNotify); DebugLog.Log += new LogProvider.LogHandler(DebugLog_Log_ToDisk); subscriptionsDone = true; } lock (readerLock) { try { if (null == _rdr) { //Modify for could not turn on issue CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, 1); DebugLog_Log_ToDisk("Set PPN_UNATTENDEDMODE to 1"); _rdr = RFIDScanner.ConnectReader(); EnableUnattendedReaderMode(Utility.ReaderPortName); //_rdr.ParamSet("/reader/powerMode", Reader.PowerMode.MEDSAVE); _rdr.ParamSet("/reader/powerMode", Reader.PowerMode.FULL); } } catch (Exception) { throw; } } }
/// <summary> /// Withdraw unattended power management requirements /// to allow handheld to fully suspend. /// </summary> private static void DisableUnattendedReaderMode() { lock (rdrPowerReqHandles) { if (0 < rdrPowerReqHandles.Count) { foreach (IntPtr handle in rdrPowerReqHandles) { CoreDLL.ReleasePowerRequirement(handle); DebugLog_Log_ToDisk("Released PowerRequirement " + handle.ToString()); } rdrPowerReqHandles.Clear(); //Modify for could not turn on issue DebugLog_Log_ToDisk("Set PPN_UNATTENDEDMODE to 0"); CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, 0); //DebugLog_Log_ToDisk("Set PPN_UNATTENDEDMODE to 0"); } } }