Documentation ¶
Overview ¶
api package provides HTTP interface to expose simulator parameters and to control them via simple REST API. It contains methods used by HTTP REST server to handle queries and HTTP client functions to generate those queries. Client methods are used in CLI to provide a way to control parameters outside of TCP server. HTTP is launched together with TCP simulator server.
Index ¶
- type Api
- type Client
- func (c *Client) GetCommandDelay(commandName string) (time.Duration, error)
- func (c *Client) GetMismatch() (string, error)
- func (c *Client) GetParameter(param string) (string, error)
- func (c *Client) SetCommandDelay(commandName, value string) error
- func (c *Client) SetMismatch(value string) error
- func (c *Client) SetParameter(param, value string) error
- func (c *Client) Trigger(param string) error
- type Device
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
Struct that keeps Device interface.
func NewHttpApiServer ¶
Create new instance of http server that fullfils Device interface. Server exposes REST API to control parameters and commands settings.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Structure with client configuration.
func (*Client) GetCommandDelay ¶
Get command delay value via exposed REST API with HTTP Get query.
func (*Client) GetMismatch ¶
Get mismatch string (message that is returned when ) via exposed REST API with Get query.
func (*Client) GetParameter ¶
Get given parameter name from the simulator server via exposed REST API with HTTP GET query.
func (*Client) SetCommandDelay ¶
Set command delay via exposed REST aPI with HTTP Post query.
func (*Client) SetMismatch ¶
Set new mismatch message via exposed REST API with POST query.
func (*Client) SetParameter ¶
Set given parameter with a specified value via exposed REST API with HTTP POST query.
type Device ¶
type Device interface { GetParameter(param string) (any, error) SetParameter(param string, val any) error GetCommandDelay(commandName string) (time.Duration, error) SetCommandDelay(commandName string, val string) error GetMismatch() []byte SetMismatch(mismatch string) error Trigger(param string) error }
Interface provides methods to control parameters and commands settings via HTTP server.