Sha256: f8a5b2436aae9ea8c8a9e3e52b777381102ed2e1d98d9298e6a317c98309b30a

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 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)

    CAN_RECEŠ”VE_DATA = true #pull from server
    CAN_TRANSMIT_DATA = true #push to server
    
    # 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
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
extface-0.1.2 app/models/extface/driver/generic_pos.rb
extface-0.1.1 app/models/extface/driver/generic_pos.rb