3.13 UDP (Deprecated)

3.13.1 @octave_udp/fclose

Function File: res = fclose (obj)

Closes UDP connection obj

3.13.2 @octave_udp/flush

: data = flush (dev)
: data = flush (dev, "input")
: data = flush (dev, "output")

Flush the udp socket buffers

Inputs

dev - open udp device

If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed

Outputs

None

See also: udp.

3.13.3 @octave_udp/flushinput

Loadable Function: flushinput (udp)

Flush the pending input, which will also make the BytesAvailable property be 0.

Inputs

udp - instance of octave_udp class.

Outputs

None

See also: flushoutput.

3.13.4 @octave_udp/flushoutput

Loadable Function: flushoutput (udp)

Flush the output buffer.

Inputs

udp - instance of octave_udp class.

Outputs

None

See also: flushinput.

3.13.5 @octave_udp/fopen

Function File: res = fopen (obj) (dummy)

Opens UDP connection obj This currently is a dummy function to improve compatibility to MATLAB

3.13.6 @octave_udp/fprintf

Function File: numbytes = fprintf (obj, template ...)

Writes formatted string template using optional parameters to UDP instrument

Inputs

obj is a UDP object.
template Format template string.

Outputs

numbytes is the number of bytes written to the device

3.13.7 @octave_udp/fread

Function File: data = fread (obj)
Function File: data = fread (obj, size)
Function File: data = fread (obj, size, precision)
Function File: [data,count] = fread (obj, ...)
Function File: [data,count,errmsg] = fread (obj, ...)

Reads data from UDP instrument

Inputs

obj is a UDP object.
size Number of values to read. (Default: 100).
precision precision of data.

Outputs

data data values.
count number of values read.
errmsg read operation error message.

3.13.8 @octave_udp/fwrite

Function File: numbytes = fwrite (obj, data)
Function File: numbytes = fwrite (obj, data, precision)

Writes data to UDP instrument

Inputs

obj is a UDP object.
data data to write.
precision precision of data.

Outputs

returns number of bytes written.

3.13.9 @octave_udp/get

Function File: struct = get (udp)
Function File: field = get (udp, property)

Get the properties of udp object.

Inputs

udp - instance of octave_udp class.

property - name of property.

Outputs

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.

3.13.10 @octave_udp/read

Function File: data = read (obj)
Function File: data = read (obj, size)
Function File: data = read (obj, size, datatype)

Reads data from UDP instrument

Inputs

obj is a UDP object.
size Number of values to read. (Default: BytesAvailable).
datatype datatype of data.

Outputs

data data read.

3.13.11 @octave_udp/set

Function File: set (obj, property,value)
Function File: set (obj, property,value,…)

Set the properties of udp object.

Inputs

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.

Properties

’name’

Set the name for the udp socket.

’remotehost’

Set the remote host name for the udp socket.

’remoteport’

Set the remote port for the udp socket.

’timeout’

Set the timeout value in seconds. Value of -1 means a blocking call.

Outputs

None

See also: @octave_udp/get.

3.13.12 @octave_udp/write

Function File: numbytes = write (obj, data)
Function File: numbytes = write (obj, data, destinationAddress, destinationPort))
Function File: numbytes = write (obj, data, datatype)
Function File: numbytes = write (obj, data, datatype, destinationAddress, destinationPort)

Writes data to UDP instrument

Inputs

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.

Outputs

returns number of bytes written.

3.13.13 udp

Loadable Function: udp = udp ()
Loadable Function: udp = udp (remoteipaddress, remoteport)
Loadable Function: udp = udp (remoteipaddress, remoteport, [propertyname, propertyvalue ...])

Open udp interface.

Inputs

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

Outputs

The udp() shall return instance of octave_udp class as the result udp.

Properties

The udp object has the following public properties:

name

name assigned to the udp object

type

instrument type ’udp’ (readonly)

localport

local port number (readonly)

localhost

local host address (readonly)

remoteport

remote port number

remotehost

remote host

status

status of the object ’open’ or ’closed’ (readonly)

timeout

timeout value in seconds used for waiting for data

bytesavailable

number of bytes currently available to read (readonly)

3.13.14 udp_close

Loadable Function: udp_close (udp)

Close the interface and release a file descriptor.

Inputs

udp - instance of octave_udp class.

Inputs

None

3.13.15 udp_demo

Function File: result = udp_demo ()

Run test SNTP demonstration for udp class

See also: udp.

3.13.16 udp_read

Loadable Function: [data, count] = udp_read (udp, n, timeout)

Read from udp interface.

Inputs

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

Outputs

The udp_read() shall return number of bytes successfully read in count as Integer and the bytes themselves in data as uint8 array.

3.13.17 udp_timeout

Loadable Function: udp_timeout (udp, timeout)
Loadable Function: 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.

Inputs

udp - instance of octave_udp class.
timeout - udp_read() timeout value in milliseconds. Value of -1 means a blocking call.

Outputs

If timeout parameter is omitted, the udp_timeout() shall return current timeout value as the result t.

3.13.18 udp_write

Loadable Function: n = udp_write (udp, data)

Write data to a udp interface.

Inputs

udp - instance of octave_udp class.
data - data to be written to the udp interface. Can be either of String or uint8 type.

Outputs

Upon successful completion, udp_write() shall return the number of bytes written as the result n.