Skip to content

Commit

Permalink
Removed the Initialize Api with channel parameter (#1017)
Browse files Browse the repository at this point in the history
  • Loading branch information
alenkani authored Oct 27, 2023
1 parent 7812da4 commit 854e4fc
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 162 deletions.
17 changes: 0 additions & 17 deletions generated/nirfmxinstr/nirfmxinstr.proto
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ service NiRFmxInstr {
rpc GetSelfCalibrateLastTemperature(GetSelfCalibrateLastTemperatureRequest) returns (GetSelfCalibrateLastTemperatureResponse);
rpc GetSignalConfigurationNames(GetSignalConfigurationNamesRequest) returns (GetSignalConfigurationNamesResponse);
rpc Initialize(InitializeRequest) returns (InitializeResponse);
rpc InitializeWithChannel(InitializeWithChannelRequest) returns (InitializeWithChannelResponse);
rpc InitializeFromNIRFSASession(InitializeFromNIRFSASessionRequest) returns (InitializeFromNIRFSASessionResponse);
rpc InitializeFromNIRFSASessionArray(InitializeFromNIRFSASessionArrayRequest) returns (InitializeFromNIRFSASessionArrayResponse);
rpc IsSelfCalibrateValid(IsSelfCalibrateValidRequest) returns (IsSelfCalibrateValidResponse);
Expand Down Expand Up @@ -1087,22 +1086,6 @@ message InitializeResponse {
bool new_session_initialized = 5;
}

message InitializeWithChannelRequest {
string session_name = 1;
string resource_name = 2;
string option_string = 3;
string channel_name = 4;
nidevice_grpc.SessionInitializationBehavior initialization_behavior = 5;
}

message InitializeWithChannelResponse {
int32 status = 1;
nidevice_grpc.Session instrument = 2;
int32 is_new_session = 3;
string error_message = 4 [deprecated = true];
bool new_session_initialized = 5;
}

message InitializeFromNIRFSASessionRequest {
string session_name = 1;
nidevice_grpc.Session nirfsa_session = 2;
Expand Down
20 changes: 0 additions & 20 deletions generated/nirfmxinstr/nirfmxinstr_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,26 +1152,6 @@ initialize(const StubPtr& stub, const std::string& resource_name, const std::str
return response;
}

InitializeWithChannelResponse
initialize_with_channel(const StubPtr& stub, const std::string& resource_name, const std::string& option_string, const std::string& channel_name, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior)
{
::grpc::ClientContext context;

auto request = InitializeWithChannelRequest{};
request.set_resource_name(resource_name);
request.set_option_string(option_string);
request.set_channel_name(channel_name);
request.set_initialization_behavior(initialization_behavior);

auto response = InitializeWithChannelResponse{};

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

return response;
}

InitializeFromNIRFSASessionResponse
initialize_from_nirfsa_session(const StubPtr& stub, const nidevice_grpc::Session& nirfsa_session, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior)
{
Expand Down
1 change: 0 additions & 1 deletion generated/nirfmxinstr/nirfmxinstr_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ GetSelfCalibrateLastDateAndTimeResponse get_self_calibrate_last_date_and_time(co
GetSelfCalibrateLastTemperatureResponse get_self_calibrate_last_temperature(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const simple_variant<SelfCalStep, pb::int64>& self_calibrate_step);
GetSignalConfigurationNamesResponse get_signal_configuration_names(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const simple_variant<Personality, pb::int32>& personality_filter);
InitializeResponse initialize(const StubPtr& stub, const std::string& resource_name, const std::string& option_string, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior = nidevice_grpc::SESSION_INITIALIZATION_BEHAVIOR_UNSPECIFIED);
InitializeWithChannelResponse initialize_with_channel(const StubPtr& stub, const std::string& resource_name, const std::string& option_string, const std::string& channel_name, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior = nidevice_grpc::SESSION_INITIALIZATION_BEHAVIOR_UNSPECIFIED);
InitializeFromNIRFSASessionResponse initialize_from_nirfsa_session(const StubPtr& stub, const nidevice_grpc::Session& nirfsa_session, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior = nidevice_grpc::SESSION_INITIALIZATION_BEHAVIOR_UNSPECIFIED);
InitializeFromNIRFSASessionArrayResponse initialize_from_nirfsa_session_array(const StubPtr& stub, const std::vector<nidevice_grpc::Session>& nirfsa_sessions, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior = nidevice_grpc::SESSION_INITIALIZATION_BEHAVIOR_UNSPECIFIED);
IsSelfCalibrateValidResponse is_self_calibrate_valid(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string);
Expand Down
5 changes: 0 additions & 5 deletions generated/nirfmxinstr/nirfmxinstr_compilation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,6 @@ int32 Initialize(char resourceName[], char optionString[], niRFmxInstrHandle* ha
return RFmxInstr_Initialize(resourceName, optionString, handleOut, isNewSession);
}

int32 InitializeWithChannel(char resourceName[], char optionString[], char channelName[], niRFmxInstrHandle* handleOut, int32* isNewSession)
{
return RFmxInstr_InitializeWithChannel(resourceName, optionString, channelName, handleOut, isNewSession);
}

int32 InitializeFromNIRFSASession(uInt32 nirfsaSession, niRFmxInstrHandle* handleOut)
{
return RFmxInstr_InitializeFromNIRFSASession(nirfsaSession, handleOut);
Expand Down
9 changes: 0 additions & 9 deletions generated/nirfmxinstr/nirfmxinstr_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ NiRFmxInstrLibrary::NiRFmxInstrLibrary(std::shared_ptr<nidevice_grpc::SharedLibr
function_pointers_.GetSelfCalibrateLastTemperature = reinterpret_cast<GetSelfCalibrateLastTemperaturePtr>(shared_library_->get_function_pointer("RFmxInstr_GetSelfCalibrateLastTemperature"));
function_pointers_.GetSignalConfigurationNames = reinterpret_cast<GetSignalConfigurationNamesPtr>(shared_library_->get_function_pointer("RFmxInstr_GetSignalConfigurationNames"));
function_pointers_.Initialize = reinterpret_cast<InitializePtr>(shared_library_->get_function_pointer("RFmxInstr_Initialize"));
function_pointers_.InitializeWithChannel = reinterpret_cast<InitializeWithChannelPtr>(shared_library_->get_function_pointer("RFmxInstr_InitializeWithChannel"));
function_pointers_.InitializeFromNIRFSASession = reinterpret_cast<InitializeFromNIRFSASessionPtr>(shared_library_->get_function_pointer("RFmxInstr_InitializeFromNIRFSASession"));
function_pointers_.InitializeFromNIRFSASessionArray = reinterpret_cast<InitializeFromNIRFSASessionArrayPtr>(shared_library_->get_function_pointer("RFmxInstr_InitializeFromNIRFSASessionArray"));
function_pointers_.IsSelfCalibrateValid = reinterpret_cast<IsSelfCalibrateValidPtr>(shared_library_->get_function_pointer("RFmxInstr_IsSelfCalibrateValid"));
Expand Down Expand Up @@ -584,14 +583,6 @@ int32 NiRFmxInstrLibrary::Initialize(char resourceName[], char optionString[], n
return function_pointers_.Initialize(resourceName, optionString, handleOut, isNewSession);
}

int32 NiRFmxInstrLibrary::InitializeWithChannel(char resourceName[], char optionString[], char channelName[], niRFmxInstrHandle* handleOut, int32* isNewSession)
{
if (!function_pointers_.InitializeWithChannel) {
throw nidevice_grpc::LibraryLoadException("Could not find RFmxInstr_InitializeWithChannel.");
}
return function_pointers_.InitializeWithChannel(resourceName, optionString, channelName, handleOut, isNewSession);
}

int32 NiRFmxInstrLibrary::InitializeFromNIRFSASession(uInt32 nirfsaSession, niRFmxInstrHandle* handleOut)
{
if (!function_pointers_.InitializeFromNIRFSASession) {
Expand Down
3 changes: 0 additions & 3 deletions generated/nirfmxinstr/nirfmxinstr_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class NiRFmxInstrLibrary : public nirfmxinstr_grpc::NiRFmxInstrLibraryInterface
int32 GetSelfCalibrateLastTemperature(niRFmxInstrHandle instrumentHandle, char selectorString[], int64 selfCalibrateStep, float64* temperature) override;
int32 GetSignalConfigurationNames(niRFmxInstrHandle instrumentHandle, char selectorString[], int32 personalityFilter, char signalNames[], int32 signalNamesSize, int32* actualSignalNamesSize, int32 personality[], int32 personalityArraySize, int32* actualPersonalityArraySize) override;
int32 Initialize(char resourceName[], char optionString[], niRFmxInstrHandle* handleOut, int32* isNewSession) override;
int32 InitializeWithChannel(char resourceName[], char optionString[], char channelName[], niRFmxInstrHandle* handleOut, int32* isNewSession) override;
int32 InitializeFromNIRFSASession(uInt32 nirfsaSession, niRFmxInstrHandle* handleOut) override;
int32 InitializeFromNIRFSASessionArray(uInt32 nirfsaSessions[], int32 numberOfNIRFSASessions, niRFmxInstrHandle* handleOut) override;
int32 IsSelfCalibrateValid(niRFmxInstrHandle instrumentHandle, char selectorString[], int32* selfCalibrateValid, int32* validSteps) override;
Expand Down Expand Up @@ -175,7 +174,6 @@ class NiRFmxInstrLibrary : public nirfmxinstr_grpc::NiRFmxInstrLibraryInterface
using GetSelfCalibrateLastTemperaturePtr = decltype(&RFmxInstr_GetSelfCalibrateLastTemperature);
using GetSignalConfigurationNamesPtr = decltype(&RFmxInstr_GetSignalConfigurationNames);
using InitializePtr = decltype(&RFmxInstr_Initialize);
using InitializeWithChannelPtr = decltype(&RFmxInstr_InitializeWithChannel);
using InitializeFromNIRFSASessionPtr = decltype(&RFmxInstr_InitializeFromNIRFSASession);
using InitializeFromNIRFSASessionArrayPtr = decltype(&RFmxInstr_InitializeFromNIRFSASessionArray);
using IsSelfCalibrateValidPtr = decltype(&RFmxInstr_IsSelfCalibrateValid);
Expand Down Expand Up @@ -273,7 +271,6 @@ class NiRFmxInstrLibrary : public nirfmxinstr_grpc::NiRFmxInstrLibraryInterface
GetSelfCalibrateLastTemperaturePtr GetSelfCalibrateLastTemperature;
GetSignalConfigurationNamesPtr GetSignalConfigurationNames;
InitializePtr Initialize;
InitializeWithChannelPtr InitializeWithChannel;
InitializeFromNIRFSASessionPtr InitializeFromNIRFSASession;
InitializeFromNIRFSASessionArrayPtr InitializeFromNIRFSASessionArray;
IsSelfCalibrateValidPtr IsSelfCalibrateValid;
Expand Down
1 change: 0 additions & 1 deletion generated/nirfmxinstr/nirfmxinstr_library_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class NiRFmxInstrLibraryInterface {
virtual int32 GetSelfCalibrateLastTemperature(niRFmxInstrHandle instrumentHandle, char selectorString[], int64 selfCalibrateStep, float64* temperature) = 0;
virtual int32 GetSignalConfigurationNames(niRFmxInstrHandle instrumentHandle, char selectorString[], int32 personalityFilter, char signalNames[], int32 signalNamesSize, int32* actualSignalNamesSize, int32 personality[], int32 personalityArraySize, int32* actualPersonalityArraySize) = 0;
virtual int32 Initialize(char resourceName[], char optionString[], niRFmxInstrHandle* handleOut, int32* isNewSession) = 0;
virtual int32 InitializeWithChannel(char resourceName[], char optionString[], char channelName[], niRFmxInstrHandle* handleOut, int32* isNewSession) = 0;
virtual int32 InitializeFromNIRFSASession(uInt32 nirfsaSession, niRFmxInstrHandle* handleOut) = 0;
virtual int32 InitializeFromNIRFSASessionArray(uInt32 nirfsaSessions[], int32 numberOfNIRFSASessions, niRFmxInstrHandle* handleOut) = 0;
virtual int32 IsSelfCalibrateValid(niRFmxInstrHandle instrumentHandle, char selectorString[], int32* selfCalibrateValid, int32* validSteps) = 0;
Expand Down
1 change: 0 additions & 1 deletion generated/nirfmxinstr/nirfmxinstr_mock_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class NiRFmxInstrMockLibrary : public nirfmxinstr_grpc::NiRFmxInstrLibraryInterf
MOCK_METHOD(int32, GetSelfCalibrateLastTemperature, (niRFmxInstrHandle instrumentHandle, char selectorString[], int64 selfCalibrateStep, float64* temperature), (override));
MOCK_METHOD(int32, GetSignalConfigurationNames, (niRFmxInstrHandle instrumentHandle, char selectorString[], int32 personalityFilter, char signalNames[], int32 signalNamesSize, int32* actualSignalNamesSize, int32 personality[], int32 personalityArraySize, int32* actualPersonalityArraySize), (override));
MOCK_METHOD(int32, Initialize, (char resourceName[], char optionString[], niRFmxInstrHandle* handleOut, int32* isNewSession), (override));
MOCK_METHOD(int32, InitializeWithChannel, (char resourceName[], char optionString[], char channelName[], niRFmxInstrHandle* handleOut, int32* isNewSession), (override));
MOCK_METHOD(int32, InitializeFromNIRFSASession, (uInt32 nirfsaSession, niRFmxInstrHandle* handleOut), (override));
MOCK_METHOD(int32, InitializeFromNIRFSASessionArray, (uInt32 nirfsaSessions[], int32 numberOfNIRFSASessions, niRFmxInstrHandle* handleOut), (override));
MOCK_METHOD(int32, IsSelfCalibrateValid, (niRFmxInstrHandle instrumentHandle, char selectorString[], int32* selfCalibrateValid, int32* validSteps), (override));
Expand Down
42 changes: 0 additions & 42 deletions generated/nirfmxinstr/nirfmxinstr_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2110,48 +2110,6 @@ namespace nirfmxinstr_grpc {
}
}

//---------------------------------------------------------------------
//---------------------------------------------------------------------
::grpc::Status NiRFmxInstrService::InitializeWithChannel(::grpc::ServerContext* context, const InitializeWithChannelRequest* request, InitializeWithChannelResponse* response)
{
if (context->IsCancelled()) {
return ::grpc::Status::CANCELLED;
}
try {
auto resource_name_mbcs = convert_from_grpc<std::string>(request->resource_name());
char* resource_name = (char*)resource_name_mbcs.c_str();
auto option_string_mbcs = convert_from_grpc<std::string>(request->option_string());
char* option_string = (char*)option_string_mbcs.c_str();
auto channel_name_mbcs = convert_from_grpc<std::string>(request->channel_name());
char* channel_name = (char*)channel_name_mbcs.c_str();
auto initialization_behavior = request->initialization_behavior();

int32 is_new_session {};
bool new_session_initialized {};
auto init_lambda = [&] () {
niRFmxInstrHandle instrument;
auto status = library_->InitializeWithChannel(resource_name, option_string, channel_name, &instrument, &is_new_session);
return std::make_tuple(status, instrument);
};
std::string grpc_device_session_name = request->session_name();
// Capture the library shared_ptr by value. Do not capture `this` or any references.
LibrarySharedPtr library = library_;
auto cleanup_lambda = [library] (niRFmxInstrHandle id) { library->Close(id, RFMXINSTR_VAL_FALSE); };
int status = session_repository_->add_session(grpc_device_session_name, init_lambda, cleanup_lambda, initialization_behavior, &new_session_initialized);
if (!status_ok(status)) {
return ConvertApiErrorStatusForNiRFmxInstrHandle(context, status, 0);
}
response->set_status(status);
response->mutable_instrument()->set_name(grpc_device_session_name);
response->set_is_new_session(is_new_session);
response->set_new_session_initialized(new_session_initialized);
return ::grpc::Status::OK;
}
catch (nidevice_grpc::NonDriverException& ex) {
return ex.GetStatus();
}
}

//---------------------------------------------------------------------
//---------------------------------------------------------------------
::grpc::Status NiRFmxInstrService::InitializeFromNIRFSASession(::grpc::ServerContext* context, const InitializeFromNIRFSASessionRequest* request, InitializeFromNIRFSASessionResponse* response)
Expand Down
1 change: 0 additions & 1 deletion generated/nirfmxinstr/nirfmxinstr_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class NiRFmxInstrService final : public NiRFmxInstr::Service {
::grpc::Status GetSelfCalibrateLastTemperature(::grpc::ServerContext* context, const GetSelfCalibrateLastTemperatureRequest* request, GetSelfCalibrateLastTemperatureResponse* response) override;
::grpc::Status GetSignalConfigurationNames(::grpc::ServerContext* context, const GetSignalConfigurationNamesRequest* request, GetSignalConfigurationNamesResponse* response) override;
::grpc::Status Initialize(::grpc::ServerContext* context, const InitializeRequest* request, InitializeResponse* response) override;
::grpc::Status InitializeWithChannel(::grpc::ServerContext* context, const InitializeWithChannelRequest* request, InitializeWithChannelResponse* response) override;
::grpc::Status InitializeFromNIRFSASession(::grpc::ServerContext* context, const InitializeFromNIRFSASessionRequest* request, InitializeFromNIRFSASessionResponse* response) override;
::grpc::Status InitializeFromNIRFSASessionArray(::grpc::ServerContext* context, const InitializeFromNIRFSASessionArrayRequest* request, InitializeFromNIRFSASessionArrayResponse* response) override;
::grpc::Status IsSelfCalibrateValid(::grpc::ServerContext* context, const IsSelfCalibrateValidRequest* request, IsSelfCalibrateValidResponse* response) override;
Expand Down
7 changes: 0 additions & 7 deletions imports/include/niRFmxInstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,6 @@ extern "C"
char optionString[],
niRFmxInstrHandle *handleOut,
int32 *isNewSession);

int32 __stdcall RFmxInstr_InitializeWithChannel(
char resourceName[],
char optionString[],
char channelName[],
niRFmxInstrHandle* handleOut,
int32* isNewSession);

int32 __stdcall RFmxInstr_InitializeFromNIRFSASession(
uInt32 NIRFSASession,
Expand Down
55 changes: 0 additions & 55 deletions source/codegen/metadata/nirfmxinstr/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,61 +1760,6 @@
}
],
'returns': 'int32'
},
'InitializeWithChannel': {
'custom_close': 'Close(id, RFMXINSTR_VAL_FALSE)',
'init_method': True,
'parameters': [
{
'direction': 'in',
'name': 'resourceName',
'type': 'char[]'
},
{
'direction': 'in',
'name': 'optionString',
'type': 'char[]'
},
{
'direction': 'in',
'name': 'channelName',
'type': 'char[]'
},
{
'direction': 'out',
'grpc_name': 'instrument',
'name': 'handleOut',
'type': 'niRFmxInstrHandle'
},
{
'direction': 'out',
'name': 'isNewSession',
'type': 'int32'
},
{
'direction': 'out',
'get_last_error': 'deprecated',
'name': 'errorMessage',
'type': 'char[]'
},
{
'cppName': 'initializationBehavior',
'direction': 'in',
'grpc_type': 'nidevice_grpc.SessionInitializationBehavior',
'name': 'initializationBehavior',
'proto_only': True,
'type': 'int32'
},
{
'cppName': 'newSessionInitialized',
'direction': 'out',
'grpc_type': 'bool',
'name': 'newSessionInitialized',
'proto_only': True,
'type': 'bool'
}
],
'returns': 'int32'
},
'InitializeFromNIRFSASession': {
'custom_close': 'Close(id, RFMXINSTR_VAL_FALSE)',
Expand Down

0 comments on commit 854e4fc

Please sign in to comment.