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, prog func(bytes uint)) (restartingNow bool, err error)
- func (c *Client) LoadFirmwareBinary(r *bufio.Reader, chunkSize uint, timeout time.Duration, prog func(bytes uint)) (restartingNow bool, err error)
- func (c *Client) LoadFirmwareBinaryFromFile(file string, chunkSize uint, timeout time.Duration, prog func(bytes uint)) (restartingNow bool, err error)
- func (c *Client) ProgramHardwareIdentification(name string, major uint32, serial string, timeout time.Duration) error
- func (c *Client) Restart(timeout time.Duration) (restartingNow bool, err error)
- func (c *Client) SetPersistentParameter(name string, value string, timeout time.Duration) 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)) (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)) (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)) (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
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