diagnostic

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package diagnostic runs Modbus FC43 (Read Device Identification) and SunSpec common-model probes against a TCP-502 endpoint. It returns whatever vendor / model strings the device self-reports — driver matching is not done here (it lives in the web app).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FC43Result

type FC43Result struct {
	OK          bool   `json:"ok"`
	VendorName  string `json:"vendor_name,omitempty"`
	ProductCode string `json:"product_code,omitempty"`
	Revision    string `json:"revision,omitempty"`
	ProductName string `json:"product_name,omitempty"`
	ModelName   string `json:"model_name,omitempty"`
	SlaveID     byte   `json:"slave_id"`
	Error       string `json:"error,omitempty"`
}

FC43Result contains what FC43 (Read Device Identification) reports.

func ProbeFC43

func ProbeFC43(host string, port int, slaveIDs []byte) FC43Result

ProbeFC43 tries Modbus FC43 (Read Device Identification) at the given host/port across a small list of candidate slave IDs and returns the first successful read. Pass slaveIDs == nil to use the default {1,0,247}.

type SunSpecResult

type SunSpecResult struct {
	OK           bool   `json:"ok"`
	Manufacturer string `json:"manufacturer,omitempty"`
	Model        string `json:"model,omitempty"`
	Serial       string `json:"serial,omitempty"`
	Version      string `json:"version,omitempty"`
	BaseAddress  uint16 `json:"base_address,omitempty"`
	SlaveID      byte   `json:"slave_id"`
	Error        string `json:"error,omitempty"`
}

SunSpecResult contains what the SunSpec common model reports.

func ProbeSunSpec

func ProbeSunSpec(host string, port int, slaveIDs []byte) SunSpecResult

ProbeSunSpec tries SunSpec common-model discovery at the given host/port. Pass slaveIDs == nil to use the default {1,0,247}.

type TCPResult

type TCPResult struct {
	Success  bool   `json:"success"`
	Duration string `json:"duration"`
	Error    string `json:"error,omitempty"`
}

TCPResult contains the result of a TCP connectivity test.

func TestTCP

func TestTCP(host string, port int) TCPResult

TestTCP tests TCP connectivity to the given host:port.

Jump to

Keyboard shortcuts

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