public override SiDriverState Receive(SiMessageQueue queue, ICommWriter writer, SiHandler siHandler) { SiMessage message = PollAnswer(queue, SiMessage.GET_SYSTEM_VALUE); si6_192PunchesMode = (message.Sequence(6) & 0xFF) == 0xFF; GecoSiLogger.Info("SiCard6 192 Punches Mode " + (si6_192PunchesMode ? "Enabled" : "Disabled")); return(STARTUP_COMPLETE.Send(writer, siHandler)); }
protected int ExtractNumberOfDataBlocks(SiMessage firstBlock, int nbPunchesIndex) { int nbPunches = firstBlock.Sequence(nbPunchesIndex) & 0xFF; int nbPunchesPerBlock = 32; int nbPunchDataBlocks = (nbPunches / nbPunchesPerBlock) + Math.Min(1, nbPunches % nbPunchesPerBlock); GecoSiLogger.Info(String.Format("Nb punches/Data blocks: {0}/{1}", nbPunches, nbPunchDataBlocks)); return(nbPunchDataBlocks + 1); }
public override SiDriverState Receive(SiMessageQueue queue, ICommWriter writer, SiHandler siHandler) { try { PollAnswer(queue, SiMessage.SI_CARD_REMOVED); return(DISPATCH_READY); } catch (TimeoutException e) { GecoSiLogger.Info("Timeout on SiCard removal"); return(DISPATCH_READY); } catch (InvalidMessage e) { return(ErrorFallback(siHandler, "Invalid message: " + e.ReceivedMessage())); } }