跳转至

DLLDataCollectionConfigure

函数 DLLDataCollectionConfigure 配置数据采集通道、采样周期和采集模式。(调用此函数后需调用 DLLDataCollectionStart 启动采集。)

所属:C/C++ API 函数索引

C/C++

ErrorCode DLLDataCollectionConfigure(INT_PTR hClientHandle, unsigned int pointsToCollect, double samplePeriodMs, int continuous, const unsigned short* signalIds, const unsigned char* contexts, const unsigned char* indices, short channelCount);

C#

Controller.DataCollection 门面为本版本内部 API;C# 客户请使用本 C API 或 Digital Scope 应用。

参数

hClientHandle (INT_PTR)

客户端会话句柄,由 DLLSysConnect 获取。

pointsToCollect (unsigned int)

要采集的总样本点数量(continuous=0 时为有限点采集,采集满后自动停止)。

samplePeriodMs (double)

采样周期,单位毫秒。最小允许值取决于控制器固件能力。

continuous (int)

连续采集标志。非零表示连续采集模式(采集满 pointsToCollect 后覆盖最旧数据继续采集);零表示有限点采集(采集满后停止)。

signalIds (const unsigned short*)

输入。信号 ID 数组,每个通道对应一个信号 ID(定义于固件/ESI 配置)。

contexts (const unsigned char*)

输入。上下文字节数组,每个通道对应一个上下文字节。上下文语义:0=系统级,1=轴相关,2=任务相关。具体定义参见 DataCollectionModule.cpp

indices (const unsigned char*)

输入。索引数组,与 contexts 对应,指定轴编号(上下文为轴相关时)或任务编号(上下文为任务相关时)。

channelCount (short)

要采集的通道数量(即 signalIds/contexts/indices 数组中的有效元素数)。

返回值

返回 ErrorCodeNoError (0) 表示成功,正值为错误码,详见 SDK 发布头 ErrorCode.h。

说明

在调用 DLLDataCollectionConfigure 之前,DLLDataCollectionStop 应确保无正在进行的采集。每次 DLLDataCollectionConfigure 调用会重置所有通道配置。

示例

unsigned short signals[1] = {0};   /* 信号 ID */
unsigned char  contexts[1] = {0};  /* 0 = 轴上下文 */
unsigned char  indices[1]  = {0};  /* 轴 0 */
DLLDataCollectionConfigure(handle, 1000, 0.1, 0, signals, contexts, indices, 1);

相关函数