stream_get_boolean_property stream_get_integer_property navigation bar

Table of Contents

stream_get_double_property

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

Description

This function gets 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_get_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 retrieved.

t_uint num_properties

The number of property codes in the properties array.

const t_double * buffer

An array in which to store the property values retrieved. 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 = { STREAM_PROPERTY_BYTES_READ_PER_SECOND };
    t_double values[ARRAY_LENGTH(codes)];
    
    stream_get_double_property(client, codes, ARRAY_LENGTH(codes), values);
    ...
}
    

See Also

 

navigation bar