Documentation
¶
Overview ¶
Package client provides the API for io4edge I/O devices
Index ¶
- func ParseInstanceAndService(serviceAddr string) (string, string, error)
- type Channel
- type Client
- type FuncInfoDefault
- type FunctionInfo
- type ServiceInfo
- func (svcInf *ServiceInfo) AuxPort() (string, int, error)
- func (svcInf *ServiceInfo) AuxSchemaID() (string, error)
- func (svcInf *ServiceInfo) FuncClass() (string, error)
- func (svcInf *ServiceInfo) GetIPAddressPort() string
- func (svcInf *ServiceInfo) NetAddress() (string, int, error)
- func (svcInf *ServiceInfo) Security() (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel represents a connection between the host and the device used to exchange protobuf messages
func NewChannel ¶
NewChannel creates a new channel using the transport mechanism in t
func (*Channel) ReadMessage ¶
ReadMessage waits until Timeout for a new message in transport stream and decodes it via protobuf timeout of 0 waits forever
type Client ¶
type Client struct { FuncInfo FunctionInfo // contains filtered or unexported fields }
Client represents a client for an io4edge function
func NewClient ¶
func NewClient(c *Channel, funcInfo FunctionInfo) *Client
NewClient creates a new client for an io4edge function
func NewClientFromService ¶
NewClientFromService creates a new 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 function client from a socket with the specified address.
type FuncInfoDefault ¶
type FuncInfoDefault struct {
// contains filtered or unexported fields
}
FuncInfoDefault provides the default FunctionInfo implementation
func NewFuncInfoDefault ¶
func NewFuncInfoDefault(address string) *FuncInfoDefault
NewFuncInfoDefault creates a new FuncInfoDefault object with no aux port
func NewFuncInfoDefaultWithAuxPort ¶
func NewFuncInfoDefaultWithAuxPort(address string, auxPort int, auxProtocol string, auxSchemaID string) *FuncInfoDefault
NewFuncInfoDefaultWithAuxPort creates a new FuncInfoDefault object with an aux port
func (*FuncInfoDefault) AuxPort ¶
func (f *FuncInfoDefault) AuxPort() (string, int, error)
AuxPort gives the caller the auxport value of the service protocol and port
func (*FuncInfoDefault) AuxSchemaID ¶
func (f *FuncInfoDefault) AuxSchemaID() (string, error)
AuxSchemaID gives the caller the auxschema value of the service
func (*FuncInfoDefault) FuncClass ¶
func (f *FuncInfoDefault) FuncClass() (string, error)
FuncClass gives the caller the funcclass value of the service
func (*FuncInfoDefault) NetAddress ¶
func (f *FuncInfoDefault) NetAddress() (string, int, error)
NetAddress gives the caller the ip address and port of the service
func (*FuncInfoDefault) Security ¶
func (f *FuncInfoDefault) Security() (string, error)
Security gives the caller the security value of the service
type FunctionInfo ¶
type FunctionInfo interface { // NetAddress returns the IP address (or host name) and the default port of the function NetAddress() (host string, port int, err error) // FuncClass returns the class of the io4edge function: e.g. core/datalogger/controlio/ttynvt FuncClass() (class string, err error) // Security tells whether function channels use encryption (no/tls) Security() (security string, err error) // AuxPort returns the protocol of the aux port (tcp/udp) and the port // returns error if no aux port for function AuxPort() (protcol string, port int, err error) // AuxSchema returns the schema name of the aux channel // returns error if no aux port for function AuxSchemaID() (schemaID string, err error) }
FunctionInfo is an interface to query properties of the io4edge function
type ServiceInfo ¶
type ServiceInfo struct {
// contains filtered or unexported fields
}
ServiceInfo stores the avahi service struct of a service to make information about the service available through getter functions
func NewServiceInfo ¶
func NewServiceInfo(instanceName string, serviceName string, timeout time.Duration) (*ServiceInfo, error)
NewServiceInfo creates a new avahi server if necessary, browses interfaces for the specified mdns service and returns a service info object The service address consists of <instance_name>.<service_name>.<protocol> The instanceName should contain the instance name of the service address The serviceName should contain the service name of the service address together with the protocol The timeout specifies the time to wait for the service to show up
func (*ServiceInfo) AuxPort ¶
func (svcInf *ServiceInfo) AuxPort() (string, int, error)
AuxPort gives the caller the auxport value of the service protocol and port
func (*ServiceInfo) AuxSchemaID ¶
func (svcInf *ServiceInfo) AuxSchemaID() (string, error)
AuxSchemaID gives the caller the auxschema value of the service
func (*ServiceInfo) FuncClass ¶
func (svcInf *ServiceInfo) FuncClass() (string, error)
FuncClass gives the caller the funcclass value of the service
func (*ServiceInfo) GetIPAddressPort ¶
func (svcInf *ServiceInfo) GetIPAddressPort() string
GetIPAddressPort gets the ip address and port from the given service info object. It passes the caller the ip address and the port separated by ":" together in a string.
func (*ServiceInfo) NetAddress ¶
func (svcInf *ServiceInfo) NetAddress() (string, int, error)
NetAddress gives the caller the ip address and port of the service
func (*ServiceInfo) Security ¶
func (svcInf *ServiceInfo) Security() (string, error)
Security gives the caller the security value of the service