mertech_qr

package module
v0.0.61 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

GoLang package for working with Mertech QR-Pay via serial port

Supported commands:

methods
Connect
Disconnect
ScreenClear
CheckFirmware
ShowPicOk
ShowPicFalse
EnableBluetooth
DisableBluetooth
ScreenOn
ScreenOff
ShowQr

usage

var err error

mertech := NewMertechQr(&serial.Config{
    Name:        "COM3",
    Baud:        SpeedBaud,         // 115200
    ReadTimeout: time.Second,
    Size:        DataBits,          // 8 byte
    StopBits:    serial.Stop1,      // 1
    Parity:      serial.ParityNone, // 0
})

err = mertech.Connect()

bytes, err := mertech.ShowQr()

err = mertech.Disconnect()

Documentation

Index

Constants

View Source
const (
	DataBits  byte = 8
	SpeedBaud      = 115200
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name        string
	Baud        int
	ReadTimeout time.Duration // Total timeout

	// Size is the number of data bits. If 0, DefaultSize is used.
	Size byte

	// Parity is the bit to use and defaults to ParityNone (no parity bit).
	Parity serial.Parity

	// Number of stop bits to use. Default is 1 (1 stop bit).
	StopBits serial.StopBits
}

type MertechQr

type MertechQr struct {
	// contains filtered or unexported fields
}

func NewMertechQr

func NewMertechQr(conf *Config) *MertechQr

func (*MertechQr) CheckFirmware

func (m *MertechQr) CheckFirmware() ([]byte, error)

func (*MertechQr) Connect

func (m *MertechQr) Connect() error

func (*MertechQr) DisableBluetooth

func (m *MertechQr) DisableBluetooth() (int, error)

func (*MertechQr) Disconnect

func (m *MertechQr) Disconnect() error

func (*MertechQr) EnableBluetooth

func (m *MertechQr) EnableBluetooth() (int, error)

func (*MertechQr) ScreenClear

func (m *MertechQr) ScreenClear() (int, error)

func (*MertechQr) ScreenOff

func (m *MertechQr) ScreenOff() (int, error)

ScreenOff In my case, when working with windows, after disabling the display, the device changes the com port

func (*MertechQr) ScreenOn

func (m *MertechQr) ScreenOn() (int, error)

func (*MertechQr) ShowPicFalse

func (m *MertechQr) ShowPicFalse() (int, error)

func (*MertechQr) ShowPicOk

func (m *MertechQr) ShowPicOk() (int, error)

func (*MertechQr) ShowQr

func (m *MertechQr) ShowQr(qrText string) (int, error)

Jump to

Keyboard shortcuts

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