Skip to content

Commit

Permalink
Add calibration info reflection API support (#1034)
Browse files Browse the repository at this point in the history
* Add calibration info reflection API support

* removed shunt cal and offset nulling APIs
  • Loading branch information
WayneDroid authored Jan 17, 2024
1 parent 7258df1 commit ac40787
Show file tree
Hide file tree
Showing 11 changed files with 316 additions and 4 deletions.
23 changes: 23 additions & 0 deletions generated/nidaqmx/nidaqmx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ service NiDAQmx {
rpc GetExportedSignalAttributeInt32(GetExportedSignalAttributeInt32Request) returns (GetExportedSignalAttributeInt32Response);
rpc GetExportedSignalAttributeString(GetExportedSignalAttributeStringRequest) returns (GetExportedSignalAttributeStringResponse);
rpc GetExportedSignalAttributeUInt32(GetExportedSignalAttributeUInt32Request) returns (GetExportedSignalAttributeUInt32Response);
rpc GetExtCalLastDateAndTime(GetExtCalLastDateAndTimeRequest) returns (GetExtCalLastDateAndTimeResponse);
rpc GetFirstSampClkWhen(GetFirstSampClkWhenRequest) returns (GetFirstSampClkWhenResponse);
rpc GetFirstSampTimestampVal(GetFirstSampTimestampValRequest) returns (GetFirstSampTimestampValResponse);
rpc GetNthTaskChannel(GetNthTaskChannelRequest) returns (GetNthTaskChannelResponse);
Expand Down Expand Up @@ -300,6 +301,7 @@ service NiDAQmx {
rpc ResetTrigAttribute(ResetTrigAttributeRequest) returns (ResetTrigAttributeResponse);
rpc ResetWatchdogAttribute(ResetWatchdogAttributeRequest) returns (ResetWatchdogAttributeResponse);
rpc ResetWriteAttribute(ResetWriteAttributeRequest) returns (ResetWriteAttributeResponse);
rpc RestoreLastExtCalConst(RestoreLastExtCalConstRequest) returns (RestoreLastExtCalConstResponse);
rpc SaveGlobalChan(SaveGlobalChanRequest) returns (SaveGlobalChanResponse);
rpc SaveScale(SaveScaleRequest) returns (SaveScaleResponse);
rpc SaveTask(SaveTaskRequest) returns (SaveTaskResponse);
Expand Down Expand Up @@ -7311,6 +7313,19 @@ message GetExportedSignalAttributeUInt32Response {
uint32 value = 2;
}

message GetExtCalLastDateAndTimeRequest {
string device_name = 1;
}

message GetExtCalLastDateAndTimeResponse {
int32 status = 1;
uint32 year = 2;
uint32 month = 3;
uint32 day = 4;
uint32 hour = 5;
uint32 minute = 6;
}

message GetFirstSampClkWhenRequest {
nidevice_grpc.Session task = 1;
}
Expand Down Expand Up @@ -8880,6 +8895,14 @@ message ResetWriteAttributeResponse {
int32 status = 1;
}

message RestoreLastExtCalConstRequest {
string device_name = 1;
}

message RestoreLastExtCalConstResponse {
int32 status = 1;
}

message SaveGlobalChanRequest {
nidevice_grpc.Session task = 1;
string channel_name = 2;
Expand Down
34 changes: 34 additions & 0 deletions generated/nidaqmx/nidaqmx_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5478,6 +5478,23 @@ get_exported_signal_attribute_uint32(const StubPtr& stub, const nidevice_grpc::S
return response;
}

GetExtCalLastDateAndTimeResponse
get_ext_cal_last_date_and_time(const StubPtr& stub, const std::string& device_name)
{
::grpc::ClientContext context;

auto request = GetExtCalLastDateAndTimeRequest{};
request.set_device_name(device_name);

auto response = GetExtCalLastDateAndTimeResponse{};

raise_if_error(
stub->GetExtCalLastDateAndTime(&context, request, &response),
context);

return response;
}

GetFirstSampClkWhenResponse
get_first_samp_clk_when(const StubPtr& stub, const nidevice_grpc::Session& task)
{
Expand Down Expand Up @@ -8321,6 +8338,23 @@ reset_write_attribute(const StubPtr& stub, const nidevice_grpc::Session& task, c
return response;
}

RestoreLastExtCalConstResponse
restore_last_ext_cal_const(const StubPtr& stub, const std::string& device_name)
{
::grpc::ClientContext context;

auto request = RestoreLastExtCalConstRequest{};
request.set_device_name(device_name);

auto response = RestoreLastExtCalConstResponse{};

raise_if_error(
stub->RestoreLastExtCalConst(&context, request, &response),
context);

return response;
}

SaveGlobalChanResponse
save_global_chan(const StubPtr& stub, const nidevice_grpc::Session& task, const std::string& channel_name, const std::string& save_as, const std::string& author, const simple_variant<SaveOptions, pb::uint32>& options)
{
Expand Down
2 changes: 2 additions & 0 deletions generated/nidaqmx/nidaqmx_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ GetExportedSignalAttributeDoubleResponse get_exported_signal_attribute_double(co
GetExportedSignalAttributeInt32Response get_exported_signal_attribute_int32(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant<ExportSignalInt32Attribute, pb::int32>& attribute);
GetExportedSignalAttributeStringResponse get_exported_signal_attribute_string(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant<ExportSignalStringAttribute, pb::int32>& attribute);
GetExportedSignalAttributeUInt32Response get_exported_signal_attribute_uint32(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant<ExportSignalUInt32Attribute, pb::int32>& attribute);
GetExtCalLastDateAndTimeResponse get_ext_cal_last_date_and_time(const StubPtr& stub, const std::string& device_name);
GetFirstSampClkWhenResponse get_first_samp_clk_when(const StubPtr& stub, const nidevice_grpc::Session& task);
GetFirstSampTimestampValResponse get_first_samp_timestamp_val(const StubPtr& stub, const nidevice_grpc::Session& task);
GetNthTaskChannelResponse get_nth_task_channel(const StubPtr& stub, const nidevice_grpc::Session& task, const pb::uint32& index);
Expand Down Expand Up @@ -305,6 +306,7 @@ ResetTimingAttributeExResponse reset_timing_attribute_ex(const StubPtr& stub, co
ResetTrigAttributeResponse reset_trig_attribute(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant<TriggerResetAttribute, pb::int32>& attribute);
ResetWatchdogAttributeResponse reset_watchdog_attribute(const StubPtr& stub, const nidevice_grpc::Session& task, const std::string& lines, const simple_variant<WatchdogResetAttribute, pb::int32>& attribute);
ResetWriteAttributeResponse reset_write_attribute(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant<WriteResetAttribute, pb::int32>& attribute);
RestoreLastExtCalConstResponse restore_last_ext_cal_const(const StubPtr& stub, const std::string& device_name);
SaveGlobalChanResponse save_global_chan(const StubPtr& stub, const nidevice_grpc::Session& task, const std::string& channel_name, const std::string& save_as, const std::string& author, const simple_variant<SaveOptions, pb::uint32>& options);
SaveScaleResponse save_scale(const StubPtr& stub, const std::string& scale_name, const std::string& save_as, const std::string& author, const simple_variant<SaveOptions, pb::uint32>& options);
SaveTaskResponse save_task(const StubPtr& stub, const nidevice_grpc::Session& task, const std::string& save_as, const std::string& author, const simple_variant<SaveOptions, pb::uint32>& options);
Expand Down
10 changes: 10 additions & 0 deletions generated/nidaqmx/nidaqmx_compilation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,11 @@ int32 GetExportedSignalAttributeUInt32(TaskHandle task, int32 attribute, uInt32*
return DAQmxGetExportedSignalAttribute(task, attribute, value);
}

int32 GetExtCalLastDateAndTime(const char deviceName[], uInt32* year, uInt32* month, uInt32* day, uInt32* hour, uInt32* minute)
{
return DAQmxGetExtCalLastDateAndTime(deviceName, year, month, day, hour, minute);
}

int32 GetFirstSampClkWhen(TaskHandle task, CVIAbsoluteTime* data)
{
return DAQmxGetFirstSampClkWhen(task, data);
Expand Down Expand Up @@ -1422,6 +1427,11 @@ int32 ResetWriteAttribute(TaskHandle task, int32 attribute)
return DAQmxResetWriteAttribute(task, attribute);
}

int32 RestoreLastExtCalConst(const char deviceName[])
{
return DAQmxRestoreLastExtCalConst(deviceName);
}

int32 SaveGlobalChan(TaskHandle task, const char channelName[], const char saveAs[], const char author[], uInt32 options)
{
return DAQmxSaveGlobalChan(task, channelName, saveAs, author, options);
Expand Down
18 changes: 18 additions & 0 deletions generated/nidaqmx/nidaqmx_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr<nidevice_grpc::SharedLibraryInter
function_pointers_.GetExportedSignalAttributeInt32 = reinterpret_cast<GetExportedSignalAttributeInt32Ptr>(shared_library_->get_function_pointer("DAQmxGetExportedSignalAttribute"));
function_pointers_.GetExportedSignalAttributeString = reinterpret_cast<GetExportedSignalAttributeStringPtr>(shared_library_->get_function_pointer("DAQmxGetExportedSignalAttribute"));
function_pointers_.GetExportedSignalAttributeUInt32 = reinterpret_cast<GetExportedSignalAttributeUInt32Ptr>(shared_library_->get_function_pointer("DAQmxGetExportedSignalAttribute"));
function_pointers_.GetExtCalLastDateAndTime = reinterpret_cast<GetExtCalLastDateAndTimePtr>(shared_library_->get_function_pointer("DAQmxGetExtCalLastDateAndTime"));
function_pointers_.GetExtendedErrorInfo = reinterpret_cast<GetExtendedErrorInfoPtr>(shared_library_->get_function_pointer("DAQmxGetExtendedErrorInfo"));
function_pointers_.GetFirstSampClkWhen = reinterpret_cast<GetFirstSampClkWhenPtr>(shared_library_->get_function_pointer("DAQmxGetFirstSampClkWhen"));
function_pointers_.GetFirstSampTimestampVal = reinterpret_cast<GetFirstSampTimestampValPtr>(shared_library_->get_function_pointer("DAQmxGetFirstSampTimestampVal"));
Expand Down Expand Up @@ -311,6 +312,7 @@ NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr<nidevice_grpc::SharedLibraryInter
function_pointers_.ResetTrigAttribute = reinterpret_cast<ResetTrigAttributePtr>(shared_library_->get_function_pointer("DAQmxResetTrigAttribute"));
function_pointers_.ResetWatchdogAttribute = reinterpret_cast<ResetWatchdogAttributePtr>(shared_library_->get_function_pointer("DAQmxResetWatchdogAttribute"));
function_pointers_.ResetWriteAttribute = reinterpret_cast<ResetWriteAttributePtr>(shared_library_->get_function_pointer("DAQmxResetWriteAttribute"));
function_pointers_.RestoreLastExtCalConst = reinterpret_cast<RestoreLastExtCalConstPtr>(shared_library_->get_function_pointer("DAQmxRestoreLastExtCalConst"));
function_pointers_.SaveGlobalChan = reinterpret_cast<SaveGlobalChanPtr>(shared_library_->get_function_pointer("DAQmxSaveGlobalChan"));
function_pointers_.SaveScale = reinterpret_cast<SaveScalePtr>(shared_library_->get_function_pointer("DAQmxSaveScale"));
function_pointers_.SaveTask = reinterpret_cast<SaveTaskPtr>(shared_library_->get_function_pointer("DAQmxSaveTask"));
Expand Down Expand Up @@ -1737,6 +1739,14 @@ int32 NiDAQmxLibrary::GetExportedSignalAttributeUInt32(TaskHandle task, int32 at
return function_pointers_.GetExportedSignalAttributeUInt32(task, attribute, value);
}

int32 NiDAQmxLibrary::GetExtCalLastDateAndTime(const char deviceName[], uInt32* year, uInt32* month, uInt32* day, uInt32* hour, uInt32* minute)
{
if (!function_pointers_.GetExtCalLastDateAndTime) {
throw nidevice_grpc::LibraryLoadException("Could not find DAQmxGetExtCalLastDateAndTime.");
}
return function_pointers_.GetExtCalLastDateAndTime(deviceName, year, month, day, hour, minute);
}

int32 NiDAQmxLibrary::GetExtendedErrorInfo(char errorString[], uInt32 bufferSize)
{
if (!function_pointers_.GetExtendedErrorInfo) {
Expand Down Expand Up @@ -2705,6 +2715,14 @@ int32 NiDAQmxLibrary::ResetWriteAttribute(TaskHandle task, int32 attribute)
return function_pointers_.ResetWriteAttribute(task, attribute);
}

int32 NiDAQmxLibrary::RestoreLastExtCalConst(const char deviceName[])
{
if (!function_pointers_.RestoreLastExtCalConst) {
throw nidevice_grpc::LibraryLoadException("Could not find DAQmxRestoreLastExtCalConst.");
}
return function_pointers_.RestoreLastExtCalConst(deviceName);
}

int32 NiDAQmxLibrary::SaveGlobalChan(TaskHandle task, const char channelName[], const char saveAs[], const char author[], uInt32 options)
{
if (!function_pointers_.SaveGlobalChan) {
Expand Down
6 changes: 6 additions & 0 deletions generated/nidaqmx/nidaqmx_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
int32 GetExportedSignalAttributeInt32(TaskHandle task, int32 attribute, int32* value) override;
int32 GetExportedSignalAttributeString(TaskHandle task, int32 attribute, char value[], uInt32 size) override;
int32 GetExportedSignalAttributeUInt32(TaskHandle task, int32 attribute, uInt32* value) override;
int32 GetExtCalLastDateAndTime(const char deviceName[], uInt32* year, uInt32* month, uInt32* day, uInt32* hour, uInt32* minute) override;
int32 GetExtendedErrorInfo(char errorString[], uInt32 bufferSize) override;
int32 GetFirstSampClkWhen(TaskHandle task, CVIAbsoluteTime* data) override;
int32 GetFirstSampTimestampVal(TaskHandle task, CVIAbsoluteTime* data) override;
Expand Down Expand Up @@ -305,6 +306,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
int32 ResetTrigAttribute(TaskHandle task, int32 attribute) override;
int32 ResetWatchdogAttribute(TaskHandle task, const char lines[], int32 attribute) override;
int32 ResetWriteAttribute(TaskHandle task, int32 attribute) override;
int32 RestoreLastExtCalConst(const char deviceName[]) override;
int32 SaveGlobalChan(TaskHandle task, const char channelName[], const char saveAs[], const char author[], uInt32 options) override;
int32 SaveScale(const char scaleName[], const char saveAs[], const char author[], uInt32 options) override;
int32 SaveTask(TaskHandle task, const char saveAs[], const char author[], uInt32 options) override;
Expand Down Expand Up @@ -579,6 +581,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
using GetExportedSignalAttributeInt32Ptr = decltype(&DAQmxGetExportedSignalAttribute);
using GetExportedSignalAttributeStringPtr = decltype(&DAQmxGetExportedSignalAttribute);
using GetExportedSignalAttributeUInt32Ptr = decltype(&DAQmxGetExportedSignalAttribute);
using GetExtCalLastDateAndTimePtr = decltype(&DAQmxGetExtCalLastDateAndTime);
using GetExtendedErrorInfoPtr = int32 (*)(char errorString[], uInt32 bufferSize);
using GetFirstSampClkWhenPtr = decltype(&DAQmxGetFirstSampClkWhen);
using GetFirstSampTimestampValPtr = decltype(&DAQmxGetFirstSampTimestampVal);
Expand Down Expand Up @@ -700,6 +703,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
using ResetTrigAttributePtr = decltype(&DAQmxResetTrigAttribute);
using ResetWatchdogAttributePtr = decltype(&DAQmxResetWatchdogAttribute);
using ResetWriteAttributePtr = decltype(&DAQmxResetWriteAttribute);
using RestoreLastExtCalConstPtr = decltype(&DAQmxRestoreLastExtCalConst);
using SaveGlobalChanPtr = decltype(&DAQmxSaveGlobalChan);
using SaveScalePtr = decltype(&DAQmxSaveScale);
using SaveTaskPtr = decltype(&DAQmxSaveTask);
Expand Down Expand Up @@ -974,6 +978,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
GetExportedSignalAttributeInt32Ptr GetExportedSignalAttributeInt32;
GetExportedSignalAttributeStringPtr GetExportedSignalAttributeString;
GetExportedSignalAttributeUInt32Ptr GetExportedSignalAttributeUInt32;
GetExtCalLastDateAndTimePtr GetExtCalLastDateAndTime;
GetExtendedErrorInfoPtr GetExtendedErrorInfo;
GetFirstSampClkWhenPtr GetFirstSampClkWhen;
GetFirstSampTimestampValPtr GetFirstSampTimestampVal;
Expand Down Expand Up @@ -1095,6 +1100,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
ResetTrigAttributePtr ResetTrigAttribute;
ResetWatchdogAttributePtr ResetWatchdogAttribute;
ResetWriteAttributePtr ResetWriteAttribute;
RestoreLastExtCalConstPtr RestoreLastExtCalConst;
SaveGlobalChanPtr SaveGlobalChan;
SaveScalePtr SaveScale;
SaveTaskPtr SaveTask;
Expand Down
2 changes: 2 additions & 0 deletions generated/nidaqmx/nidaqmx_library_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class NiDAQmxLibraryInterface {
virtual int32 GetExportedSignalAttributeInt32(TaskHandle task, int32 attribute, int32* value) = 0;
virtual int32 GetExportedSignalAttributeString(TaskHandle task, int32 attribute, char value[], uInt32 size) = 0;
virtual int32 GetExportedSignalAttributeUInt32(TaskHandle task, int32 attribute, uInt32* value) = 0;
virtual int32 GetExtCalLastDateAndTime(const char deviceName[], uInt32* year, uInt32* month, uInt32* day, uInt32* hour, uInt32* minute) = 0;
virtual int32 GetExtendedErrorInfo(char errorString[], uInt32 bufferSize) = 0;
virtual int32 GetFirstSampClkWhen(TaskHandle task, CVIAbsoluteTime* data) = 0;
virtual int32 GetFirstSampTimestampVal(TaskHandle task, CVIAbsoluteTime* data) = 0;
Expand Down Expand Up @@ -295,6 +296,7 @@ class NiDAQmxLibraryInterface {
virtual int32 ResetTrigAttribute(TaskHandle task, int32 attribute) = 0;
virtual int32 ResetWatchdogAttribute(TaskHandle task, const char lines[], int32 attribute) = 0;
virtual int32 ResetWriteAttribute(TaskHandle task, int32 attribute) = 0;
virtual int32 RestoreLastExtCalConst(const char deviceName[]) = 0;
virtual int32 SaveGlobalChan(TaskHandle task, const char channelName[], const char saveAs[], const char author[], uInt32 options) = 0;
virtual int32 SaveScale(const char scaleName[], const char saveAs[], const char author[], uInt32 options) = 0;
virtual int32 SaveTask(TaskHandle task, const char saveAs[], const char author[], uInt32 options) = 0;
Expand Down
2 changes: 2 additions & 0 deletions generated/nidaqmx/nidaqmx_mock_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class NiDAQmxMockLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
MOCK_METHOD(int32, GetExportedSignalAttributeInt32, (TaskHandle task, int32 attribute, int32* value), (override));
MOCK_METHOD(int32, GetExportedSignalAttributeString, (TaskHandle task, int32 attribute, char value[], uInt32 size), (override));
MOCK_METHOD(int32, GetExportedSignalAttributeUInt32, (TaskHandle task, int32 attribute, uInt32* value), (override));
MOCK_METHOD(int32, GetExtCalLastDateAndTime, (const char deviceName[], uInt32* year, uInt32* month, uInt32* day, uInt32* hour, uInt32* minute), (override));
MOCK_METHOD(int32, GetExtendedErrorInfo, (char errorString[], uInt32 bufferSize), (override));
MOCK_METHOD(int32, GetFirstSampClkWhen, (TaskHandle task, CVIAbsoluteTime* data), (override));
MOCK_METHOD(int32, GetFirstSampTimestampVal, (TaskHandle task, CVIAbsoluteTime* data), (override));
Expand Down Expand Up @@ -297,6 +298,7 @@ class NiDAQmxMockLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
MOCK_METHOD(int32, ResetTrigAttribute, (TaskHandle task, int32 attribute), (override));
MOCK_METHOD(int32, ResetWatchdogAttribute, (TaskHandle task, const char lines[], int32 attribute), (override));
MOCK_METHOD(int32, ResetWriteAttribute, (TaskHandle task, int32 attribute), (override));
MOCK_METHOD(int32, RestoreLastExtCalConst, (const char deviceName[]), (override));
MOCK_METHOD(int32, SaveGlobalChan, (TaskHandle task, const char channelName[], const char saveAs[], const char author[], uInt32 options), (override));
MOCK_METHOD(int32, SaveScale, (const char scaleName[], const char saveAs[], const char author[], uInt32 options), (override));
MOCK_METHOD(int32, SaveTask, (TaskHandle task, const char saveAs[], const char author[], uInt32 options), (override));
Expand Down
Loading

0 comments on commit ac40787

Please sign in to comment.