跳转至

DLLGetParameter

函数 DLLGetParameter 按参数名称读取控制器参数值。(支持轴特定参数与任务特定参数的作用域指定。)

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

C/C++

ErrorCode DLLGetParameter(INT_PTR hClientHandle, const char* parameterName, int axisNumber, int taskNumber, char* outValue, int* inOutValueLength);

C#

ControllerParameters 门面为本版本内部 API;C# 客户请使用本 C API 读取参数。

参数

hClientHandle (INT_PTR)

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

parameterName (const char*)

参数名称字符串(如 "SERVO.RATE")。

axisNumber (int)

轴编号(0-indexed)。-1 或 0 表示不针对特定轴(如控制器级参数)。

taskNumber (int)

任务编号(1-indexed)。-1 或 0 表示不针对特定任务(如全局参数)。

outValue (char*)

输出。接收参数值字符串缓冲区。

inOutValueLength (int*)

输入输出。调用时传入缓冲区容量;返回时写入实际字符数,不含 \0。容量不足返回 StringOverflow

返回值

返回 ErrorCodeNoError (0) 表示成功,ParameterNotFound 表示参数不存在,StringOverflow 表示缓冲区不足,详见 SDK 发布头 ErrorCode.h。

说明

轴参数示例:读取轴 0 的伺服速率,axisNumber=0, taskNumber=-1。任务参数示例:读取任务 1 的编译选项,taskNumber=1, axisNumber=-1

示例

char value[64] = {0};
int len = sizeof(value);
DLLGetParameter(handle, "CountsPerUnit", 0, 0, value, &len);
printf("CountsPerUnit = %s\n", value);

相关函数