core

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package core provides the API for the io4edge core functions i.e. firmware and hardware id management

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertFirmwareIsCompatibleWithHardware

func AssertFirmwareIsCompatibleWithHardware(fwHw string, fwMajorRevs []int, hwName string, hwMajor int) error

AssertFirmwareIsCompatibleWithHardware checks if the firmware specified by fwHw and fwMajorRevs is compatible with hardware hwName, hwMajor

Types

type Client

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

Client represents a client for the io4edge core function

func NewClient

func NewClient(c *client.Client) *Client

NewClient creates a new client for the core function from the function client c

func NewClientFromService

func NewClientFromService(serviceAddr string, timeout time.Duration) (*Client, error)

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

func NewClientFromSocketAddress(address string) (*Client, error)

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

func (c *Client) IdentifyFirmware(timeout time.Duration) (name string, version string, err error)

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

func (*Client) Restart

func (c *Client) Restart(timeout time.Duration) (restartingNow bool, err error)

Restart performs a device restart

func (*Client) SetPersistentParameter

func (c *Client) SetPersistentParameter(name string, value string, timeout time.Duration) error

SetPersistentParameter writes a persistent parameter into the device

type FirmwareAlreadyPresentError

type FirmwareAlreadyPresentError struct {
}

FirmwareAlreadyPresentError is returned by LoadFirmware as a dummy error

func (*FirmwareAlreadyPresentError) Error

Error returns the error string for FirmwareAlreadyPresentError

Jump to

Keyboard shortcuts

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