stream_set_double_property stream_set_string_property navigation bar

Table of Contents

stream_set_integer_property

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

Description

This function sets the values of the specified integer properties. Not all protocol drivers support integer properties. If the protocol does not support integer properties then calling this function will return -QERR_NOT_SUPPORTED. If a particular integer 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 integer properties. However, there are a set of standard integer properties which are listed below:

Property

Access

Description

STREAM_PROPERTY_BYTES_READ

Read only

The number of bytes read by the stream.

STREAM_PROPERTY_BYTES_WRITTEN

Read only

The number of bytes written to the stream.

Prototype

t_error
stream_set_integer_property(t_stream stream, const t_stream_integer_property properties[], t_uint num_properties, const t_int buffer[]);
    

Parameters

t_stream stream

A stream established using stream_listen, stream_connect or stream_accept.

const t_stream_integer_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_int * 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 integer 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_int 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_integer_property codes = { 128 }; /* a custom integer property */
    t_int values[] = { 123 };
    
    stream_set_integer_property(client, codes, ARRAY_LENGTH(codes), values);
    ...
}
    

See Also

 

navigation bar