DSRemoteConnect C++ Library 1.1.3.31
Remote connection library for Dewesoft measurement applications
Loading...
Searching...
No Matches
DSRemoteConnect_Documented.h File Reference
#include "DSXInstance.h"
#include "DSXDCOMInstance.h"
#include "DSXNETInstance.h"

Go to the source code of this file.

Macros

#define DSREMOTECONNECT_API   __declspec(dllimport)

Typedefs

typedef DSXInstance * DSXInstanceHandle
 Handle to a DSX instance for connection management.
typedef ChannelInstance * ChannelInstanceHandle

Functions

DSREMOTECONNECT_API int dsconGetVersion (char *version, size_t len)
 Get the library version string.
DSREMOTECONNECT_API int dsconCreateInstance (DSXInstanceHandle *handle, int connectionType)
 Create a new DSX instance.
DSREMOTECONNECT_API int dsconConnect (DSXInstanceHandle handle, char *connectionString)
 Connect to a Dewesoft application.
DSREMOTECONNECT_API int dsconDestroyInstance (DSXInstanceHandle handle)
 Destroy a DSX instance.
DSREMOTECONNECT_API int dsconDisconnect (DSXInstanceHandle handle)
 Disconnect from Dewesoft application.
DSREMOTECONNECT_API int dsconLoadSetup (DSXInstanceHandle handle, const char *fileName)
 Load a Dewesoft setup file.
DSREMOTECONNECT_API int dsconSetAppWindowVisible (DSXInstanceHandle handle, bool visible)
 Set Dewesoft application window visibility.
DSREMOTECONNECT_API int dsconSetAppWindowState (DSXInstanceHandle handle, int state)
 Minimize, maximize or restore the Dewesoft application window.
DSREMOTECONNECT_API int dsconSetBufferSize (DSXInstanceHandle handle, int bufferSize)
 Set buffer size for data acquisition.
DSREMOTECONNECT_API int dsconGetChannelCount (DSXInstanceHandle handle, size_t *count)
 Get the total number of available channels.
DSREMOTECONNECT_API int dsconEnumerateChannels (DSXInstanceHandle handle, ChannelIdList *channelIdList, size_t *count)
 Enumerate all available channels.
DSREMOTECONNECT_API int dsconFreeEnumerateChannels (DSXInstanceHandle handle, ChannelIdList *channelIdList)
 Free memory allocated by channel enumeration.
DSREMOTECONNECT_API int dsconInitChannelIdEnum (DSXInstanceHandle handle)
 Initialize channel ID enumeration iterator.
DSREMOTECONNECT_API int dsconGetNextChannelId (DSXInstanceHandle handle, ChannelID id)
 Get next channel ID in enumeration.
DSREMOTECONNECT_API int dsconGetNextChannelIdSize (DSXInstanceHandle handle, int *size)
 Get size of next channel ID.
DSREMOTECONNECT_API int dsconCreateChannelInstance (DSXInstanceHandle handle, ChannelID id, ChannelInstanceHandle *chInstance)
 Create a channel instance by ID.
DSREMOTECONNECT_API int dsconCreateChannelInstanceByName (DSXInstanceHandle handle, char *chName, ChannelInstanceHandle *chInstance)
 Create a channel instance by name.
DSREMOTECONNECT_API int dsconCreateChannelInstanceByNameUtf8 (DSXInstanceHandle handle, const char *utf8Name, ChannelInstanceHandle *chInstance)
 Create a channel instance by UTF-8 channel name.
DSREMOTECONNECT_API int dsconFreeChannelInstance (ChannelInstanceHandle chInstance)
 Free a channel instance.
DSREMOTECONNECT_API int dsconChannelGetName (ChannelInstanceHandle channel, char *name, size_t len)
 Get channel display name.
DSREMOTECONNECT_API int dsconChannelGetNameUtf8 (ChannelInstanceHandle channel, char *name, size_t len, size_t *required)
 Get channel display name as UTF-8, with a safe buffer contract.
DSREMOTECONNECT_API int dsconGetSampleRate (ChannelInstanceHandle handle, double *sampleRate)
 Get channel sample rate.
DSREMOTECONNECT_API int dsconGetChannelType (ChannelInstanceHandle handle, int *chType)
 Get channel type.
DSREMOTECONNECT_API int dsconIsChannelControl (ChannelInstanceHandle handle, bool *result)
 Check if channel is a control channel.
DSREMOTECONNECT_API int dsconGetChUnit (ChannelInstanceHandle handle, char *resultUnit, size_t len)
 Get channel measurement unit.
DSREMOTECONNECT_API int dsconChannelSetTransferred (ChannelInstanceHandle handle, bool transferred)
 Set channel transfer state.
DSREMOTECONNECT_API int dsconIsInAqusition (DSXInstanceHandle handle, bool *value)
 Check if measurement is active.
DSREMOTECONNECT_API int dsconGetState (DSXInstanceHandle handle, int *state)
 Get the current DewesoftX application state.
DSREMOTECONNECT_API int dsconStartMeasurement (DSXInstanceHandle handle)
 Start measurement.
DSREMOTECONNECT_API int dsconStartStoring (DSXInstanceHandle handle, const char *utf8FileName)
 Start storing to a named data file.
DSREMOTECONNECT_API int dsconStopStoring (DSXInstanceHandle handle)
 Stop storing to the data file.
DSREMOTECONNECT_API int dsconStopStoringEx (DSXInstanceHandle handle, int *stateAfterStop)
 Stop storing and report whether acquisition survived.
DSREMOTECONNECT_API int dsconStopMeasurement (DSXInstanceHandle handle)
 Stop measurement.
DSREMOTECONNECT_API int dsconBeginRead (DSXInstanceHandle handle, double *startTime, double *endTime)
 Begin data reading session.
DSREMOTECONNECT_API int dsconChannelReadScalarData (ChannelInstanceHandle handle, double **data, double **timestamps, size_t *count)
 Read scalar data from channel (legacy version).
DSREMOTECONNECT_API int dsconChannelReadScalarData_2 (ChannelInstanceHandle handle, double *data, double *timestamps, size_t *count)
 Read scalar data from channel (recommended version).
DSREMOTECONNECT_API int dsconChannelReadScalarData_2abs (ChannelInstanceHandle handle, double *data, double *timestamps, size_t *count)
 Read scalar data with absolute timestamps.
DSREMOTECONNECT_API int dsconControlChannelWriteData (ChannelInstanceHandle handle, double data)
 Write data to control channel.
DSREMOTECONNECT_API int dsconEndRead (DSXInstanceHandle handle)
 End data reading session.

Variables

const std::string VER_DSREMOTE = "1.1.3.31"
 DSRemoteConnect library version string.

Macro Definition Documentation

◆ DSREMOTECONNECT_API

#define DSREMOTECONNECT_API   __declspec(dllimport)

Definition at line 125 of file DSRemoteConnect_Documented.h.

Typedef Documentation

◆ ChannelInstanceHandle

typedef ChannelInstance* ChannelInstanceHandle

Handle to a measurement channel instance

This handle represents a specific measurement channel and provides access to channel data, properties, and control capabilities.

Definition at line 159 of file DSRemoteConnect_Documented.h.

◆ DSXInstanceHandle

typedef DSXInstance* DSXInstanceHandle

Handle to a DSX instance for connection management.

This handle represents a connection to a Dewesoft application instance. It encapsulates either a DCOM or NET connection type.

Definition at line 150 of file DSRemoteConnect_Documented.h.

Function Documentation

◆ dsconBeginRead()

DSREMOTECONNECT_API int dsconBeginRead ( DSXInstanceHandle handle,
double * startTime,
double * endTime )

Begin data reading session.

Prepares the system for data reading and optionally sets time bounds.

Parameters
[in]handleDSX instance handle
[in,out]startTimePointer to start time (can be NULL for current time)
[in,out]endTimePointer to end time (can be NULL for current time)
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
Note
Always call dsconEndRead() when finished reading data
See also
dsconEndRead(), dsconChannelReadScalarData_2()

◆ dsconChannelGetName()

DSREMOTECONNECT_API int dsconChannelGetName ( ChannelInstanceHandle channel,
char * name,
size_t len )

Get channel display name.

Retrieves the human-readable name of the channel.

Parameters
[in]channelChannel instance handle
[out]nameBuffer to store channel name
[in]lenBuffer length
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_COUNT_OUT_OF_BOUNDSBuffer too small
Warning
Does NOT return DSX_COUNT_OUT_OF_BOUNDS on a short buffer - the underlying strncpy_s treats that as a runtime constraint violation and terminates the process. Names are UTF-8, so a buffer sized in characters rather than bytes overflows easily once a name contains non-ASCII text. Prefer dsconChannelGetNameUtf8().

◆ dsconChannelGetNameUtf8()

DSREMOTECONNECT_API int dsconChannelGetNameUtf8 ( ChannelInstanceHandle channel,
char * name,
size_t len,
size_t * required )

Get channel display name as UTF-8, with a safe buffer contract.

Retrieves the channel name as UTF-8 encoded bytes. Unlike dsconChannelGetName() this never overruns and never aborts: if the name does not fit it writes as much as will fit, truncating on a UTF-8 character boundary so the result is always valid UTF-8, and always NUL terminates.

Pass required to learn the buffer size the full name needs, including the terminator. That value is filled in even when the call returns DSX_COUNT_OUT_OF_BOUNDS, so a caller can size a buffer and retry, or query the size up front by passing name = NULL and len = 0.

Parameters
[in]channelChannel instance handle
[out]nameBuffer to store the UTF-8 name; may be NULL to query the size
[in]lenBuffer length in BYTES, not characters
[out]requiredOptional; receives the byte count needed including the NUL terminator. May be NULL.
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORWhole name was written
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_COUNT_OUT_OF_BOUNDSName was truncated; see required
See also
dsconCreateChannelInstanceByNameUtf8()
size_t required = 0;
char name[64];
int err = dsconChannelGetNameUtf8(channel, name, sizeof(name), &required);
{
std::vector<char> big(required);
dsconChannelGetNameUtf8(channel, big.data(), big.size(), NULL);
}
@ DSX_COUNT_OUT_OF_BOUNDS
Count parameter out of valid bounds.
DSREMOTECONNECT_API int dsconChannelGetNameUtf8(ChannelInstanceHandle channel, char *name, size_t len, size_t *required)
Get channel display name as UTF-8, with a safe buffer contract.

◆ dsconChannelReadScalarData()

DSREMOTECONNECT_API int dsconChannelReadScalarData ( ChannelInstanceHandle handle,
double ** data,
double ** timestamps,
size_t * count )

Read scalar data from channel (legacy version).

Reads measurement data and timestamps from a channel. Memory is allocated internally and must be managed carefully.

Parameters
[in]handleChannel instance handle
[out]dataPointer to store data array pointer
[out]timestampsPointer to store timestamp array pointer
[out]countPointer to store number of samples read
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NO_DATANo data available
DSX_TOO_MANY_SAMPLES_AVAILABLEMore data available than requested
Deprecated
Use dsconChannelReadScalarData_2() instead for better memory management
See also
dsconChannelReadScalarData_2()

◆ dsconChannelReadScalarData_2()

DSREMOTECONNECT_API int dsconChannelReadScalarData_2 ( ChannelInstanceHandle handle,
double * data,
double * timestamps,
size_t * count )

Read scalar data from channel (recommended version).

Reads measurement data and timestamps into user-provided buffers. This is the recommended function for data reading.

Parameters
[in]handleChannel instance handle
[out]dataPre-allocated array to store data values
[out]timestampsPre-allocated array to store timestamp values
[in,out]countInput: buffer size, Output: actual samples read
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NO_DATANo data available
DSX_TOO_MANY_SAMPLES_AVAILABLEMore data available than buffer size
Note
Timestamps are relative to measurement start time
DCOM: DewesoftX keeps a ring buffer per channel (for example 100000 samples, or 10 s at 10 kHz). If you read less often than the buffer covers, the oldest samples are lost and the next read returns the newest full buffer. Versions before 1.1.3.28 could crash when more than 65535 samples were pending.
See also
dsconBeginRead(), dsconEndRead()
double data[1000];
double timestamps[1000];
size_t count = 1000;
if (dsconChannelReadScalarData_2(channel, data, timestamps, &count) == DSX_NO_ERROR) {
for (size_t i = 0; i < count; i++) {
printf("Time: %f, Value: %f\n", timestamps[i], data[i]);
}
}
@ DSX_NO_ERROR
No error - operation successful.
DSREMOTECONNECT_API int dsconChannelReadScalarData_2(ChannelInstanceHandle handle, double *data, double *timestamps, size_t *count)
Read scalar data from channel (recommended version).

◆ dsconChannelReadScalarData_2abs()

DSREMOTECONNECT_API int dsconChannelReadScalarData_2abs ( ChannelInstanceHandle handle,
double * data,
double * timestamps,
size_t * count )

Read scalar data with absolute timestamps.

Similar to dsconChannelReadScalarData_2() but returns absolute timestamps instead of relative ones.

Parameters
[in]handleChannel instance handle
[out]dataPre-allocated array to store data values
[out]timestampsPre-allocated array to store absolute timestamp values
[in,out]countInput: buffer size, Output: actual samples read
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NO_DATANo data available
Note
Timestamps are absolute system time values
See also
dsconChannelReadScalarData_2()

◆ dsconChannelSetTransferred()

DSREMOTECONNECT_API int dsconChannelSetTransferred ( ChannelInstanceHandle handle,
bool transferred )

Set channel transfer state.

Enables or disables data transfer for the channel.

Parameters
[in]handleChannel instance handle
[in]transferredtrue to enable transfer, false to disable
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle

◆ dsconConnect()

DSREMOTECONNECT_API int dsconConnect ( DSXInstanceHandle handle,
char * connectionString )

Connect to a Dewesoft application.

Establishes connection to a Dewesoft application using the specified connection string.

Parameters
[in]handleDSX instance handle
[in]connectionStringConnection-specific string:
  • DCOM: Empty string "" for local connection
  • NET: "hostname:telnet_port:data_port" (e.g., "localhost:8999:8001")
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_INVALID_CONNECTION_STRINGInvalid connection string format
DSX_DCOM_COULD_NOT_CONNECTFailed to connect via DCOM
DSX_NET_UNABLE_TO_CONNECTFailed to connect via NET
DSX_NET_INTERFACE_VERSION_NOT_SUPPORTEDDewesoftX reports a newer NET interface version (GETINTFVERSION) than this DLL supports; the session is closed
Note
For NET connections, ensure Dewesoft is running with NET server enabled
See also
dsconDisconnect()

◆ dsconControlChannelWriteData()

DSREMOTECONNECT_API int dsconControlChannelWriteData ( ChannelInstanceHandle handle,
double data )

Write data to control channel.

Writes a control value to a control channel. The channel must be configured as a control channel in the Dewesoft setup.

Parameters
[in]handleChannel instance handle (must be control channel)
[in]dataValue to write to the control channel
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_CH_IS_NOT_CONTROLChannel is not a control channel
Note
Verify channel is a control channel using dsconIsChannelControl()
See also
dsconIsChannelControl()
bool isControl;
dsconIsChannelControl(channel, &isControl);
if (isControl) {
}
DSREMOTECONNECT_API int dsconControlChannelWriteData(ChannelInstanceHandle handle, double data)
Write data to control channel.
DSREMOTECONNECT_API int dsconIsChannelControl(ChannelInstanceHandle handle, bool *result)
Check if channel is a control channel.

◆ dsconCreateChannelInstance()

DSREMOTECONNECT_API int dsconCreateChannelInstance ( DSXInstanceHandle handle,
ChannelID id,
ChannelInstanceHandle * chInstance )

Create a channel instance by ID.

Creates a channel instance handle for accessing a specific channel. The channel ID should be obtained from enumeration functions.

Parameters
[in]handleDSX instance handle
[in]idChannel ID string
[out]chInstancePointer to store created channel instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_CHANNEL_ID_NOT_FOUNDChannel ID not found
DSX_CANNOT_MAKE_CH_INSTANCEFailed to create channel instance
Note
Always call dsconFreeChannelInstance() when done
See also
dsconFreeChannelInstance(), dsconCreateChannelInstanceByName()

◆ dsconCreateChannelInstanceByName()

DSREMOTECONNECT_API int dsconCreateChannelInstanceByName ( DSXInstanceHandle handle,
char * chName,
ChannelInstanceHandle * chInstance )

Create a channel instance by name.

Creates a channel instance handle using the channel's display name.

Parameters
[in]handleDSX instance handle
[in]chNameChannel display name
[out]chInstancePointer to store created channel instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_CHANNEL_ID_NOT_FOUNDChannel name not found
DSX_CANNOT_MAKE_CH_INSTANCEFailed to create channel instance
Note
Always call dsconFreeChannelInstance() when done
Warning
Not implemented - this entry point returns DSX_NO_ERROR without setting chInstance. Use dsconCreateChannelInstanceByNameUtf8().
See also
dsconFreeChannelInstance(), dsconCreateChannelInstance()
dsconCreateChannelInstanceByName(instance, "AI 1", &channel);
ChannelInstance * ChannelInstanceHandle
DSREMOTECONNECT_API int dsconCreateChannelInstanceByName(DSXInstanceHandle handle, char *chName, ChannelInstanceHandle *chInstance)
Create a channel instance by name.

◆ dsconCreateChannelInstanceByNameUtf8()

DSREMOTECONNECT_API int dsconCreateChannelInstanceByNameUtf8 ( DSXInstanceHandle handle,
const char * utf8Name,
ChannelInstanceHandle * chInstance )

Create a channel instance by UTF-8 channel name.

Creates a channel instance handle from the channel's display name, where the name is supplied as UTF-8 encoded bytes. Use this instead of dsconCreateChannelInstanceByName() for any name containing non-ASCII characters - degree signs, umlauts, accented or CJK characters.

The match is an exact byte comparison, so it is case sensitive and does not apply Unicode normalisation: pass the name exactly as dsconChannelGetName() reports it.

Connection type differences:

  • DCOM resolves the name through IData.FindChannel, widening it to UTF-16 first.
  • NET compares against the names from LISTUSEDCHS, which DewesoftX already sends as UTF-8, so the comparison is direct.
Parameters
[in]handleDSX instance handle
[in]utf8NameChannel display name, UTF-8 encoded, NUL terminated
[out]chInstancePointer to store created channel instance handle; set to NULL when the channel is not found
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERhandle, utf8Name or chInstance is NULL
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_DCOM_CHANNEL_ID_NOT_FOUNDNo channel with that name
DSX_DCOM_UNKNOWN_ERRORLookup failed
Note
Always call dsconFreeChannelInstance() when done
Over NET the channel list must have been fetched first, by dsconGetChannelCount() or dsconEnumerateChannels().
See also
dsconFreeChannelInstance(), dsconCreateChannelInstance()
// Source file saved as UTF-8; "Temperatur °C" is 14 bytes.
if (dsconCreateChannelInstanceByNameUtf8(instance, u8"Temperatur °C", &channel) == DSX_NO_ERROR)
{
// ... use channel ...
}
DSREMOTECONNECT_API int dsconFreeChannelInstance(ChannelInstanceHandle chInstance)
Free a channel instance.
DSREMOTECONNECT_API int dsconCreateChannelInstanceByNameUtf8(DSXInstanceHandle handle, const char *utf8Name, ChannelInstanceHandle *chInstance)
Create a channel instance by UTF-8 channel name.

◆ dsconCreateInstance()

DSREMOTECONNECT_API int dsconCreateInstance ( DSXInstanceHandle * handle,
int connectionType )

Create a new DSX instance.

Creates a new and bla bla bla instance for connecting to Dewesoft applications. The connection type determines the communication protocol used.

Parameters
[out]handlePointer to store the created instance handle
[in]connectionTypeConnection type (DSX_CONNECTION_TYPE_DCOM or DSX_CONNECTION_TYPE_NET)
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle pointer
DSX_UNKNOWN_ERRORFailed to create instance
Note
Always call dsconDestroyInstance() when done with the instance
See also
dsconDestroyInstance(), DSX_CONNECTION_TYPE

◆ dsconDestroyInstance()

DSREMOTECONNECT_API int dsconDestroyInstance ( DSXInstanceHandle handle)

Destroy a DSX instance.

Cleans up and destroys the DSX instance. This should be called for every instance created with dsconCreateInstance().

Parameters
[in]handleDSX instance handle to destroy
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
Note
Automatically disconnects if still connected
See also
dsconCreateInstance()

◆ dsconDisconnect()

DSREMOTECONNECT_API int dsconDisconnect ( DSXInstanceHandle handle)

Disconnect from Dewesoft application.

Closes the connection to the Dewesoft application while keeping the instance alive.

Parameters
[in]handleDSX instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected via DCOM
See also
dsconConnect()

◆ dsconEndRead()

DSREMOTECONNECT_API int dsconEndRead ( DSXInstanceHandle handle)

End data reading session.

Finalizes the data reading session started with dsconBeginRead().

Parameters
[in]handleDSX instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
See also
dsconBeginRead()

◆ dsconEnumerateChannels()

DSREMOTECONNECT_API int dsconEnumerateChannels ( DSXInstanceHandle handle,
ChannelIdList * channelIdList,
size_t * count )

Enumerate all available channels.

Gets a list of all channel IDs in the current setup. The returned list must be freed using dsconFreeEnumerateChannels().

Parameters
[in]handleDSX instance handle
[out]channelIdListPointer to store array of channel ID strings
[in,out]countInput: expected count, Output: actual count
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_DCOM_NO_CHANNELS_TO_ENUMERATENo channels available
Note
Always call dsconFreeEnumerateChannels() to free memory
See also
dsconFreeEnumerateChannels(), dsconGetChannelCount()
size_t count;
dsconGetChannelCount(instance, &count);
ChannelIdList channelList;
dsconEnumerateChannels(instance, &channelList, &count);
// Use channel list...
dsconFreeEnumerateChannels(instance, &channelList);
DSREMOTECONNECT_API int dsconEnumerateChannels(DSXInstanceHandle handle, ChannelIdList *channelIdList, size_t *count)
Enumerate all available channels.
DSREMOTECONNECT_API int dsconFreeEnumerateChannels(DSXInstanceHandle handle, ChannelIdList *channelIdList)
Free memory allocated by channel enumeration.
DSREMOTECONNECT_API int dsconGetChannelCount(DSXInstanceHandle handle, size_t *count)
Get the total number of available channels.

◆ dsconFreeChannelInstance()

DSREMOTECONNECT_API int dsconFreeChannelInstance ( ChannelInstanceHandle chInstance)

Free a channel instance.

Frees the memory and resources associated with a channel instance.

Parameters
[in]chInstanceChannel instance handle to free
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
See also
dsconCreateChannelInstance(), dsconCreateChannelInstanceByName()

◆ dsconFreeEnumerateChannels()

DSREMOTECONNECT_API int dsconFreeEnumerateChannels ( DSXInstanceHandle handle,
ChannelIdList * channelIdList )

Free memory allocated by channel enumeration.

Frees the memory allocated by dsconEnumerateChannels().

Parameters
[in]handleDSX instance handle
[in]channelIdListChannel ID list to free
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
See also
dsconEnumerateChannels()

◆ dsconGetChannelCount()

DSREMOTECONNECT_API int dsconGetChannelCount ( DSXInstanceHandle handle,
size_t * count )

Get the total number of available channels.

Returns the number of channels available in the current setup.

Parameters
[in]handleDSX instance handle
[out]countPointer to store channel count
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
See also
dsconEnumerateChannels()

◆ dsconGetChannelType()

DSREMOTECONNECT_API int dsconGetChannelType ( ChannelInstanceHandle handle,
int * chType )

Get channel type.

Returns the channel type (async, sync, or single value).

Parameters
[in]handleChannel instance handle
[out]chTypePointer to store channel type (DSX_CH_TYPE)
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
See also
DSX_CH_TYPE

◆ dsconGetChUnit()

DSREMOTECONNECT_API int dsconGetChUnit ( ChannelInstanceHandle handle,
char * resultUnit,
size_t len )

Get channel measurement unit.

Returns the physical unit of measurement for the channel (e.g., "V", "A", "°C").

Parameters
[in]handleChannel instance handle
[out]resultUnitBuffer to store unit string
[in]lenBuffer length
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_COUNT_OUT_OF_BOUNDSBuffer too small

◆ dsconGetNextChannelId()

DSREMOTECONNECT_API int dsconGetNextChannelId ( DSXInstanceHandle handle,
ChannelID id )

Get next channel ID in enumeration.

Retrieves the next channel ID in the enumeration sequence.

Parameters
[in]handleDSX instance handle
[out]idBuffer to store channel ID (must be pre-allocated)
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess - channel ID retrieved
DSX_END_OF_ENUMNo more channels
DSX_NULL_HANDLERInvalid handle
Note
Use dsconGetNextChannelIdSize() to determine required buffer size
See also
dsconInitChannelIdEnum(), dsconGetNextChannelIdSize()

◆ dsconGetNextChannelIdSize()

DSREMOTECONNECT_API int dsconGetNextChannelIdSize ( DSXInstanceHandle handle,
int * size )

Get size of next channel ID.

Returns the buffer size needed for the next channel ID in enumeration.

Parameters
[in]handleDSX instance handle
[out]sizePointer to store required buffer size
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_END_OF_ENUMNo more channels
DSX_NULL_HANDLERInvalid handle
See also
dsconGetNextChannelId(), dsconInitChannelIdEnum()

◆ dsconGetSampleRate()

DSREMOTECONNECT_API int dsconGetSampleRate ( ChannelInstanceHandle handle,
double * sampleRate )

Get channel sample rate.

Returns the sample rate of the channel in Hz.

Parameters
[in]handleChannel instance handle
[out]sampleRatePointer to store sample rate value
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle

◆ dsconGetState()

DSREMOTECONNECT_API int dsconGetState ( DSXInstanceHandle handle,
int * state )

Get the current DewesoftX application state.

Reports which screen DewesoftX is currently on: Channel setup, a running acquisition, an acquisition that has been stopped, or Analysis.

While acquisition runs and DewesoftX stores to a data file, the state is DSX_STATE_STORING instead of DSX_STATE_ACQUISITION. A running acquisition is therefore either of these two values. With a storing trigger, the state is DSX_STATE_STORING as soon as storing is armed, before data is written.

Connection type differences:

  • DCOM reads IApp.ActualRunMode, IApp.MeasureMenuIndex and IApp.StoreEngine.Storing directly.
  • NET issues the GETSTATUS telnet command and parses the reply. The reply text is translated by DewesoftX, so NET returns DSX_STATE_UNKNOWN when the DewesoftX UI language is not English. During acquisition it also issues ISSTORING to detect DSX_STATE_STORING.
Parameters
[in]handleDSX instance handle
[out]statePointer to store the state, a DSX_STATE value
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_DCOM_UNKNOWN_ERRORFailed to query the state
int state = 0;
if (dsconGetState(instance, &state) == DSX_NO_ERROR &&
(state == DSX_STATE_ACQUISITION || state == DSX_STATE_STORING))
printf("acquiring\n");
@ DSX_STATE_ACQUISITION
Acquisition running - measurement is live.
@ DSX_STATE_STORING
Storing - acquisition is running and DewesoftX is storing to a data file (or armed on a storing trigg...
DSREMOTECONNECT_API int dsconGetState(DSXInstanceHandle handle, int *state)
Get the current DewesoftX application state.
See also
DSX_STATE

◆ dsconGetVersion()

DSREMOTECONNECT_API int dsconGetVersion ( char * version,
size_t len )

Get the library version string.

Parameters
[out]versionBuffer to store version string
[in]lenLength of the buffer
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_COUNT_OUT_OF_BOUNDSBuffer too small
char version[50];
dsconGetVersion(version, sizeof(version));
printf("DSRemoteConnect version: %s\n", version);
DSREMOTECONNECT_API int dsconGetVersion(char *version, size_t len)
Get the library version string.

◆ dsconInitChannelIdEnum()

DSREMOTECONNECT_API int dsconInitChannelIdEnum ( DSXInstanceHandle handle)

Initialize channel ID enumeration iterator.

Initializes an iterator for sequential channel enumeration. Use with dsconGetNextChannelId() and dsconGetNextChannelIdSize().

Parameters
[in]handleDSX instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
See also
dsconGetNextChannelId(), dsconGetNextChannelIdSize()

◆ dsconIsChannelControl()

DSREMOTECONNECT_API int dsconIsChannelControl ( ChannelInstanceHandle handle,
bool * result )

Check if channel is a control channel.

Determines whether the channel can be used for writing control data.

Parameters
[in]handleChannel instance handle
[out]resultPointer to store result (true if control channel)
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
See also
dsconControlChannelWriteData()

◆ dsconIsInAqusition()

DSREMOTECONNECT_API int dsconIsInAqusition ( DSXInstanceHandle handle,
bool * value )

Check if measurement is active.

Determines whether a measurement is currently running.

Parameters
[in]handleDSX instance handle
[out]valuePointer to store result (true if measuring)
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected

◆ dsconLoadSetup()

DSREMOTECONNECT_API int dsconLoadSetup ( DSXInstanceHandle handle,
const char * fileName )

Load a Dewesoft setup file.

Loads a .dxs setup file into the connected Dewesoft application. This configures channels, sample rates, and other measurement parameters.

Parameters
[in]handleDSX instance handle
[in]fileNamePath to the .dxs setup file, UTF-8 encoded. Text that is not valid UTF-8 is read in the system ANSI code page.
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_DCOM_UNKNOWN_ERRORDewesoftX could not load the file (DCOM), for example the file does not exist or acquisition is running
DSX_NET_SETUP_NOT_FOUNDSetup file not found (NET connection)
Note
The setup file must be accessible by the Dewesoft application
DCOM: a relative path is resolved against the current directory of the calling process when the file exists there. Otherwise DewesoftX resolves a bare file name against its own setup folder.
NET: the path is resolved on the DewesoftX computer.
dsconLoadSetup(instance, "C:\\Measurements\\MySetup.dxs");
DSREMOTECONNECT_API int dsconLoadSetup(DSXInstanceHandle handle, const char *fileName)
Load a Dewesoft setup file.

◆ dsconSetAppWindowState()

DSREMOTECONNECT_API int dsconSetAppWindowState ( DSXInstanceHandle handle,
int state )

Minimize, maximize or restore the Dewesoft application window.

Parameters
[in]handleDSX instance handle
[in]stateA DSX_WINDOW_STATE value
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_COUNT_OUT_OF_BOUNDSstate is not a DSX_WINDOW_STATE value
DSX_DCOM_UNKNOWN_ERRORDewesoftX did not return its window handle
DSX_NET_COMMAND_NOT_SUPPORTEDNot available on a NET connection
Note
DCOM only. DSX_WINDOW_NORMAL and DSX_WINDOW_MAXIMIZED also bring the window to the foreground.
Since
1.1.3.29
@ DSX_WINDOW_MAXIMIZED
Maximize the window.
DSREMOTECONNECT_API int dsconSetAppWindowState(DSXInstanceHandle handle, int state)
Minimize, maximize or restore the Dewesoft application window.

◆ dsconSetAppWindowVisible()

DSREMOTECONNECT_API int dsconSetAppWindowVisible ( DSXInstanceHandle handle,
bool visible )

Set Dewesoft application window visibility.

Shows or hides the Dewesoft application window.

Parameters
[in]handleDSX instance handle
[in]visibletrue to show window, false to hide
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected

◆ dsconSetBufferSize()

DSREMOTECONNECT_API int dsconSetBufferSize ( DSXInstanceHandle handle,
int bufferSize )

Set buffer size for data acquisition.

Configures the internal buffer size used for data acquisition. Larger buffers can handle higher data rates but use more memory.

Parameters
[in]handleDSX instance handle
[in]bufferSizeBuffer size in samples
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
Note
Call before starting measurement for best results

◆ dsconStartMeasurement()

DSREMOTECONNECT_API int dsconStartMeasurement ( DSXInstanceHandle handle)

Start measurement.

Begins data acquisition on all configured channels.

Parameters
[in]handleDSX instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_NET_STARTACQ_FAILEDFailed to start acquisition (NET)
Note
Ensure setup is loaded and channels are configured before starting
See also
dsconStopMeasurement(), dsconLoadSetup()

◆ dsconStartStoring()

DSREMOTECONNECT_API int dsconStartStoring ( DSXInstanceHandle handle,
const char * utf8FileName )

Start storing to a named data file.

Starts storing measurement data to utf8FileName. DewesoftX starts acquisition itself if it is not already running, so this can be called either before or after dsconStartMeasurement().

A bare file name is resolved against DewesoftX's own data directory. Pass an empty string to let DewesoftX apply its configured file-name settings instead.

Connection type differences:

  • DCOM calls IApp.StartStoring, widening the name to UTF-16. A name that includes a path is used as given; only a bare name gets the data directory prepended.
  • NET sends STARTSTORE <name>. Here the name is always relative to the data directory - a path will not be honoured. DewesoftX also splits that payload on '|' to separate the file name from a store host, so a name containing '|' is rejected with DSX_START_STORING_FAILED rather than silently truncated.
Parameters
[in]handleDSX instance handle
[in]utf8FileNameData file name, UTF-8 encoded, NUL terminated
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORStoring started
DSX_NULL_HANDLERhandle or utf8FileName is NULL
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_START_STORING_FAILEDDewesoftX refused to start storing - it is in Analysis mode, already storing, out of disk space, could not start acquisition, or the name contained '|'
Note
Use dsconStopStoring() to stop storing while acquisition keeps running, or dsconStopMeasurement() to stop both.
See also
dsconStopStoring(), dsconStartMeasurement(), dsconGetState()
if (dsconStartStoring(instance, "run_2026_08_06") != DSX_NO_ERROR)
printf("could not start storing\n");
DSREMOTECONNECT_API int dsconStartStoring(DSXInstanceHandle handle, const char *utf8FileName)
Start storing to a named data file.

◆ dsconStopMeasurement()

DSREMOTECONNECT_API int dsconStopMeasurement ( DSXInstanceHandle handle)

Stop measurement.

Stops the current measurement session.

Parameters
[in]handleDSX instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORSuccess
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_NET_STOPPING_ACQ_FAILEDFailed to stop acquisition (NET)
See also
dsconStartMeasurement()

◆ dsconStopStoring()

DSREMOTECONNECT_API int dsconStopStoring ( DSXInstanceHandle handle)

Stop storing to the data file.

Closes the data file that dsconStartStoring() opened. Acquisition normally keeps running, so storing can be started again into a new file without restarting the measurement.

Connection type differences:

  • DCOM calls IApp.StopStoring, which is a no-op when nothing is being stored, so the call succeeds either way.
  • NET sends STOPSTORE, which reports an error when nothing is being stored. Ignore DSX_STOP_STORING_FAILED when stopping opportunistically, since it does not distinguish "was not storing" from a real failure.
Parameters
[in]handleDSX instance handle
Returns
DX_ERROR_CODE
Return values
DSX_NO_ERRORStoring stopped
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_STOP_STORING_FAILEDDewesoftX refused to stop storing - it is in Analysis mode, nothing was being stored, or cameras are active and acquisition must be stopped instead
Warning
Acquisition does not always survive this call: if DewesoftX is configured to stop acquisition after storing, or if video is enabled, stopping storing stops the measurement too. Use dsconStopStoringEx() when the distinction matters.
See also
dsconStopStoringEx(), dsconStartStoring(), dsconStopMeasurement()
dsconStartStoring(instance, "run_2026_08_06");
// ... acquire ...
dsconStopStoring(instance);
DSREMOTECONNECT_API int dsconStopStoring(DSXInstanceHandle handle)
Stop storing to the data file.

◆ dsconStopStoringEx()

DSREMOTECONNECT_API int dsconStopStoringEx ( DSXInstanceHandle handle,
int * stateAfterStop )

Stop storing and report whether acquisition survived.

Same as dsconStopStoring(), but additionally reports the state DewesoftX ended up in, so the caller can tell whether acquisition is still running or the measurement stopped outright.

This exists because DewesoftX, not the caller, decides that outcome. Its StopAcqAfterStopStore setting turns stop-storing into a full stop, and so do active cameras. Neither is exposed over DCOM or NET, so there is nothing to query or configure ahead of time - the state afterwards is the only reliable answer.

Interpret stateAfterStop as:

Parameters
[in]handleDSX instance handle
[out]stateAfterStopOptional; receives a DSX_STATE value sampled after the stop. May be NULL. Set even when the stop itself failed.
Returns
the same DX_ERROR_CODE as dsconStopStoring()
Return values
DSX_NO_ERRORStoring stopped
DSX_NULL_HANDLERInvalid handle
DSX_DCOM_NOT_CONNECTEDNot connected
DSX_STOP_STORING_FAILEDDewesoftX refused to stop storing
Note
The state is sampled immediately after the stop. If DewesoftX is still winding down, a transient value is possible; poll dsconGetState() if you need to be certain.
See also
dsconStopStoring(), dsconGetState(), dsconStartStoring()
int state = DSX_STATE_UNKNOWN;
dsconStopStoringEx(instance, &state);
if (state == DSX_STATE_ACQUISITION)
dsconStartStoring(instance, "next_file"); // still acquiring
else
dsconStartMeasurement(instance); // measurement went down too
@ DSX_STATE_UNKNOWN
State could not be determined (start screen, or a NET reply that could not be parsed - see dsconGetSt...
DSREMOTECONNECT_API int dsconStartMeasurement(DSXInstanceHandle handle)
Start measurement.
DSREMOTECONNECT_API int dsconStopStoringEx(DSXInstanceHandle handle, int *stateAfterStop)
Stop storing and report whether acquisition survived.

Variable Documentation

◆ VER_DSREMOTE

const std::string VER_DSREMOTE = "1.1.3.31"

DSRemoteConnect library version string.

Definition at line 141 of file DSRemoteConnect_Documented.h.