Table of Contents
stream_set_string_property
Sets the value of the specified string property of the stream.
Description
This function sets 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_set_string_property(t_stream stream, const t_stream_string_property property_code, const 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 set.
const char * buffer
The address of the string value. The string should be null-terminated.
size_t buffer_size
The maximum number of characters to assign to the string property from the buffer.
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[] = "shmem://foobar:1"; 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 = { 128 }; /* a custom string property */ const char * value = "secret code"; stream_set_string_property(client, code, value, MAX_STRING_LENGTH); ... }
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.