Skip to content

Commit

Permalink
daqmx: Pick up scrapigen daqmx metadata update (#1115)
Browse files Browse the repository at this point in the history
* daqmx: Pick up scrapigen daqmx metadata update

Signed-off-by: Siu Fong Tan <[email protected]>

* Add generated files

Signed-off-by: Siu Fong Tan <[email protected]>

* Filter out CalculatedPower stuff until it is fully supported

---------

Signed-off-by: Siu Fong Tan <[email protected]>
  • Loading branch information
SiuFong-NI authored Nov 8, 2024
1 parent 1f3ffbe commit 44fde0f
Show file tree
Hide file tree
Showing 9 changed files with 587 additions and 134 deletions.
27 changes: 24 additions & 3 deletions generated/nidaqmx/nidaqmx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,7 @@ enum PhysicalChannelInt32Attribute {
PHYSICALCHANNEL_ATTRIBUTE_PHYSICAL_CHAN_AI_TERM_CFGS = 9026;
PHYSICALCHANNEL_ATTRIBUTE_PHYSICAL_CHAN_AO_TERM_CFGS = 10659;
PHYSICALCHANNEL_ATTRIBUTE_PHYSICAL_CHAN_AI_POWER_CONTROL_TYPE = 12654;
PHYSICALCHANNEL_ATTRIBUTE_PHYSICAL_CHAN_DIG_PORT_LOGIC_FAMILY = 12779;
}

enum PhysicalChannelBoolAttribute {
Expand All @@ -2039,6 +2040,7 @@ enum PhysicalChannelResetAttribute {
PHYSICALCHANNEL_RESET_ATTRIBUTE_PHYSICAL_CHAN_AI_POWER_CONTROL_VOLTAGE = 12652;
PHYSICALCHANNEL_RESET_ATTRIBUTE_PHYSICAL_CHAN_AI_POWER_CONTROL_ENABLE = 12653;
PHYSICALCHANNEL_RESET_ATTRIBUTE_PHYSICAL_CHAN_AI_POWER_CONTROL_TYPE = 12654;
PHYSICALCHANNEL_RESET_ATTRIBUTE_PHYSICAL_CHAN_DIG_PORT_LOGIC_FAMILY = 12779;
}

enum PhysicalChannelDoubleAttribute {
Expand Down Expand Up @@ -3165,6 +3167,7 @@ enum LoggingOperation {

enum LogicFamily {
LOGIC_FAMILY_UNSPECIFIED = 0;
LOGIC_FAMILY_1POINT_8_V = 16184;
LOGIC_FAMILY_2POINT_5_V = 14620;
LOGIC_FAMILY_3POINT_3_V = 14621;
LOGIC_FAMILY_5_V = 14619;
Expand Down Expand Up @@ -3310,6 +3313,18 @@ enum StrainGageBridgeType1 {
STRAIN_GAGE_BRIDGE_TYPE1_QUARTER_BRIDGE_II = 10272;
}

enum StrainGageRosetteMeasurementType {
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_UNSPECIFIED = 0;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_PRINCIPAL_STRAIN_1 = 15971;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_PRINCIPAL_STRAIN_2 = 15972;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_PRINCIPAL_STRAIN_ANGLE = 15973;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_CARTESIAN_STRAIN_X = 15974;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_CARTESIAN_STRAIN_Y = 15975;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_CARTESIAN_SHEAR_STRAIN_XY = 15976;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_MAX_SHEAR_STRAIN = 15977;
STRAIN_GAGE_ROSETTE_MEASUREMENT_TYPE_MAX_SHEAR_STRAIN_ANGLE = 15978;
}

enum StrainGageRosetteType {
STRAIN_GAGE_ROSETTE_TYPE_UNSPECIFIED = 0;
STRAIN_GAGE_ROSETTE_TYPE_RECTANGULAR_ROSETTE = 15968;
Expand Down Expand Up @@ -3726,6 +3741,7 @@ enum ChannelInt32AttributeValues {
CHANNEL_INT32_LENGTH_UNITS4_FROM_CUSTOM_SCALE = 10065;
CHANNEL_INT32_LEVEL1_HIGH = 10192;
CHANNEL_INT32_LEVEL1_LOW = 10214;
CHANNEL_INT32_LOGIC_FAMILY_1POINT_8_V = 16184;
CHANNEL_INT32_LOGIC_FAMILY_2POINT_5_V = 14620;
CHANNEL_INT32_LOGIC_FAMILY_3POINT_3_V = 14621;
CHANNEL_INT32_LOGIC_FAMILY_5_V = 14619;
Expand Down Expand Up @@ -3990,6 +4006,7 @@ enum DeviceInt32AttributeValues {
DEVICE_INT32_PRODUCT_CATEGORY_FIELD_DAQ = 16151;
DEVICE_INT32_PRODUCT_CATEGORY_TEST_SCALE_CHASSIS = 16180;
DEVICE_INT32_PRODUCT_CATEGORY_TEST_SCALE_MODULE = 16181;
DEVICE_INT32_PRODUCT_CATEGORY_MIO_DAQ = 16182;
DEVICE_INT32_PRODUCT_CATEGORY_UNKNOWN = 12588;
DEVICE_INT32_TRIGGER_USAGE_ADVANCE = 12488;
DEVICE_INT32_TRIGGER_USAGE_PAUSE = 12489;
Expand Down Expand Up @@ -4089,6 +4106,10 @@ enum PhysicalChannelInt32AttributeValues {
PHYSICALCHANNEL_INT32_CO_OUTPUT_TYPE_PULSE_TIME = 10269;
PHYSICALCHANNEL_INT32_CO_OUTPUT_TYPE_PULSE_FREQ = 10119;
PHYSICALCHANNEL_INT32_CO_OUTPUT_TYPE_PULSE_TICKS = 10268;
PHYSICALCHANNEL_INT32_LOGIC_FAMILY_1POINT_8_V = 16184;
PHYSICALCHANNEL_INT32_LOGIC_FAMILY_2POINT_5_V = 14620;
PHYSICALCHANNEL_INT32_LOGIC_FAMILY_3POINT_3_V = 14621;
PHYSICALCHANNEL_INT32_LOGIC_FAMILY_5_V = 14619;
PHYSICALCHANNEL_INT32_NAV_MEASUREMENT_TYPE_ALTITUDE = 15997;
PHYSICALCHANNEL_INT32_NAV_MEASUREMENT_TYPE_LONGITUDE = 15998;
PHYSICALCHANNEL_INT32_NAV_MEASUREMENT_TYPE_LATITUDE = 15999;
Expand Down Expand Up @@ -4431,7 +4452,7 @@ message CfgAnlgEdgeStartTrigResponse {
message CfgAnlgMultiEdgeRefTrigRequest {
nidevice_grpc.Session task = 1;
string trigger_sources = 2;
repeated int32 trigger_slope_array = 3;
repeated Slope1 trigger_slope_array = 3;
repeated double trigger_level_array = 4;
uint32 pretrigger_samples = 5;
}
Expand All @@ -4443,7 +4464,7 @@ message CfgAnlgMultiEdgeRefTrigResponse {
message CfgAnlgMultiEdgeStartTrigRequest {
nidevice_grpc.Session task = 1;
string trigger_sources = 2;
repeated int32 trigger_slope_array = 3;
repeated Slope1 trigger_slope_array = 3;
repeated double trigger_level_array = 4;
}

Expand Down Expand Up @@ -5458,7 +5479,7 @@ message CreateAIRosetteStrainGageChanRequest {
int32 rosette_type_raw = 7;
}
double gage_orientation = 8;
repeated int32 rosette_meas_types = 9;
repeated StrainGageRosetteMeasurementType rosette_meas_types = 9;
oneof strain_config_enum {
StrainGageBridgeType1 strain_config = 10;
int32 strain_config_raw = 11;
Expand Down
19 changes: 18 additions & 1 deletion generated/nidaqmx/nidaqmx_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//---------------------------------------------------------------------
#include "nidaqmx_library.h"
#include <server/shared_library.h>
#include "version.h"

#include <memory>

Expand All @@ -18,7 +19,7 @@ namespace nidaqmx_grpc {

NiDAQmxLibrary::NiDAQmxLibrary() : NiDAQmxLibrary(std::make_shared<nidevice_grpc::SharedLibrary>()) {}

NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr<nidevice_grpc::SharedLibraryInterface> shared_library) : shared_library_(shared_library)
NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr<nidevice_grpc::SharedLibraryInterface> shared_library) : shared_library_(shared_library), runtime_environment_set_(false)
{
shared_library_->set_library_name(kLibraryName);
shared_library_->load();
Expand Down Expand Up @@ -356,6 +357,7 @@ NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr<nidevice_grpc::SharedLibraryInter
function_pointers_.SetRealTimeAttributeBool = reinterpret_cast<SetRealTimeAttributeBoolPtr>(shared_library_->get_function_pointer("DAQmxSetRealTimeAttribute"));
function_pointers_.SetRealTimeAttributeInt32 = reinterpret_cast<SetRealTimeAttributeInt32Ptr>(shared_library_->get_function_pointer("DAQmxSetRealTimeAttribute"));
function_pointers_.SetRealTimeAttributeUInt32 = reinterpret_cast<SetRealTimeAttributeUInt32Ptr>(shared_library_->get_function_pointer("DAQmxSetRealTimeAttribute"));
function_pointers_.SetRuntimeEnvironment = reinterpret_cast<SetRuntimeEnvironmentPtr>(shared_library_->get_function_pointer("DAQmxSetRuntimeEnvironment"));
function_pointers_.SetScaleAttributeDouble = reinterpret_cast<SetScaleAttributeDoublePtr>(shared_library_->get_function_pointer("DAQmxSetScaleAttribute"));
function_pointers_.SetScaleAttributeDoubleArray = reinterpret_cast<SetScaleAttributeDoubleArrayPtr>(shared_library_->get_function_pointer("DAQmxSetScaleAttribute"));
function_pointers_.SetScaleAttributeInt32 = reinterpret_cast<SetScaleAttributeInt32Ptr>(shared_library_->get_function_pointer("DAQmxSetScaleAttribute"));
Expand Down Expand Up @@ -426,6 +428,11 @@ NiDAQmxLibrary::NiDAQmxLibrary(std::shared_ptr<nidevice_grpc::SharedLibraryInter
function_pointers_.WriteRaw = reinterpret_cast<WriteRawPtr>(shared_library_->get_function_pointer("DAQmxWriteRaw"));
function_pointers_.WriteToTEDSFromArray = reinterpret_cast<WriteToTEDSFromArrayPtr>(shared_library_->get_function_pointer("DAQmxWriteToTEDSFromArray"));
function_pointers_.WriteToTEDSFromFile = reinterpret_cast<WriteToTEDSFromFilePtr>(shared_library_->get_function_pointer("DAQmxWriteToTEDSFromFile"));

if (function_pointers_.SetRuntimeEnvironment) {
this->SetRuntimeEnvironment(nidevice_grpc::kNiDeviceGrpcOriginalFileName, nidevice_grpc::kNiDeviceGrpcFileVersion, "", "");
this->runtime_environment_set_ = true;
}
}

NiDAQmxLibrary::~NiDAQmxLibrary()
Expand Down Expand Up @@ -3071,6 +3078,14 @@ int32 NiDAQmxLibrary::SetRealTimeAttributeUInt32(TaskHandle task, int32 attribut
return function_pointers_.SetRealTimeAttributeUInt32(task, attribute, value);
}

int32 NiDAQmxLibrary::SetRuntimeEnvironment(const char environment[], const char environmentVersion[], const char reserved1[], const char reserved2[])
{
if (!function_pointers_.SetRuntimeEnvironment) {
throw nidevice_grpc::LibraryLoadException("Could not find DAQmxSetRuntimeEnvironment.");
}
return function_pointers_.SetRuntimeEnvironment(environment, environmentVersion, reserved1, reserved2);
}

int32 NiDAQmxLibrary::SetScaleAttributeDouble(const char scaleName[], int32 attribute, float64 value)
{
if (!function_pointers_.SetScaleAttributeDouble) {
Expand Down Expand Up @@ -3631,4 +3646,6 @@ int32 NiDAQmxLibrary::WriteToTEDSFromFile(const char physicalChannel[], const ch
return function_pointers_.WriteToTEDSFromFile(physicalChannel, filePath, basicTEDSOptions);
}

bool NiDAQmxLibrary::is_runtime_environment_set() const { return this->runtime_environment_set_; }

} // namespace nidaqmx_grpc
5 changes: 5 additions & 0 deletions generated/nidaqmx/nidaqmx_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
int32 SetRealTimeAttributeBool(TaskHandle task, int32 attribute, bool32 value) override;
int32 SetRealTimeAttributeInt32(TaskHandle task, int32 attribute, int32 value) override;
int32 SetRealTimeAttributeUInt32(TaskHandle task, int32 attribute, uInt32 value) override;
int32 SetRuntimeEnvironment(const char environment[], const char environmentVersion[], const char reserved1[], const char reserved2[]) override;
int32 SetScaleAttributeDouble(const char scaleName[], int32 attribute, float64 value) override;
int32 SetScaleAttributeDoubleArray(const char scaleName[], int32 attribute, const float64 value[], uInt32 size) override;
int32 SetScaleAttributeInt32(const char scaleName[], int32 attribute, int32 value) override;
Expand Down Expand Up @@ -420,6 +421,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
int32 WriteRaw(TaskHandle task, int32 numSamps, bool32 autoStart, float64 timeout, const uInt8 writeArray[], int32* sampsPerChanWritten, bool32* reserved) override;
int32 WriteToTEDSFromArray(const char physicalChannel[], const uInt8 bitStream[], uInt32 arraySize, int32 basicTEDSOptions) override;
int32 WriteToTEDSFromFile(const char physicalChannel[], const char filePath[], int32 basicTEDSOptions) override;
bool is_runtime_environment_set() const; // needed to test that we properly call SetRuntimeEnvironment

private:
using AddCDAQSyncConnectionPtr = decltype(&DAQmxAddCDAQSyncConnection);
Expand Down Expand Up @@ -751,6 +753,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
using SetRealTimeAttributeBoolPtr = decltype(&DAQmxSetRealTimeAttribute);
using SetRealTimeAttributeInt32Ptr = decltype(&DAQmxSetRealTimeAttribute);
using SetRealTimeAttributeUInt32Ptr = decltype(&DAQmxSetRealTimeAttribute);
using SetRuntimeEnvironmentPtr = int32 (*)(const char environment[], const char environmentVersion[], const char reserved1[], const char reserved2[]);
using SetScaleAttributeDoublePtr = decltype(&DAQmxSetScaleAttribute);
using SetScaleAttributeDoubleArrayPtr = decltype(&DAQmxSetScaleAttribute);
using SetScaleAttributeInt32Ptr = decltype(&DAQmxSetScaleAttribute);
Expand Down Expand Up @@ -1152,6 +1155,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
SetRealTimeAttributeBoolPtr SetRealTimeAttributeBool;
SetRealTimeAttributeInt32Ptr SetRealTimeAttributeInt32;
SetRealTimeAttributeUInt32Ptr SetRealTimeAttributeUInt32;
SetRuntimeEnvironmentPtr SetRuntimeEnvironment;
SetScaleAttributeDoublePtr SetScaleAttributeDouble;
SetScaleAttributeDoubleArrayPtr SetScaleAttributeDoubleArray;
SetScaleAttributeInt32Ptr SetScaleAttributeInt32;
Expand Down Expand Up @@ -1226,6 +1230,7 @@ class NiDAQmxLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {

std::shared_ptr<nidevice_grpc::SharedLibraryInterface> shared_library_;
FunctionPointers function_pointers_;
bool runtime_environment_set_; // needed to test that we properly call SetRuntimeEnvironment
};

} // namespace nidaqmx_grpc
Expand Down
1 change: 1 addition & 0 deletions generated/nidaqmx/nidaqmx_library_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ class NiDAQmxLibraryInterface {
virtual int32 SetRealTimeAttributeBool(TaskHandle task, int32 attribute, bool32 value) = 0;
virtual int32 SetRealTimeAttributeInt32(TaskHandle task, int32 attribute, int32 value) = 0;
virtual int32 SetRealTimeAttributeUInt32(TaskHandle task, int32 attribute, uInt32 value) = 0;
virtual int32 SetRuntimeEnvironment(const char environment[], const char environmentVersion[], const char reserved1[], const char reserved2[]) = 0;
virtual int32 SetScaleAttributeDouble(const char scaleName[], int32 attribute, float64 value) = 0;
virtual int32 SetScaleAttributeDoubleArray(const char scaleName[], int32 attribute, const float64 value[], uInt32 size) = 0;
virtual int32 SetScaleAttributeInt32(const char scaleName[], int32 attribute, int32 value) = 0;
Expand Down
1 change: 1 addition & 0 deletions generated/nidaqmx/nidaqmx_mock_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ class NiDAQmxMockLibrary : public nidaqmx_grpc::NiDAQmxLibraryInterface {
MOCK_METHOD(int32, SetRealTimeAttributeBool, (TaskHandle task, int32 attribute, bool32 value), (override));
MOCK_METHOD(int32, SetRealTimeAttributeInt32, (TaskHandle task, int32 attribute, int32 value), (override));
MOCK_METHOD(int32, SetRealTimeAttributeUInt32, (TaskHandle task, int32 attribute, uInt32 value), (override));
MOCK_METHOD(int32, SetRuntimeEnvironment, (const char environment[], const char environmentVersion[], const char reserved1[], const char reserved2[]), (override));
MOCK_METHOD(int32, SetScaleAttributeDouble, (const char scaleName[], int32 attribute, float64 value), (override));
MOCK_METHOD(int32, SetScaleAttributeDoubleArray, (const char scaleName[], int32 attribute, const float64 value[], uInt32 size), (override));
MOCK_METHOD(int32, SetScaleAttributeInt32, (const char scaleName[], int32 attribute, int32 value), (override));
Expand Down
30 changes: 27 additions & 3 deletions generated/nidaqmx/nidaqmx_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,15 @@ namespace nidaqmx_grpc {
TaskHandle task = session_repository_->access_session(task_grpc_session.name());
auto trigger_sources_mbcs = convert_from_grpc<std::string>(request->trigger_sources());
auto trigger_sources = trigger_sources_mbcs.c_str();
auto trigger_slope_array = reinterpret_cast<const int32*>(request->trigger_slope_array().data());
auto trigger_slope_array_vector = std::vector<int32>();
trigger_slope_array_vector.reserve(request->trigger_slope_array().size());
std::transform(
request->trigger_slope_array().begin(),
request->trigger_slope_array().end(),
std::back_inserter(trigger_slope_array_vector),
[](auto x) { return x; });
auto trigger_slope_array = trigger_slope_array_vector.data();

auto trigger_level_array = const_cast<const float64*>(request->trigger_level_array().data());
uInt32 pretrigger_samples = request->pretrigger_samples();
auto array_size_determine_from_sizes = std::array<int, 2>
Expand Down Expand Up @@ -350,7 +358,15 @@ namespace nidaqmx_grpc {
TaskHandle task = session_repository_->access_session(task_grpc_session.name());
auto trigger_sources_mbcs = convert_from_grpc<std::string>(request->trigger_sources());
auto trigger_sources = trigger_sources_mbcs.c_str();
auto trigger_slope_array = reinterpret_cast<const int32*>(request->trigger_slope_array().data());
auto trigger_slope_array_vector = std::vector<int32>();
trigger_slope_array_vector.reserve(request->trigger_slope_array().size());
std::transform(
request->trigger_slope_array().begin(),
request->trigger_slope_array().end(),
std::back_inserter(trigger_slope_array_vector),
[](auto x) { return x; });
auto trigger_slope_array = trigger_slope_array_vector.data();

auto trigger_level_array = const_cast<const float64*>(request->trigger_level_array().data());
auto array_size_determine_from_sizes = std::array<int, 2>
{
Expand Down Expand Up @@ -3431,7 +3447,15 @@ namespace nidaqmx_grpc {
}

float64 gage_orientation = request->gage_orientation();
auto rosette_meas_types = reinterpret_cast<const int32*>(request->rosette_meas_types().data());
auto rosette_meas_types_vector = std::vector<int32>();
rosette_meas_types_vector.reserve(request->rosette_meas_types().size());
std::transform(
request->rosette_meas_types().begin(),
request->rosette_meas_types().end(),
std::back_inserter(rosette_meas_types_vector),
[](auto x) { return x; });
auto rosette_meas_types = rosette_meas_types_vector.data();

uInt32 num_rosette_meas_types = static_cast<uInt32>(request->rosette_meas_types().size());
int32 strain_config;
switch (request->strain_config_enum_case()) {
Expand Down
Loading

0 comments on commit 44fde0f

Please sign in to comment.