Documentation ¶
Index ¶
- type Control
- func (c *Control) Close() error
- func (c *Control) IP() (net.IP, error)
- func (c *Control) Open() error
- func (c *Control) ReceiveData() (string, error)
- func (c *Control) SendAndReceiveData(data string) (string, error)
- func (c *Control) SendData(data string) error
- func (c *Control) SendDataExpectOk(data string) error
- func (c *Control) SendDataExpectOkAsync(data string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Control ¶
type Control struct {
// contains filtered or unexported fields
}
Control handles sending commands to and receiving responses from a robot control connection.
func New ¶
New returns a new Control instance with no associated ip. The given finder will be used to detect a robot broadcasting its ip in the network.
func (*Control) Close ¶
Close tries to close the connection to the robot control port. Returns a nil error on success and a non-nil error on failure.
func (*Control) IP ¶
IP is a convenience function to get the robot ip. Returns the robot ip associated with this control instance and a nil error on success and a non-nil error on failure.
func (*Control) Open ¶
Open tries to open the connection to the robot control port. Returns a nil error on success and a non-nil error on failure.
func (*Control) ReceiveData ¶
ReceiveData reads any data available through the control connection. This is usually the result of executing a command sent with SendData(). Returns the available data and a nil error on success and a non-nil error on failure
func (*Control) SendAndReceiveData ¶
SendAndReceiveData is a convenience method to send data and get the response data at once. Returns the received data and a nil error on success and a non-nil error on failure.
func (*Control) SendData ¶
SendData sends data to the control connection. The data should be the a fully-formed plain-text SDK command. Returns a nil error on success and a non-nil error on failure.
func (*Control) SendDataExpectOk ¶
SendDataExpectOk is a convenience method to send data and make sure we got an ok response back. Returns a nil error on success and a non-nil error on failure.
func (*Control) SendDataExpectOkAsync ¶
SendDataExpectOkAsync is a convenience method to send data and check we got an ok response back. The response is received asynchronously and checked if it is ok. If it is not ok, the information is logged. Any errors when receiving the response are also logged. This should be used whenever tbe latency of receiving a reply would interfere with the program. Returns a nil error on sending success and a non-nil error on failure.