package ql import ( "fmt" "io" "strings" ) // Status is a decoder for the status packed returned by the printer. type Status [32]byte func (s *Status) MediaWidthMM() int { return int(s[10]) } func (s *Status) MediaLengthMM() int { return int(s[17]) } type StatusType byte const ( StatusTypeReplyToRequest StatusType = 0x00 StatusTypePrintingCompleted = 0x01 StatusTypeErrorOccurred = 0x02 StatusTypeTurnedOff = 0x04 StatusTypeNotification = 0x05 StatusTypePhaseChange = 0x06 ) func (s *Status) Type() StatusType { return StatusType(s[18]) } type StatusPhase byte const ( StatusPhaseReceiving StatusPhase = 0x00 StatusPhasePrinting = 0x01 ) func (s *Status) Phase() StatusPhase { return StatusPhase(s[19]) } func decodeBitfieldErrors(b byte, errors [8]string) []string { var result []string for i := uint(0); i < 8; i++ { if b&(1<