Sha256: 1bf960f47ba6990fe51bedcdfa38d2c3ac5baa59e3dcfb604594e38e63d4a608

Contents?: true

Size: 1.61 KB

Versions: 71

Compression:

Stored size: 1.61 KB

Contents

module Extface
  class Driver::GenericPos < Extface::Driver
    NAME = 'Generic Pos Printer (Serial)'.freeze
    GROUP = Extface::PRINT_DRIVER
    
    DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
    
    # Select driver features
    RAW = true  #responds to #push(data) and #pull
    PRINT = true #POS, slip printers
    FISCAL = false #cash registers, fiscal printers
    REPORT = false #only transmit data that must be parsed by handler, CDR, report devices    
    
    has_serial_config
    alias_method :print, :push
    
    def print_test_page(times = 1)
      device.session("Print Test Page") do |s|
        times.times do |t|
        s.notify "Printing Test Page #{t}"
        s.print "******************************\r\n*"
        s.print "Extface Print Test #{t}".center(28)
        s.print "*\r\n******************************\r\n"

        s.notify "Printing driver information"
        s.print "\r\nDriver:\r\n"
        s.print "------------------------------\r\n"
        s.print "#{self.class::NAME}".truncate(30)
        s.print "\r\n"

        if try(:serial?)
          s.notify "Printing serial settings"
          s.print "\r\nSerial Port Settings:\r\n"
          s.print "------------------------------\r\n"
        end

        s.print "\r\n"
        s.print "------------------------------\r\n"
        s.print Time.now.strftime("Printed on %m/%d/%Y %T\r\n").rjust(32)
        s.print "\r\n\r\n"
        s.notify "Printing finished"
        
        s.try :autocut
        end
      end
    end
    
    def check_status
      return true #just pass
    end
    
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
extface-0.2.5 app/models/extface/driver/generic_pos.rb
extface-0.2.4 app/models/extface/driver/generic_pos.rb
extface-0.2.3 app/models/extface/driver/generic_pos.rb
extface-0.2.2 app/models/extface/driver/generic_pos.rb
extface-0.2.1 app/models/extface/driver/generic_pos.rb
extface-0.2.0 app/models/extface/driver/generic_pos.rb
extface-0.1.9 app/models/extface/driver/generic_pos.rb
extface-0.1.8 app/models/extface/driver/generic_pos.rb
extface-0.1.7 app/models/extface/driver/generic_pos.rb
extface-0.1.6 app/models/extface/driver/generic_pos.rb
extface-0.1.5 app/models/extface/driver/generic_pos.rb