3.14 UDP Port

3.14.1 @octave_udpport/configureMulticast

: data = configureMulticast((dev, address)
: data = configureMulticast((dev, "off")

Configure udpport device to receive multicast data

Inputs

dev - open udpport device

If address is ’off’ disable udp multicast. Otherwise it is the multicast address to use.

Outputs

None

See also: udpport.

3.14.2 @octave_udpport/configureTerminator

Function File: configureTerminator (udp, term)
Function File: configureTerminator (udp, readterm, writeterm)

Set terminator for ASCII string manipulation

Inputs

udp - udpport object
term - terminal value for both read and write
readterm = terminal value type for read data
writeterm = terminal value for written data

The terminal can be either strings "cr", "lf" (default), "lf/cr" or an integer between 0 to 255.

Outputs

None

See also: udpport.

3.14.3 @octave_udpport/flush

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

Flush the udpport socket buffers

Inputs

dev - open udpport 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: udpport.

3.14.4 @octave_udpport/fprintf

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

Writes formatted string template using optional parameters to UDP instrument

Inputs

obj is a UDPPort object.
template Format template string.

Outputs

numbytes is the number of bytes written to the device

3.14.5 @octave_udpport/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 port 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.14.6 @octave_udpport/fwrite

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

Writes data to UDP instrument

Inputs

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

Outputs

returns number of bytes written.

3.14.7 @octave_udpport/get

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

Get the properties of udpport object.

Inputs

udpport - instance of octave_udpport 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_udpport/set.

3.14.8 @octave_udpport/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.14.9 @octave_udpport/set

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

Set the properties of udpport object.

Inputs

obj - instance of octave_udpport 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 udpport socket.

’UserData’

Set the user data of the object.

’Timeout’

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

Outputs

None

See also: @octave_udpport/get.

3.14.10 @octave_udpport/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 UDPPort 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 previously used remote address.
destinationPort port to send to. If not specified, use the remote port.

Outputs

returns number of bytes written.

3.14.11 @octave_udpport/writeline

: writeline (dev, data)
: writeline (dev, data, destaddr, destport)

Write data to a udpport including terminator value

Inputs

dev - connected device

data - ASCII data to write

destaddr - Destination address

destport - Destination port

Where the address and port is not specified, the previously used address and port is used.

Outputs

None

See also: flushoutput.

3.14.12 udpport

Loadable Function: udp = udpport ()
Loadable Function: udp = udpport (propertyname, propertyvalue ...)

Open udpport interface.

Inputs

propertyname, propertyvalue - property name/value pair

Known input properties:

Name

name assigned to the udp object

LocalPort

local port number

LocalHost

local host address

Timeout

timeout value in seconds used for waiting for data

EnablePortSharing

Boolean if the socket has port sharing enabled (readonly)

Outputs

The udpport() 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 ’udpport’ (readonly)

LocalPort

local port number (readonly)

LocalHost

local host address (readonly)

Status

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

Timeout

timeout value in seconds used for waiting for data

NumBytesAvailable

number of bytes currently available to read (readonly)

MulticastGroup

multicast group socket is subscribed to (readonly)

EnableMultcast

Boolean if the socket has any multicast group it is subscribed to (readonly)

EnablePortSharing

Boolean if the socket has port sharing enabled (readonly)

Terminator

Terminator value used for string data (currently not used)