stream_get_integer_property stream_set_boolean_property navigation bar

stream_get_string_property

Gets the value of the specified string property of the stream.

Description

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

Property

Access

Description

STREAM_PROPERTY_MANUFACTURER

Read only

Indicates the name of the manufacturer.

STREAM_PROPERTY_PRODUCT_NAME

Read only

Indicates the name of the product.

STREAM_PROPERTY_MODEL_NAME

Read only

Indicates the model name.

STREAM_PROPERTY_SERIAL_NUMBER

Read only

Indicates the serial number.

STREAM_PROPERTY_PEER_ADDRESS

Read only

Indicates the address of the peer. For UDP, it is the IP address of the current peer.

Prototype

t_error
stream_get_string_property(t_stream stream, const t_stream_string_property property_code, char * buffer, size_t buffer_size);
    

Parameters

t_stream stream

A stream established using stream_listen, stream_connect or stream_accept.

const t_stream_string_property * property_code

The property code of the property to be get.

char * buffer

The address of a buffer in which to store the retrieved value. The buffer must have space for at least buffer_size characters.

size_t buffer_size

The size of the buffer in characters passed to the buffer argument.

Return value

Returns 0 on success. If an error occurs then a negative error code is returned. If the protocol does not support string 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[] = "udp://localhost:18000";
const t_string 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_string_property code = { STREAM_PROPERTY_PEER_ADDRESS };
    char value[128];
    
    stream_get_string_property(client, code, value, MAX_STRING_LENGTH);
    ...
}
    

See Also

 

navigation bar