Documentation ¶
Overview ¶
Package core provides the API for the io4edge core functions i.e. firmware and hardware id management
Index ¶
- func AssertFirmwareIsCompatibleWithHardware(fwHw string, fwMajorRevs []int, hwName string, hwMajor int) error
- type Client
- func (c *Client) Command(cmd *api.CoreCommand, res *api.CoreResponse, timeout time.Duration) error
- func (c *Client) GetPersistentParameter(name string, timeout time.Duration) (value string, err error)
- func (c *Client) IdentifyFirmware(timeout time.Duration) (name string, version string, err error)
- func (c *Client) IdentifyHardware(timeout time.Duration) (name string, major uint32, serial string, err error)
- func (c *Client) LoadFirmware(file string, chunkSize uint, timeout time.Duration, ...) (restartingNow bool, err error)
- func (c *Client) LoadFirmwareBinary(r *bufio.Reader, chunkSize uint, timeout time.Duration, ...) (restartingNow bool, err error)
- func (c *Client) LoadFirmwareBinaryFromFile(file string, chunkSize uint, timeout time.Duration, ...) (restartingNow bool, err error)
- func (c *Client) ProgramHardwareIdentification(name string, major uint32, serial string, timeout time.Duration) error
- func (c *Client) ReadPartition(timeout time.Duration, partitionName string, offset uint32, w *bufio.Writer, ...) (err error)
- func (c *Client) ResetReason(timeout time.Duration) (reason string, err error)
- func (c *Client) Restart(timeout time.Duration) (restartingNow bool, err error)
- func (c *Client) SetPersistentParameter(name string, value string, timeout time.Duration) error
- func (c *Client) StreamLogs(streamTimeout time.Duration, infoCb func(msg string)) (io.ReadCloser, error)
- type FirmwareAlreadyPresentError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client for the io4edge core function
func NewClientFromService ¶
NewClientFromService creates a new core function client from a socket with a address, which was acquired from the specified service. The timeout specifies the maximal time waiting for a service to show up.
func NewClientFromSocketAddress ¶
NewClientFromSocketAddress creates a new core function client from a socket with the specified address.
func (*Client) Command ¶
func (c *Client) Command(cmd *api.CoreCommand, res *api.CoreResponse, timeout time.Duration) error
Command issues a command cmd to a core function channel, waits for the devices response and returns it in res
func (*Client) GetPersistentParameter ¶
func (c *Client) GetPersistentParameter(name string, timeout time.Duration) (value string, err error)
GetPersistentParameter reads a persistent parameter from the device
func (*Client) IdentifyFirmware ¶
IdentifyFirmware gets the firmware name and version from the device
func (*Client) IdentifyHardware ¶
func (c *Client) IdentifyHardware(timeout time.Duration) (name string, major uint32, serial string, err error)
IdentifyHardware gets the hardware inventory data from the device
func (*Client) LoadFirmware ¶
func (c *Client) LoadFirmware(file string, chunkSize uint, timeout time.Duration, prog func(bytes uint, msg string)) (restartingNow bool, err error)
LoadFirmware loads a binary from a firmware package to the device. Checks first if the firmware is compatible with the device. Checks then if the device's firmware version is the same timeout is for each chunk
func (*Client) LoadFirmwareBinary ¶
func (c *Client) LoadFirmwareBinary(r *bufio.Reader, chunkSize uint, timeout time.Duration, prog func(bytes uint, msg string)) (restartingNow bool, err error)
LoadFirmwareBinary loads new firmware via r into the device device prog is a callback function that gets called after loading a chunk. The callback gets passed the number of bytes transferred yet timeout is for each chunk
func (*Client) LoadFirmwareBinaryFromFile ¶
func (c *Client) LoadFirmwareBinaryFromFile(file string, chunkSize uint, timeout time.Duration, prog func(bytes uint, msg string)) (restartingNow bool, err error)
LoadFirmwareBinaryFromFile loads new firmware from file into the device device timeout is for each chunk
func (*Client) ProgramHardwareIdentification ¶
func (c *Client) ProgramHardwareIdentification(name string, major uint32, serial string, timeout time.Duration) error
ProgramHardwareIdentification programs hardware inventory data into the device. Intended to be used during hardware manufacturing process only
func (*Client) ReadPartition ¶ added in v1.7.0
func (c *Client) ReadPartition(timeout time.Duration, partitionName string, offset uint32, w *bufio.Writer, prog func(bytes uint, msg string)) (err error)
ReadPartition reads a partition from the device and writes it to the given writer
func (*Client) ResetReason ¶ added in v1.7.0
ResetReason gets the last reset reason from the device
func (*Client) SetPersistentParameter ¶
SetPersistentParameter writes a persistent parameter into the device
func (*Client) StreamLogs ¶ added in v1.8.0
func (c *Client) StreamLogs(streamTimeout time.Duration, infoCb func(msg string)) (io.ReadCloser, error)
StreamLogs streams the device log streamTimeout is the timeout after which the stream is assumed to be dead and the connection is reestablished infoCb is a callback function that is called with status information (such as connection, stream errors) It returns an io.ReadCloser that can be used to read the log stream
type FirmwareAlreadyPresentError ¶
type FirmwareAlreadyPresentError struct { }
FirmwareAlreadyPresentError is returned by LoadFirmware as a dummy error
func (*FirmwareAlreadyPresentError) Error ¶
func (e *FirmwareAlreadyPresentError) Error() string
Error returns the error string for FirmwareAlreadyPresentError