stream_set_boolean_property stream_set_integer_property navigation bar

stream_set_double_property

Sets the values of the specified double properties of the stream.

Description

This function sets the values of the specified double properties. Not all protocol drivers support double properties. If the protocol does not support double properties then calling this function will return -QERR_NOT_SUPPORTED. If a particular double property is not recognized then it will return -QERR_PROPERTY_NOT_RECOGNIZED.

The stream property functions allow more flexibility in controlling the behaviour of the underlying protocol.

Protocols may have custom double properties. However, there are a set of standard double properties which are listed below:

Property

Access

Description

STREAM_PROPERTY_BYTES_READ_PER_SECOND

Read only

The number of bytes per second read from the stream.

STREAM_PROPERTY_BYTES_WRITTEN_PER_SECOND

Read only

The number of bytes per second written to the stream.

Prototype

t_error
stream_set_double_property(t_stream stream, const t_stream_double_property properties[], t_uint num_properties, const t_double buffer[]);
    

Parameters

t_stream stream

A stream established using stream_listen, stream_connect or stream_accept.

const t_stream_double_property * properties

An array of property codes containing the properties to be set.

t_uint num_properties

The number of property codes in the properties array.

const t_double * buffer

An array of property values containing the values to which to set the properties. The value at a particular index corresponds to the property code at the same index in the properties array.

Return value

Returns 0 on success. If an error occurs then a negative error code is returned. If the protocol does not support double properties then -QERR_NOT_SUPPORTED is returned. If a property code is not recognized then it will return -QERR_PROPERTY_NOT_RECOGNIZED.

Error codes

This function does not return any error code.

Requirements

Include Files

Libraries

quanser_stream.h

quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

Examples

t_stream client;

const char uri[] = "shmem://foobar:1";
const t_double nonblocking = false;
const t_int send_buffer_size = 8000;
const t_int receive_buffer_size = 8000;

result = stream_connect(uri, nonblocking, send_buffer_size, receive_buffer_size, &client);
if (result == 0) {
    t_stream_double_property codes = { 128 }; /* custom double property */
    t_double values[] = { 3.1415926 };
    
    stream_set_double_property(client, codes, ARRAY_LENGTH(codes), values);
    ...
}
    

See Also

 

navigation bar