fp

package module
v0.0.0-...-16fa1b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 20 Imported by: 0

README

lipFP

This is LipFP, a set of fingerprint utilities. To be honest, I'm not entirely sure if it's for a fingerprint interprinter language or an intermec printer language, and I don't care anymore. So, I'm referring to it as "fingerprint" because that's what the screen of the printer says xD

If you can help me out here, please do so. (dunno if i can be helped tho)

Use pkg.go.dev for documentation.

Usage / dokumentation go install github.com/rileys-trash-can/libfp/cmd/fputils to install.

Some of its capabilities include printing PNG/GIF/BMP images with a grayscale color model directly (printprbuf) or any other model by converting to RLL (printimg).

  • convert in.png -colormodel Gray out.png

For the run-length-encoding based PRBUF image format, see /prbuf.

(riley is cute. -polygon)

Documentation

Index

Constants

View Source
const (
	CRLF = "\r\n"
)
View Source
const (
	// Port used by most IPL compatible printers
	DefaultPort = 9100
)
View Source
const FIXOFFSET = -1

Variables

View Source
var DefaultConverter = &ImageConverter{
	Dither: true,

	Resize: ResizeOff,
}

Functions

func EncodeMsg

func EncodeMsg(msg string) []byte

readys a message to be send to the computer appends CRLF and encodes in utf8

func SubImage

func SubImage(i image.Image, w, h, offsetx, offsety int) image.Image

func T

func T[K any](c bool, a, b K) K

func UTF8encode

func UTF8encode(s string) []byte

encodes s into utf8

Types

type ImageConverter

type ImageConverter struct {
	Dither        bool
	MapColorspace bool // only works when dither is not set

	Resize Resize
}

func (*ImageConverter) Convert

func (conv *ImageConverter) Convert(i image.Image) (b []byte, err error)

converts image i to a PCX encoded image

type Printer

type Printer struct {
	Conn PrinterConn
	// contains filtered or unexported fields
}

func DialPrinter

func DialPrinter(address string) (p *Printer, err error)

address has to be specified with port

func OpenPrinter

func OpenPrinter(path string) (p *Printer, err error)

path should be that of serial device

func (*Printer) Beep

func (p *Printer) Beep(notes ...Sound) (err error)

func (*Printer) ClearCanvas

func (p *Printer) ClearCanvas(field int) (err error)

CLL [<nexp>] if field is -1 (i.e. empty) entire canvas is cleared

func (*Printer) DirectImage

func (p *Printer) DirectImage(i image.Image) (err error)

PRBUF<nexp1>[,<nexp2 ]<new line><image data>

func (*Printer) DirectPRBUF

func (p *Printer) DirectPRBUF(d []byte) (err error)

PRBUF<nexp1>[,<nexp2 ]<new line><image data>

func (*Printer) LoadImage

func (p *Printer) LoadImage(name string, i image.Image) (err error)

borked, uploads PCX data, printer no accept as image :(

func (*Printer) LoadImageByte

func (p *Printer) LoadImageByte(name string, d []byte) (err error)

only supports PCX images use LoadImage to import *image.Image s

func (*Printer) PF

func (p *Printer) PF(i uint) (err error)

func (*Printer) PRText

func (p *Printer) PRText(txt string) (err error)

func (*Printer) PrintChunked

func (printer *Printer) PrintChunked(img image.Image, xoff, yoff int) (err error)

func (*Printer) PrintPos

func (p *Printer) PrintPos(x, y int) (err error)

func (*Printer) Read

func (p *Printer) Read() (res []byte, err error)

func (*Printer) ReadResponse

func (p *Printer) ReadResponse() (res *Response, err error)

func (*Printer) Send

func (p *Printer) Send(r io.Reader) (err error)

func (*Printer) SendCommand

func (p *Printer) SendCommand(msg string) (err error)

func (*Printer) SendRaw

func (p *Printer) SendRaw(r io.Reader) (err error)

func (*Printer) WriteAll

func (p *Printer) WriteAll(d []byte) (err error)

type PrinterConn

type PrinterConn interface {
	Read(b []byte) (n int, err error)
	Write(b []byte) (n int, err error)
	Close() error
}

type Resize

type Resize uint8
const (
	ResizeOff Resize = iota
	ResizeFit
)

type Response

type Response struct {
	Command  string
	Response []string // \r\n split
	Status   string
}

func (*Response) Error

func (r *Response) Error() string

type Sound

type Sound struct {
	Freq int // in Hz
	Dur  int // in ms, step is 20ms
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL