(udp)
¶Flush the pending input, which will also make the BytesAvailable property be 0.
udp - instance of octave_udp class.
None
See also: flushoutput.
(udp)
¶Flush the output buffer.
udp - instance of octave_udp class.
None
See also: flushinput.
res =
fopen (obj) (dummy)
¶Opens UDP connection obj This currently is a dummy function to improve compatibility to MATLAB
numbytes =
fprintf (obj, template ...)
¶Writes formatted string template using optional parameters to UDP instrument
obj is a UDP object.
template Format template string.
numbytes is the number of bytes written to the device
data =
fread (obj)
¶data =
fread (obj, size)
¶data =
fread (obj, size, precision)
¶[data,count] =
fread (obj, ...)
¶[data,count,errmsg] =
fread (obj, ...)
¶Reads data from UDP instrument
obj is a UDP object.
size Number of values to read. (Default: 100).
precision precision of data.
data data values.
count number of values read.
errmsg read operation error message.
struct =
get (udp)
¶field =
get (udp, property)
¶Get the properties of udp object.
udp - instance of octave_udp class.
property - name of property.
When property was specified, return the value of that property.
otherwise return the values of all properties as a structure.
See also: @octave_udp/set.
set
(obj, property,value)
¶set
(obj, property,value,…)
¶Set the properties of udp object.
obj - instance of octave_udp class.
property - name of property.
If property is a cell so must be value, it sets the values of all matching properties.
The function also accepts property-value pairs.
Set the name for the udp socket.
Set the remote host name for the udp socket.
Set the remote port for the udp socket.
Set the timeout value in seconds. Value of -1 means a blocking call.
None
See also: @octave_udp/get.
numbytes =
write (obj, data)
¶numbytes =
write (obj, data, destinationAddress, destinationPort))
¶numbytes =
write (obj, data, datatype)
¶numbytes =
write (obj, data, datatype, destinationAddress, destinationPort)
¶Writes data to UDP instrument
obj is a UDP object.
data data to write.
datatype datatype of data. If not specified defaults to uint8.
destinationAddress ipaddress to send to. If not specified, use the remote address.
destinationPort port to send to. If not specified, use the remote port.
returns number of bytes written.
udp =
udp ()
¶udp =
udp (remoteipaddress, remoteport)
¶udp =
udp (remoteipaddress, remoteport, [propertyname, propertyvalue ...])
¶Open udp interface.
remoteipaddress - the ip address of type String. If omitted defaults to ’127.0.0.1’.
remoteport - the port number to connect. If omitted defaults to 23.
localport - the local port number to bind. If omitted defaults to 0
propertyname, propertyvalue - property name/value pair
The udp() shall return instance of octave_udp class as the result udp.
The udp object has the following public properties:
name assigned to the udp object
instrument type ’udp’ (readonly)
local port number (readonly)
local host address (readonly)
remote port number
remote host
status of the object ’open’ or ’closed’ (readonly)
timeout value in seconds used for waiting for data
number of bytes currently available to read (readonly)
(udp)
¶Close the interface and release a file descriptor.
udp - instance of octave_udp class.
None
result =
udp_demo ()
¶Run test SNTP demonstration for udp class
See also: udp.
[data, count] =
udp_read (udp, n, timeout)
¶Read from udp interface.
udp - instance of octave_udp class.
n - number of bytes to attempt to read of type Integer
timeout - timeout in ms if different from default of type Integer
The udp_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array.
(udp, timeout)
¶t =
udp_timeout (udp)
¶Set new or get existing udp interface timeout parameter used for udp_read() requests. The timeout value is specified in milliseconds.
udp - instance of octave_udp class.
timeout - udp_read() timeout value in milliseconds. Value of -1 means a blocking call.
If timeout parameter is omitted, the udp_timeout() shall return current timeout value as the result t.
n =
udp_write (udp, data)
¶Write data to a udp interface.
udp - instance of octave_udp class.
data - data to be written to the udp interface. Can be either of String or uint8 type.
Upon successful completion, udp_write() shall return the number of bytes written as the result n.