Sha256: ccec345d841dd5f779746213afb01f57d6ad0254bb00646e172cdae377c99573

Contents?: true

Size: 437 Bytes

Versions: 1

Compression:

Stored size: 437 Bytes

Contents

require 'socket'

class BTPR880 < Thermal::Printer

  ESC = "\033"
  CODES = {
    :bold => ESC+"E",
    :underline => ESC+"-"
  }
  TRANSLATE = {
    :strong => [CODES[:bold]+"1", CODES[:bold]+"0"],
    :u => [CODES[:underline]+"1", CODES[:underline]+"0"],
  }

  def self.translate
    TRANSLATE
  end

  def self.print(ip, port=9001, &block)
    sock = TCPSocket.new(ip, port)
    yield sock if block_given?
    sock.close
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thermal-0.1.0 lib/devices/btpr880.rb