Documentation
¶
Index ¶
Constants ¶
View Source
const ( // EOL is a CRLF. EOL = "\r\n" // A Prompt is emitted on each line of output. Prompt = '>' )
Variables ¶
View Source
var ( CommandMachineSN = Int64(100) CommandControlVersion = Int64(101) CommandMachineModel = Int64(102) CommandMode = Int64(104) CommandToolChanges = Int64(200) CommandToolNumber = Int64(201) CommandPowerOnTime = Int64(300) CommandMotionTime = Int64(301) CommandLastCycleTime = Int64(303) CommandPreviousCycleTime = Int64(304) CommandPartsCounter1 = Int64(402) CommandPartsCounter2 = Int64(403) CommandThreeInOne = Int64(500) CommandMacroVariable = Int64(600) )
These basic commands are defined in Haas Mill Operator's Manual.
Functions ¶
func ScanPrompt ¶ added in v0.2.1
ScanPrompt is a bufio.ScanFunc that reads each line of text and strips any Prompt prefix characters.
func WritePrompt ¶ added in v0.2.1
func WritePrompt(w WriteFlusher) error
WritePrompt writes a prompt to the output and then flushes it.
func WriteResponse ¶ added in v0.2.1
func WriteResponse(w WriteFlusher, format string, args ...any) error
WriteResponse writes a complete response message line to the output, followed by a new prompt, and flushes.
Types ¶
type Message ¶
type Message interface {
fmt.Stringer
slog.LogValuer
Buffer() ([]byte, bool)
Command() (Number, bool)
Value() (Number, bool)
Variable() (Number, bool)
// IsSafe returns true if the message is unlikely to cause damage to the MDC
// receiver.
IsSafe() bool
// IsWrite returns true if the message writes to a remote variable.
IsWrite() bool
// WriteTo implements [io.WriterTo].
WriteTo(out io.Writer) (int64, error)
// contains filtered or unexported methods
}
A Message is a Machine Data Collection message.
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
A Number represents a fixed-point decimal value.
func ParseNumber ¶
ParseNumber validates the input is numeric.
func (Number) Format ¶
Format implements io.Formatter.
type WriteFlusher ¶ added in v0.2.1
WriteFlusher is implemented by bufio.Writer, for example.
Click to show internal directories.
Click to hide internal directories.