From ac4078799557fe05906f271a1626a52ef1bc40dc Mon Sep 17 00:00:00 2001 From: WayneDroid Date: Wed, 17 Jan 2024 23:58:28 +0800 Subject: [PATCH] Add calibration info reflection API support (#1034) * Add calibration info reflection API support * removed shunt cal and offset nulling APIs --- generated/nidaqmx/nidaqmx.proto | 23 +++ generated/nidaqmx/nidaqmx_client.cpp | 34 ++++ generated/nidaqmx/nidaqmx_client.h | 2 + .../nidaqmx/nidaqmx_compilation_test.cpp | 10 ++ generated/nidaqmx/nidaqmx_library.cpp | 18 ++ generated/nidaqmx/nidaqmx_library.h | 6 + generated/nidaqmx/nidaqmx_library_interface.h | 2 + generated/nidaqmx/nidaqmx_mock_library.h | 2 + generated/nidaqmx/nidaqmx_service.cpp | 54 ++++++ generated/nidaqmx/nidaqmx_service.h | 2 + source/codegen/metadata/nidaqmx/functions.py | 167 +++++++++++++++++- 11 files changed, 316 insertions(+), 4 deletions(-) diff --git a/generated/nidaqmx/nidaqmx.proto b/generated/nidaqmx/nidaqmx.proto index 67788802e..9ca6b7d6c 100644 --- a/generated/nidaqmx/nidaqmx.proto +++ b/generated/nidaqmx/nidaqmx.proto @@ -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); @@ -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); @@ -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; } @@ -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; diff --git a/generated/nidaqmx/nidaqmx_client.cpp b/generated/nidaqmx/nidaqmx_client.cpp index cb9ef8e89..68972fb0c 100644 --- a/generated/nidaqmx/nidaqmx_client.cpp +++ b/generated/nidaqmx/nidaqmx_client.cpp @@ -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) { @@ -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& options) { diff --git a/generated/nidaqmx/nidaqmx_client.h b/generated/nidaqmx/nidaqmx_client.h index 898b6333c..79a71b698 100644 --- a/generated/nidaqmx/nidaqmx_client.h +++ b/generated/nidaqmx/nidaqmx_client.h @@ -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& attribute); GetExportedSignalAttributeStringResponse get_exported_signal_attribute_string(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant& attribute); GetExportedSignalAttributeUInt32Response get_exported_signal_attribute_uint32(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant& 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); @@ -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& attribute); ResetWatchdogAttributeResponse reset_watchdog_attribute(const StubPtr& stub, const nidevice_grpc::Session& task, const std::string& lines, const simple_variant& attribute); ResetWriteAttributeResponse reset_write_attribute(const StubPtr& stub, const nidevice_grpc::Session& task, const simple_variant& 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& options); SaveScaleResponse save_scale(const StubPtr& stub, const std::string& scale_name, const std::string& save_as, const std::string& author, const simple_variant& options); SaveTaskResponse save_task(const StubPtr& stub, const nidevice_grpc::Session& task, const std::string& save_as, const std::string& author, const simple_variant& options); diff --git a/generated/nidaqmx/nidaqmx_compilation_test.cpp b/generated/nidaqmx/nidaqmx_compilation_test.cpp index a38029931..78c01fe66 100644 --- a/generated/nidaqmx/nidaqmx_compilation_test.cpp +++ b/generated/nidaqmx/nidaqmx_compilation_test.cpp @@ -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); @@ -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); diff --git a/generated/nidaqmx/nidaqmx_library.cpp b/generated/nidaqmx/nidaqmx_library.cpp index c1d7adb55..59bd46350 100644 --- a/generated/nidaqmx/nidaqmx_library.cpp +++ b/generated/nidaqmx/nidaqmx_library.cpp @@ -190,6 +190,7 @@ NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr(shared_library_->get_function_pointer("DAQmxGetExportedSignalAttribute")); function_pointers_.GetExportedSignalAttributeString = reinterpret_cast(shared_library_->get_function_pointer("DAQmxGetExportedSignalAttribute")); function_pointers_.GetExportedSignalAttributeUInt32 = reinterpret_cast(shared_library_->get_function_pointer("DAQmxGetExportedSignalAttribute")); + function_pointers_.GetExtCalLastDateAndTime = reinterpret_cast(shared_library_->get_function_pointer("DAQmxGetExtCalLastDateAndTime")); function_pointers_.GetExtendedErrorInfo = reinterpret_cast(shared_library_->get_function_pointer("DAQmxGetExtendedErrorInfo")); function_pointers_.GetFirstSampClkWhen = reinterpret_cast(shared_library_->get_function_pointer("DAQmxGetFirstSampClkWhen")); function_pointers_.GetFirstSampTimestampVal = reinterpret_cast(shared_library_->get_function_pointer("DAQmxGetFirstSampTimestampVal")); @@ -311,6 +312,7 @@ NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr(shared_library_->get_function_pointer("DAQmxResetTrigAttribute")); function_pointers_.ResetWatchdogAttribute = reinterpret_cast(shared_library_->get_function_pointer("DAQmxResetWatchdogAttribute")); function_pointers_.ResetWriteAttribute = reinterpret_cast(shared_library_->get_function_pointer("DAQmxResetWriteAttribute")); + function_pointers_.RestoreLastExtCalConst = reinterpret_cast(shared_library_->get_function_pointer("DAQmxRestoreLastExtCalConst")); function_pointers_.SaveGlobalChan = reinterpret_cast(shared_library_->get_function_pointer("DAQmxSaveGlobalChan")); function_pointers_.SaveScale = reinterpret_cast(shared_library_->get_function_pointer("DAQmxSaveScale")); function_pointers_.SaveTask = reinterpret_cast(shared_library_->get_function_pointer("DAQmxSaveTask")); @@ -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) { @@ -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) { diff --git a/generated/nidaqmx/nidaqmx_library.h b/generated/nidaqmx/nidaqmx_library.h index 5788ebc32..c4c1cd9ee 100644 --- a/generated/nidaqmx/nidaqmx_library.h +++ b/generated/nidaqmx/nidaqmx_library.h @@ -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; @@ -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; @@ -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); @@ -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); @@ -974,6 +978,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface { GetExportedSignalAttributeInt32Ptr GetExportedSignalAttributeInt32; GetExportedSignalAttributeStringPtr GetExportedSignalAttributeString; GetExportedSignalAttributeUInt32Ptr GetExportedSignalAttributeUInt32; + GetExtCalLastDateAndTimePtr GetExtCalLastDateAndTime; GetExtendedErrorInfoPtr GetExtendedErrorInfo; GetFirstSampClkWhenPtr GetFirstSampClkWhen; GetFirstSampTimestampValPtr GetFirstSampTimestampVal; @@ -1095,6 +1100,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface { ResetTrigAttributePtr ResetTrigAttribute; ResetWatchdogAttributePtr ResetWatchdogAttribute; ResetWriteAttributePtr ResetWriteAttribute; + RestoreLastExtCalConstPtr RestoreLastExtCalConst; SaveGlobalChanPtr SaveGlobalChan; SaveScalePtr SaveScale; SaveTaskPtr SaveTask; diff --git a/generated/nidaqmx/nidaqmx_library_interface.h b/generated/nidaqmx/nidaqmx_library_interface.h index ad4379b82..aa642c56c 100644 --- a/generated/nidaqmx/nidaqmx_library_interface.h +++ b/generated/nidaqmx/nidaqmx_library_interface.h @@ -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; @@ -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; diff --git a/generated/nidaqmx/nidaqmx_mock_library.h b/generated/nidaqmx/nidaqmx_mock_library.h index 1bdd578e9..e2a86d0fc 100644 --- a/generated/nidaqmx/nidaqmx_mock_library.h +++ b/generated/nidaqmx/nidaqmx_mock_library.h @@ -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)); @@ -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)); diff --git a/generated/nidaqmx/nidaqmx_service.cpp b/generated/nidaqmx/nidaqmx_service.cpp index 89c806e55..22114022d 100644 --- a/generated/nidaqmx/nidaqmx_service.cpp +++ b/generated/nidaqmx/nidaqmx_service.cpp @@ -9304,6 +9304,38 @@ namespace nidaqmx_grpc { } } + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiDAQmxService::GetExtCalLastDateAndTime(::grpc::ServerContext* context, const GetExtCalLastDateAndTimeRequest* request, GetExtCalLastDateAndTimeResponse* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto device_name_mbcs = convert_from_grpc(request->device_name()); + auto device_name = device_name_mbcs.c_str(); + uInt32 year {}; + uInt32 month {}; + uInt32 day {}; + uInt32 hour {}; + uInt32 minute {}; + auto status = library_->GetExtCalLastDateAndTime(device_name, &year, &month, &day, &hour, &minute); + if (!status_ok(status)) { + return ConvertApiErrorStatusForTaskHandle(context, status, 0); + } + response->set_status(status); + response->set_year(year); + response->set_month(month); + response->set_day(day); + response->set_hour(hour); + response->set_minute(minute); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + //--------------------------------------------------------------------- //--------------------------------------------------------------------- ::grpc::Status NiDAQmxService::GetFirstSampClkWhen(::grpc::ServerContext* context, const GetFirstSampClkWhenRequest* request, GetFirstSampClkWhenResponse* response) @@ -14700,6 +14732,28 @@ namespace nidaqmx_grpc { } } + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiDAQmxService::RestoreLastExtCalConst(::grpc::ServerContext* context, const RestoreLastExtCalConstRequest* request, RestoreLastExtCalConstResponse* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto device_name_mbcs = convert_from_grpc(request->device_name()); + auto device_name = device_name_mbcs.c_str(); + auto status = library_->RestoreLastExtCalConst(device_name); + if (!status_ok(status)) { + return ConvertApiErrorStatusForTaskHandle(context, status, 0); + } + response->set_status(status); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + //--------------------------------------------------------------------- //--------------------------------------------------------------------- ::grpc::Status NiDAQmxService::SaveGlobalChan(::grpc::ServerContext* context, const SaveGlobalChanRequest* request, SaveGlobalChanResponse* response) diff --git a/generated/nidaqmx/nidaqmx_service.h b/generated/nidaqmx/nidaqmx_service.h index 5f7e35ecc..6ed7181ab 100644 --- a/generated/nidaqmx/nidaqmx_service.h +++ b/generated/nidaqmx/nidaqmx_service.h @@ -206,6 +206,7 @@ class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEv ::grpc::Status GetExportedSignalAttributeInt32(::grpc::ServerContext* context, const GetExportedSignalAttributeInt32Request* request, GetExportedSignalAttributeInt32Response* response) override; ::grpc::Status GetExportedSignalAttributeString(::grpc::ServerContext* context, const GetExportedSignalAttributeStringRequest* request, GetExportedSignalAttributeStringResponse* response) override; ::grpc::Status GetExportedSignalAttributeUInt32(::grpc::ServerContext* context, const GetExportedSignalAttributeUInt32Request* request, GetExportedSignalAttributeUInt32Response* response) override; + ::grpc::Status GetExtCalLastDateAndTime(::grpc::ServerContext* context, const GetExtCalLastDateAndTimeRequest* request, GetExtCalLastDateAndTimeResponse* response) override; ::grpc::Status GetFirstSampClkWhen(::grpc::ServerContext* context, const GetFirstSampClkWhenRequest* request, GetFirstSampClkWhenResponse* response) override; ::grpc::Status GetFirstSampTimestampVal(::grpc::ServerContext* context, const GetFirstSampTimestampValRequest* request, GetFirstSampTimestampValResponse* response) override; ::grpc::Status GetNthTaskChannel(::grpc::ServerContext* context, const GetNthTaskChannelRequest* request, GetNthTaskChannelResponse* response) override; @@ -326,6 +327,7 @@ class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEv ::grpc::Status ResetTrigAttribute(::grpc::ServerContext* context, const ResetTrigAttributeRequest* request, ResetTrigAttributeResponse* response) override; ::grpc::Status ResetWatchdogAttribute(::grpc::ServerContext* context, const ResetWatchdogAttributeRequest* request, ResetWatchdogAttributeResponse* response) override; ::grpc::Status ResetWriteAttribute(::grpc::ServerContext* context, const ResetWriteAttributeRequest* request, ResetWriteAttributeResponse* response) override; + ::grpc::Status RestoreLastExtCalConst(::grpc::ServerContext* context, const RestoreLastExtCalConstRequest* request, RestoreLastExtCalConstResponse* response) override; ::grpc::Status SaveGlobalChan(::grpc::ServerContext* context, const SaveGlobalChanRequest* request, SaveGlobalChanResponse* response) override; ::grpc::Status SaveScale(::grpc::ServerContext* context, const SaveScaleRequest* request, SaveScaleResponse* response) override; ::grpc::Status SaveTask(::grpc::ServerContext* context, const SaveTaskRequest* request, SaveTaskResponse* response) override; diff --git a/source/codegen/metadata/nidaqmx/functions.py b/source/codegen/metadata/nidaqmx/functions.py index 55a67cf86..436196746 100644 --- a/source/codegen/metadata/nidaqmx/functions.py +++ b/source/codegen/metadata/nidaqmx/functions.py @@ -12516,19 +12516,35 @@ }, 'DeviceSupportsCal': { 'calling_convention': 'StdCall', + 'handle_parameter': { + 'ctypes_data_type': 'ctypes.c_char_p', + 'cvi_name': 'deviceName', + 'python_accessor': 'self._name' + }, 'parameters': [ { + 'ctypes_data_type': 'ctypes.c_char_p', 'direction': 'in', + 'is_optional_in_python': False, 'name': 'deviceName', + 'python_data_type': 'str', + 'python_description': '', + 'python_type_annotation': 'str', 'type': 'const char[]' }, { + 'ctypes_data_type': 'c_bool32', 'direction': 'out', + 'is_optional_in_python': False, 'name': 'calSupported', + 'python_data_type': 'bool', + 'python_description': '', + 'python_type_annotation': 'bool', 'type': 'bool32' } ], - 'python_codegen_method': 'no', + 'python_class_name': 'Device', + 'python_codegen_method': 'CustomCode', 'returns': 'int32' }, 'DisableRefTrig': { @@ -14074,6 +14090,79 @@ 'python_codegen_method': 'CustomCode', 'returns': 'int32' }, + 'GetExtCalLastDateAndTime': { + 'calling_convention': 'StdCall', + 'handle_parameter': { + 'ctypes_data_type': 'ctypes.c_char_p', + 'cvi_name': 'deviceName', + 'python_accessor': 'self._name' + }, + 'parameters': [ + { + 'ctypes_data_type': 'ctypes.c_char_p', + 'direction': 'in', + 'is_optional_in_python': False, + 'name': 'deviceName', + 'python_data_type': 'str', + 'python_description': '', + 'python_type_annotation': 'str', + 'type': 'const char[]' + }, + { + 'ctypes_data_type': 'ctypes.c_uint', + 'direction': 'out', + 'is_optional_in_python': False, + 'name': 'year', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', + 'type': 'uInt32' + }, + { + 'ctypes_data_type': 'ctypes.c_uint', + 'direction': 'out', + 'is_optional_in_python': False, + 'name': 'month', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', + 'type': 'uInt32' + }, + { + 'ctypes_data_type': 'ctypes.c_uint', + 'direction': 'out', + 'is_optional_in_python': False, + 'name': 'day', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', + 'type': 'uInt32' + }, + { + 'ctypes_data_type': 'ctypes.c_uint', + 'direction': 'out', + 'is_optional_in_python': False, + 'name': 'hour', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', + 'type': 'uInt32' + }, + { + 'ctypes_data_type': 'ctypes.c_uint', + 'direction': 'out', + 'is_optional_in_python': False, + 'name': 'minute', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', + 'type': 'uInt32' + } + ], + 'python_class_name': 'Device', + 'python_codegen_method': 'CustomCode', + 'returns': 'int32' + }, 'GetExtendedErrorInfo': { 'calling_convention': 'StdCall', 'codegen_method': 'private', @@ -15389,39 +15478,75 @@ }, 'GetSelfCalLastDateAndTime': { 'calling_convention': 'StdCall', + 'handle_parameter': { + 'ctypes_data_type': 'ctypes.c_char_p', + 'cvi_name': 'deviceName', + 'python_accessor': 'self._name' + }, 'parameters': [ { + 'ctypes_data_type': 'ctypes.c_char_p', 'direction': 'in', + 'is_optional_in_python': False, 'name': 'deviceName', + 'python_data_type': 'str', + 'python_description': '', + 'python_type_annotation': 'str', 'type': 'const char[]' }, { + 'ctypes_data_type': 'ctypes.c_uint', 'direction': 'out', + 'is_optional_in_python': False, 'name': 'year', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', 'type': 'uInt32' }, { + 'ctypes_data_type': 'ctypes.c_uint', 'direction': 'out', + 'is_optional_in_python': False, 'name': 'month', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', 'type': 'uInt32' }, { + 'ctypes_data_type': 'ctypes.c_uint', 'direction': 'out', + 'is_optional_in_python': False, 'name': 'day', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', 'type': 'uInt32' }, { + 'ctypes_data_type': 'ctypes.c_uint', 'direction': 'out', + 'is_optional_in_python': False, 'name': 'hour', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', 'type': 'uInt32' }, { + 'ctypes_data_type': 'ctypes.c_uint', 'direction': 'out', + 'is_optional_in_python': False, 'name': 'minute', + 'python_data_type': 'int', + 'python_description': '', + 'python_type_annotation': 'int', 'type': 'uInt32' } ], - 'python_codegen_method': 'no', + 'python_class_name': 'Device', + 'python_codegen_method': 'CustomCode', 'returns': 'int32' }, 'GetStartTrigTimestampVal': { @@ -19955,6 +20080,28 @@ 'python_codegen_method': 'CustomCode', 'returns': 'int32' }, + 'RestoreLastExtCalConst': { + 'calling_convention': 'StdCall', + 'handle_parameter': { + 'ctypes_data_type': 'ctypes.c_char_p', + 'cvi_name': 'deviceName', + 'python_accessor': 'self._name' + }, + 'parameters': [ + { + 'ctypes_data_type': 'ctypes.c_char_p', + 'direction': 'in', + 'is_optional_in_python': False, + 'name': 'deviceName', + 'python_data_type': 'str', + 'python_description': '', + 'python_type_annotation': 'str', + 'type': 'const char[]' + } + ], + 'python_class_name': 'Device', + 'returns': 'int32' + }, 'SaveGlobalChan': { 'calling_convention': 'StdCall', 'handle_parameter': { @@ -20088,14 +20235,26 @@ }, 'SelfCal': { 'calling_convention': 'StdCall', + 'handle_parameter': { + 'ctypes_data_type': 'ctypes.c_char_p', + 'cvi_name': 'deviceName', + 'python_accessor': 'self._name' + }, 'parameters': [ { + 'ctypes_data_type': 'ctypes.c_char_p', 'direction': 'in', + 'is_optional_in_python': False, 'name': 'deviceName', - 'type': 'const char[]' + 'python_data_type': 'str', + 'python_description': '', + 'python_type_annotation': 'str', + 'type': 'const char[]', + 'use_in_python_api': False } ], - 'python_codegen_method': 'no', + 'python_class_name': 'Device', + 'python_description': 'Measures the onboard reference voltage of the device and adjusts the self-calibration constants to account for any errors caused by short-term fluctuations in the operating environment. When you self-calibrate a device, no external signal connections are necessary.', 'returns': 'int32' }, 'SelfTestDevice': {