Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add SetRuntimeEnvironment call for NI-DCPower #962

Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,17 @@ if(WIN32)
)
endif()

# Generate version header file
ni-jfitzger marked this conversation as resolved.
Show resolved Hide resolved
configure_file(
source/server/version.h.in
${service_output_dir}/version.h
@ONLY)

target_sources(ni_grpc_device_server
PUBLIC "${service_output_dir}/version.h"
)


if(CMAKE_SYSTEM_NAME STREQUAL Linux)
target_sources(ni_grpc_device_server
PRIVATE "source/server/linux/syslog_logging.cpp"
Expand Down
1 change: 1 addition & 0 deletions generated/nidaqmx/nidaqmx_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-DAQMX Metadata
//---------------------------------------------------------------------
#include "nidaqmx_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nicaiu.dll";
Expand Down
12 changes: 12 additions & 0 deletions generated/nidcpower/nidcpower_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-DCPower Metadata
//---------------------------------------------------------------------
#include "nidcpower_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nidcpower_64.dll";
Expand Down Expand Up @@ -169,6 +170,9 @@ NiDCPowerLibrary::NiDCPowerLibrary() : shared_library_(kLibraryName)
function_pointers_.UnlockSession = reinterpret_cast<UnlockSessionPtr>(shared_library_.get_function_pointer("niDCPower_UnlockSession"));
function_pointers_.WaitForEvent = reinterpret_cast<WaitForEventPtr>(shared_library_.get_function_pointer("niDCPower_WaitForEvent"));
function_pointers_.WaitForEventWithChannels = reinterpret_cast<WaitForEventWithChannelsPtr>(shared_library_.get_function_pointer("niDCPower_WaitForEventWithChannels"));
function_pointers_.SetRuntimeEnvironment = reinterpret_cast<SetRuntimeEnvironmentPtr>(shared_library_.get_function_pointer("niDCPower_SetRuntimeEnvironment"));

this->SetRuntimeEnvironment(nidevice_grpc::NIDEVICE_GRPC_ORIGINALFILENAME.c_str(), nidevice_grpc::NIDEVICE_GRPC_FILEVERSION.c_str(), "", "");
}

NiDCPowerLibrary::~NiDCPowerLibrary()
Expand Down Expand Up @@ -1366,4 +1370,12 @@ ViStatus NiDCPowerLibrary::WaitForEventWithChannels(ViSession vi, ViConstString
return function_pointers_.WaitForEventWithChannels(vi, channelName, eventId, timeout);
}

ViStatus NiDCPowerLibrary::SetRuntimeEnvironment(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2)
{
if (!function_pointers_.SetRuntimeEnvironment) {
throw nidevice_grpc::LibraryLoadException("Could not find niDCPower_SetRuntimeEnvironment.");
ni-jfitzger marked this conversation as resolved.
Show resolved Hide resolved
}
return function_pointers_.SetRuntimeEnvironment(environment, environmentVersion, reserved1, reserved2);
}

} // namespace nidcpower_grpc
3 changes: 3 additions & 0 deletions generated/nidcpower/nidcpower_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class NiDCPowerLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface {
ViStatus UnlockSession(ViSession vi, ViBoolean* callerHasLock);
ViStatus WaitForEvent(ViSession vi, ViInt32 eventId, ViReal64 timeout);
ViStatus WaitForEventWithChannels(ViSession vi, ViConstString channelName, ViInt32 eventId, ViReal64 timeout);
ViStatus SetRuntimeEnvironment(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2);
ni-jfitzger marked this conversation as resolved.
Show resolved Hide resolved

private:
using AbortPtr = decltype(&niDCPower_Abort);
Expand Down Expand Up @@ -316,6 +317,7 @@ class NiDCPowerLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface {
using UnlockSessionPtr = ViStatus (*)(ViSession vi, ViBoolean* callerHasLock);
using WaitForEventPtr = decltype(&niDCPower_WaitForEvent);
using WaitForEventWithChannelsPtr = decltype(&niDCPower_WaitForEventWithChannels);
using SetRuntimeEnvironmentPtr = ViStatus (*)(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2);

typedef struct FunctionPointers {
AbortPtr Abort;
Expand Down Expand Up @@ -466,6 +468,7 @@ class NiDCPowerLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface {
UnlockSessionPtr UnlockSession;
WaitForEventPtr WaitForEvent;
WaitForEventWithChannelsPtr WaitForEventWithChannels;
SetRuntimeEnvironmentPtr SetRuntimeEnvironment;
} FunctionLoadStatus;

nidevice_grpc::SharedLibrary shared_library_;
Expand Down
1 change: 1 addition & 0 deletions generated/nidcpower/nidcpower_library_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class NiDCPowerLibraryInterface {
virtual ViStatus UnlockSession(ViSession vi, ViBoolean* callerHasLock) = 0;
virtual ViStatus WaitForEvent(ViSession vi, ViInt32 eventId, ViReal64 timeout) = 0;
virtual ViStatus WaitForEventWithChannels(ViSession vi, ViConstString channelName, ViInt32 eventId, ViReal64 timeout) = 0;
virtual ViStatus SetRuntimeEnvironment(ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2) = 0;
};

} // namespace nidcpower_grpc
Expand Down
1 change: 1 addition & 0 deletions generated/nidcpower/nidcpower_mock_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class NiDCPowerMockLibrary : public nidcpower_grpc::NiDCPowerLibraryInterface {
MOCK_METHOD(ViStatus, UnlockSession, (ViSession vi, ViBoolean* callerHasLock), (override));
MOCK_METHOD(ViStatus, WaitForEvent, (ViSession vi, ViInt32 eventId, ViReal64 timeout), (override));
MOCK_METHOD(ViStatus, WaitForEventWithChannels, (ViSession vi, ViConstString channelName, ViInt32 eventId, ViReal64 timeout), (override));
MOCK_METHOD(ViStatus, SetRuntimeEnvironment, (ViConstString environment, ViConstString environmentVersion, ViConstString reserved1, ViConstString reserved2), (override));
};

} // namespace unit
Expand Down
1 change: 1 addition & 0 deletions generated/nidigitalpattern/nidigitalpattern_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-Digital Pattern Driver Metadata
//---------------------------------------------------------------------
#include "nidigitalpattern_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niDigital_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nidmm/nidmm_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-DMM Metadata
//---------------------------------------------------------------------
#include "nidmm_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nidmm_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nifake/nifake_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-FAKE Metadata
//---------------------------------------------------------------------
#include "nifake_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nifake_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nifake_extension/nifake_extension_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-FAKE-EXTENSION Metadata
//---------------------------------------------------------------------
#include "nifake_extension_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nifake_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nifake_non_ivi/nifake_non_ivi_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-FAKE-NON-IVI Metadata
//---------------------------------------------------------------------
#include "nifake_non_ivi_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nifakenonivi_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nifgen/nifgen_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-FGEN Metadata
//---------------------------------------------------------------------
#include "nifgen_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niFgen_64.dll";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-MXLCTERMINALADAPTOR-RESTRICTED Metadata
//---------------------------------------------------------------------
#include "nimxlcterminaladaptor_restricted_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nimxlcTerminalAdaptor.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxbluetooth/nirfmxbluetooth_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXBLUETOOTH Metadata
//---------------------------------------------------------------------
#include "nirfmxbluetooth_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxBT.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxcdma2k/nirfmxcdma2k_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-rfmxcdma2k Metadata
//---------------------------------------------------------------------
#include "nirfmxcdma2k_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxCDMA2k.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxdemod/nirfmxdemod_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-rfmxdemod Metadata
//---------------------------------------------------------------------
#include "nirfmxdemod_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxDemod.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxgsm/nirfmxgsm_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXGSM Metadata
//---------------------------------------------------------------------
#include "nirfmxgsm_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxGSM.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxinstr/nirfmxinstr_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXINSTR Metadata
//---------------------------------------------------------------------
#include "nirfmxinstr_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxInstr.dll";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXINSTR-RESTRICTED Metadata
//---------------------------------------------------------------------
#include "nirfmxinstr_restricted_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxInstr.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxlte/nirfmxlte_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXLTE Metadata
//---------------------------------------------------------------------
#include "nirfmxlte_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxLTE.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxnr/nirfmxnr_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXNR Metadata
//---------------------------------------------------------------------
#include "nirfmxnr_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxNR.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxspecan/nirfmxspecan_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXSPECAN Metadata
//---------------------------------------------------------------------
#include "nirfmxspecan_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxSpecAn.dll";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXSPECAN-RESTRICTED Metadata
//---------------------------------------------------------------------
#include "nirfmxspecan_restricted_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxSpecAn.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxtdscdma/nirfmxtdscdma_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-rfmxtdscdma Metadata
//---------------------------------------------------------------------
#include "nirfmxtdscdma_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxTDSCDMA.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxwcdma/nirfmxwcdma_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-rfmxwcdma Metadata
//---------------------------------------------------------------------
#include "nirfmxwcdma_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxWCDMA.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfmxwlan/nirfmxwlan_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXWLAN Metadata
//---------------------------------------------------------------------
#include "nirfmxwlan_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxWLAN.dll";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFMXWLAN-RESTRICTED Metadata
//---------------------------------------------------------------------
#include "nirfmxwlan_restricted_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFmxWLAN.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfsa/nirfsa_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFSA Metadata
//---------------------------------------------------------------------
#include "nirfsa_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFSA_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nirfsg/nirfsg_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-RFSG Metadata
//---------------------------------------------------------------------
#include "nirfsg_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niRFSG_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/niscope/niscope_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-SCOPE Metadata
//---------------------------------------------------------------------
#include "niscope_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niScope_64.dll";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-SCOPE-RESTRICTED Metadata
//---------------------------------------------------------------------
#include "niscope_restricted_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niScope_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/niswitch/niswitch_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-SWITCH Metadata
//---------------------------------------------------------------------
#include "niswitch_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niswitch_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nisync/nisync_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-SYNC Metadata
//---------------------------------------------------------------------
#include "nisync_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nisync.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nitclk/nitclk_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-TClk Metadata
//---------------------------------------------------------------------
#include "nitclk_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "niTClk_64.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nixnet/nixnet_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-XNET Metadata
//---------------------------------------------------------------------
#include "nixnet_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nixnet.dll";
Expand Down
1 change: 1 addition & 0 deletions generated/nixnetsocket/nixnetsocket_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Service implementation for the NI-XNETSOCKET Metadata
//---------------------------------------------------------------------
#include "nixnetsocket_library.h"
#include "version.h"

#if defined(_MSC_VER)
static const char* kLibraryName = "nixntipstack.dll";
Expand Down
19 changes: 19 additions & 0 deletions generated/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef NIDEVICE_GRPC_VERSION_H
#define NIDEVICE_GRPC_VERSION_H

#include <string>

namespace nidevice_grpc {

std::string const NIDEVICE_GRPC_MAJORNUMBER = "2";
bkeryan marked this conversation as resolved.
Show resolved Hide resolved
std::string const NIDEVICE_GRPC_MINORNUMBER = "3";
std::string const NIDEVICE_GRPC_BUILDNUMBER = "0";
std::string const NIDEVICE_GRPC_MODIFICATIONNUMBER = "0";
std::string const NIDEVICE_GRPC_FILEVERSION = "2.3.0.0";
std::string const NIDEVICE_GRPC_PRODUCTVERSION = "2.3";
std::string const NIDEVICE_GRPC_ORIGINALFILENAME = "ni_grpc_device_server.exe";
std::string const NIDEVICE_GRPC_PRODUCTNAME = "NI gRPC Device Server";

}

#endif // NIDEVICE_GRPC_VERSION_H
9 changes: 8 additions & 1 deletion source/codegen/metadata/nidcpower/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
from .functions import functions
from .functions_addon import functions_override_metadata
from .attributes import attributes
from .attributes_addon import attributes_override_metadata
from .enums import enums
from .enums_addon import enums_override_metadata
from .config import config

metadata = {
"functions" : functions,
"attributes" : attributes,
"enums" : enums,
"config" : config
}
}

metadata['functions'].update(functions_override_metadata)
ni-jfitzger marked this conversation as resolved.
Show resolved Hide resolved
metadata['attributes'].update(attributes_override_metadata)
metadata['enums'].update(enums_override_metadata)
Loading