package protocol type DrawerKickoutConnectorStatus struct { IsPin3High bool } type OnlineStatus struct { IsOffline bool IsCoverOpen bool IsPaperFedByFeedButton bool IsWaitingForOnlineRecovery bool } type PaperSensorStatus struct { IsNearEnd bool IsNotPresent bool } type ErrorStatus struct { RecoverableErrorOccurred bool AutocutterErrorOccurred bool UnrecoverableErrorOccurred bool AutomaticallyRecoverableErrorOccurred bool } type PanelSwitchStatus struct { IsFeedButtonPressed bool } type ASBStatus struct { DrawerKickoutConnector DrawerKickoutConnectorStatus Online OnlineStatus Paper PaperSensorStatus Error ErrorStatus PanelSwitch PanelSwitchStatus } func (p Protocol) ParsePaperSensorStatus(status byte) PaperSensorStatus { return PaperSensorStatus{ IsNearEnd: status&0b00000011 != 0, IsNotPresent: status&0b00001100 != 0, } } func (p Protocol) ParseASBStatus(status [4]byte) ASBStatus { checkbit := func(nbyte int, nbit int) bool { return status[nbyte]&(1<