cas

package
v0.0.0-...-002a662 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessJSON

func ProcessJSON(buf []byte) ([]byte, error)

ProcessJSON starts execution of the steps described in JSON

Types

type Cas

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

Cas lib context

func Connect

func Connect(addr string) (Cas, error)

Connect to scale

func (Cas) Disconnect

func (c Cas) Disconnect() error

Close connection

func (Cas) DownloadPLU

func (c Cas) DownloadPLU(scaleID uint32, data PLUData) error

DownloadPLU send PLUData to scale

func (Cas) ErasePLU

func (c Cas) ErasePLU(scaleID uint32, departmentNumber uint16, PLUNumber uint32) error

ErasePLU delete one PLU or all if departmentNumber = 0 and PLUNumber = 0

func (Cas) GetStatus

func (c Cas) GetStatus(scaleID uint32) (Status, error)

GetStatus returns current scale state

func (Cas) UploadPLU

func (c Cas) UploadPLU(scaleID uint32, number uint32) (PLUData, error)

UploadPLU requests data from scale

type PLUData

type PLUData struct {
	DepartmentNumber       uint16         // 0
	PLUNumber              uint32         // 2
	PLUType                uint8          // 6
	PLUName1               PLUName1String // 7
	PLUName2               [40]byte       // 47
	PLUName3               [5]byte        // 87
	GroupNumber            uint16         // 92
	LabelNumber            uint16         // 94
	AuxLabelNumber         uint16         // 96
	OriginNumber           uint16         // 98
	UnitWeightNumber       uint8          // 100
	FixedWeight            uint32         // 101
	ItemCode               uint32         // 105
	PCSQuntity             uint16         // 109 !!! keyboard key index !!!
	PCSQuntitySymbolNumber uint8          // 111
	UseFixPriceType        uint8          // 112
	UnitPrice              uint32         // 113
	SpecialPrice           uint32         // 117
	TareWeight             uint32         // 121
	TareNumber             uint8          // 125
	BarcodeNumber          uint16         // 126
	AuxBarcodeNumber       uint16         // 128
	ProducedDate           uint16         // 130
	PackedDate             uint16         // 132
	PackedTime             uint8          // 134
	SellByDate             uint32         // 135
	SellByTime             uint8          // 139
	MessageNumber          uint16         // 140
	Reserved0              uint16         // 142
	Reserved1              uint16         // 144
	SaleMessageNumber      uint8          // 146
}

PLUData contains all product info

type PLUName1String

type PLUName1String [40]byte

PLUName1String is a special type of Name1

func (PLUName1String) MarshalJSON

func (s PLUName1String) MarshalJSON() ([]byte, error)

MarshalJSON decode Name3 from windows1251 to utf-8

func (*PLUName1String) UnmarshalJSON

func (s *PLUName1String) UnmarshalJSON(data []byte) error

UnmarshalJSON encode Name1 from utf-8 to windows1251

type PLUName2String

type PLUName2String [40]byte

PLUName2String is a special type of Name2

func (PLUName2String) MarshalJSON

func (s PLUName2String) MarshalJSON() ([]byte, error)

MarshalJSON decode Name3 from windows1251 to utf-8

func (*PLUName2String) UnmarshalJSON

func (s *PLUName2String) UnmarshalJSON(data []byte) error

UnmarshalJSON encode Name2 from utf-8 to windows1251

type PLUName3String

type PLUName3String [5]byte

PLUName3String is a special type of Name3

func (PLUName3String) MarshalJSON

func (s PLUName3String) MarshalJSON() ([]byte, error)

MarshalJSON decode Name3 from windows1251 to utf-8

func (*PLUName3String) UnmarshalJSON

func (s *PLUName3String) UnmarshalJSON(data []byte) error

UnmarshalJSON encode Name3 from utf-8 to windows1251

type Status

type Status struct {
	LoadFlag           uint8 // 0: Zero 1: Non zero 2: Overload
	StableFlag         uint8 // 0: Unstable 1: Stable
	TareFlag           uint8
	DualRage           uint8
	WeightUnit         uint8
	WeightDecimalPoint uint8
	PriceDecimalPoint  uint8
	Reserved           uint8
	Tare               uint32
	Weight             int32
	UnitPrice          uint32
	TotalPrice         uint32
	PLUNumber          uint32
	DepartmentNumber   uint16
}

Status Protocol Structure

Jump to

Keyboard shortcuts

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