Skip to content

Commit

Permalink
Instr Save Load Configurations API grpvcc device code (#1046)
Browse files Browse the repository at this point in the history
* Instr Save Load Configurations API grpvcc device code

* Updated Functions.py file
  • Loading branch information
Udeepchandra authored Mar 15, 2024
1 parent feb8b79 commit b16c773
Show file tree
Hide file tree
Showing 15 changed files with 329 additions and 187 deletions.
50 changes: 32 additions & 18 deletions generated/nirfmxinstr/nirfmxinstr.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

//---------------------------------------------------------------------
// This file is generated from NI-RFMXINSTR API metadata version 23.8.0
// This file is generated from NI-RFMXINSTR API metadata version 24.3.0
//---------------------------------------------------------------------
// Proto file for the NI-RFMXINSTR Metadata
//---------------------------------------------------------------------
Expand Down Expand Up @@ -41,6 +41,7 @@ service NiRFmxInstr {
rpc DisableCalibrationPlane(DisableCalibrationPlaneRequest) returns (DisableCalibrationPlaneResponse);
rpc EnableCalibrationPlane(EnableCalibrationPlaneRequest) returns (EnableCalibrationPlaneResponse);
rpc ExportSignal(ExportSignalRequest) returns (ExportSignalResponse);
rpc FetchRawIQData(FetchRawIQDataRequest) returns (FetchRawIQDataResponse);
rpc GetAttributeF32(GetAttributeF32Request) returns (GetAttributeF32Response);
rpc GetAttributeF32Array(GetAttributeF32ArrayRequest) returns (GetAttributeF32ArrayResponse);
rpc GetAttributeF64(GetAttributeF64Request) returns (GetAttributeF64Response);
Expand Down Expand Up @@ -78,6 +79,7 @@ service NiRFmxInstr {
rpc InitializeFromNIRFSASessionArray(InitializeFromNIRFSASessionArrayRequest) returns (InitializeFromNIRFSASessionArrayResponse);
rpc IsSelfCalibrateValid(IsSelfCalibrateValidRequest) returns (IsSelfCalibrateValidResponse);
rpc LoadAllConfigurations(LoadAllConfigurationsRequest) returns (LoadAllConfigurationsResponse);
rpc LoadConfigurations(LoadConfigurationsRequest) returns (LoadConfigurationsResponse);
rpc LoadSParameterExternalAttenuationTableFromS2PFile(LoadSParameterExternalAttenuationTableFromS2PFileRequest) returns (LoadSParameterExternalAttenuationTableFromS2PFileResponse);
rpc ResetAttribute(ResetAttributeRequest) returns (ResetAttributeResponse);
rpc ResetDriver(ResetDriverRequest) returns (ResetDriverResponse);
Expand Down Expand Up @@ -112,7 +114,6 @@ service NiRFmxInstr {
rpc TimestampFromValues(TimestampFromValuesRequest) returns (TimestampFromValuesResponse);
rpc ValuesFromTimestamp(ValuesFromTimestampRequest) returns (ValuesFromTimestampResponse);
rpc WaitForAcquisitionComplete(WaitForAcquisitionCompleteRequest) returns (WaitForAcquisitionCompleteResponse);
rpc FetchRawIQData(FetchRawIQDataRequest) returns (FetchRawIQDataResponse);
}

enum NiRFmxInstrAttribute {
Expand Down Expand Up @@ -213,6 +214,7 @@ enum NiRFmxInstrAttribute {
NIRFMXINSTR_ATTRIBUTE_TEMPERATURE_READ_INTERVAL = 119;
NIRFMXINSTR_ATTRIBUTE_THERMAL_CORRECTION_TEMPERATURE_RESOLUTION = 120;
NIRFMXINSTR_ATTRIBUTE_NUMBER_OF_RAW_IQ_RECORDS = 128;
NIRFMXINSTR_ATTRIBUTE_LOAD_OPTIONS = 163;
}

enum ExportSignalSource {
Expand Down Expand Up @@ -279,6 +281,7 @@ enum Personality {
PERSONALITY_PULSE = 2048;
PERSONALITY_SPECAN = 1;
PERSONALITY_TDSCDMA = 64;
PERSONALITY_UWB = 8192;
PERSONALITY_VNA = 4096;
PERSONALITY_WCDMA = 16;
PERSONALITY_WLAN = 512;
Expand Down Expand Up @@ -396,6 +399,8 @@ enum NiRFmxInstrInt32AttributeValues {
NIRFMXINSTR_INT32_LO_SHARING_MODE_DISABLED = 0;
NIRFMXINSTR_INT32_LO_SHARING_MODE_EXTERNAL_DAISY_CHAIN = 4;
NIRFMXINSTR_INT32_LO_SHARING_MODE_EXTERNAL_STAR = 3;
NIRFMXINSTR_INT32_LOAD_OPTIONS_SKIP_NONE = 0;
NIRFMXINSTR_INT32_LOAD_OPTIONS_SKIP_RFINSTR = 1;
NIRFMXINSTR_INT32_MECHANICAL_ATTENUATION_AUTO_FALSE = 0;
NIRFMXINSTR_INT32_MECHANICAL_ATTENUATION_AUTO_TRUE = 1;
NIRFMXINSTR_INT32_OPTIMIZE_PATH_FOR_SIGNAL_BANDWIDTH_DISABLED = 0;
Expand Down Expand Up @@ -694,6 +699,22 @@ message ExportSignalResponse {
int32 status = 1;
}

message FetchRawIQDataRequest {
nidevice_grpc.Session instrument = 1;
string selector_string = 2;
double timeout = 3;
int32 records_to_fetch = 4;
int64 samples_to_read = 5;
}

message FetchRawIQDataResponse {
int32 status = 1;
double x0 = 2;
double dx = 3;
repeated nidevice_grpc.NIComplexNumberF32 data = 4;
int32 actual_array_size = 5;
}

message GetAttributeF32Request {
nidevice_grpc.Session instrument = 1;
string channel_name = 2;
Expand Down Expand Up @@ -1134,6 +1155,15 @@ message LoadAllConfigurationsResponse {
int32 status = 1;
}

message LoadConfigurationsRequest {
nidevice_grpc.Session instrument = 1;
string file_path = 2;
}

message LoadConfigurationsResponse {
int32 status = 1;
}

message LoadSParameterExternalAttenuationTableFromS2PFileRequest {
nidevice_grpc.Session instrument = 1;
string selector_string = 2;
Expand Down Expand Up @@ -1503,19 +1533,3 @@ message WaitForAcquisitionCompleteResponse {
int32 status = 1;
}

message FetchRawIQDataRequest {
nidevice_grpc.Session instrument = 1;
string selector_string = 2;
double timeout = 3;
int32 records_to_fetch = 4;
int64 samples_to_read = 5;
}

message FetchRawIQDataResponse {
int32 status = 1;
double x0 = 2;
double dx = 3;
repeated nidevice_grpc.NIComplexNumberF32 data = 4;
int32 actual_array_size = 5;
}

60 changes: 39 additions & 21 deletions generated/nirfmxinstr/nirfmxinstr_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,27 @@ export_signal(const StubPtr& stub, const nidevice_grpc::Session& instrument, con
return response;
}

FetchRawIQDataResponse
fetch_raw_iq_data(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const double& timeout, const pb::int32& records_to_fetch, const pb::int64& samples_to_read)
{
::grpc::ClientContext context;

auto request = FetchRawIQDataRequest{};
request.mutable_instrument()->CopyFrom(instrument);
request.set_selector_string(selector_string);
request.set_timeout(timeout);
request.set_records_to_fetch(records_to_fetch);
request.set_samples_to_read(samples_to_read);

auto response = FetchRawIQDataResponse{};

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

return response;
}

GetAttributeF32Response
get_attribute_f32(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& channel_name, const NiRFmxInstrAttribute& attribute_id)
{
Expand Down Expand Up @@ -1225,6 +1246,24 @@ load_all_configurations(const StubPtr& stub, const nidevice_grpc::Session& instr
return response;
}

LoadConfigurationsResponse
load_configurations(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& file_path)
{
::grpc::ClientContext context;

auto request = LoadConfigurationsRequest{};
request.mutable_instrument()->CopyFrom(instrument);
request.set_file_path(file_path);

auto response = LoadConfigurationsResponse{};

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

return response;
}

LoadSParameterExternalAttenuationTableFromS2PFileResponse
load_s_parameter_external_attenuation_table_from_s2p_file(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const std::string& table_name, const std::string& s2p_file_path, const simple_variant<SParameterOrientation, pb::int32>& s_parameter_orientation)
{
Expand Down Expand Up @@ -1917,26 +1956,5 @@ wait_for_acquisition_complete(const StubPtr& stub, const nidevice_grpc::Session&
return response;
}

FetchRawIQDataResponse
fetch_raw_iq_data(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const double& timeout, const pb::int32& records_to_fetch, const pb::int64& samples_to_read)
{
::grpc::ClientContext context;

auto request = FetchRawIQDataRequest{};
request.mutable_instrument()->CopyFrom(instrument);
request.set_selector_string(selector_string);
request.set_timeout(timeout);
request.set_records_to_fetch(records_to_fetch);
request.set_samples_to_read(samples_to_read);

auto response = FetchRawIQDataResponse{};

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

return response;
}


} // namespace nirfmxinstr_grpc::experimental::client
3 changes: 2 additions & 1 deletion generated/nirfmxinstr/nirfmxinstr_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ DeleteExternalAttenuationTableResponse delete_external_attenuation_table(const S
DisableCalibrationPlaneResponse disable_calibration_plane(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string);
EnableCalibrationPlaneResponse enable_calibration_plane(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string);
ExportSignalResponse export_signal(const StubPtr& stub, const nidevice_grpc::Session& instrument, const simple_variant<ExportSignalSource, pb::int32>& export_signal_source, const simple_variant<OutputTerminal, std::string>& export_signal_output_terminal);
FetchRawIQDataResponse fetch_raw_iq_data(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const double& timeout, const pb::int32& records_to_fetch, const pb::int64& samples_to_read);
GetAttributeF32Response get_attribute_f32(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& channel_name, const NiRFmxInstrAttribute& attribute_id);
GetAttributeF32ArrayResponse get_attribute_f32_array(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& channel_name, const NiRFmxInstrAttribute& attribute_id);
GetAttributeF64Response get_attribute_f64(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& channel_name, const NiRFmxInstrAttribute& attribute_id);
Expand Down Expand Up @@ -82,6 +83,7 @@ InitializeFromNIRFSASessionResponse initialize_from_nirfsa_session(const StubPtr
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);
LoadAllConfigurationsResponse load_all_configurations(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& file_path, const pb::int32& load_rf_instr_configuration);
LoadConfigurationsResponse load_configurations(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& file_path);
LoadSParameterExternalAttenuationTableFromS2PFileResponse load_s_parameter_external_attenuation_table_from_s2p_file(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const std::string& table_name, const std::string& s2p_file_path, const simple_variant<SParameterOrientation, pb::int32>& s_parameter_orientation);
ResetAttributeResponse reset_attribute(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& channel_name, const NiRFmxInstrAttribute& attribute_id);
ResetDriverResponse reset_driver(const StubPtr& stub, const nidevice_grpc::Session& instrument);
Expand Down Expand Up @@ -116,7 +118,6 @@ SetAttributeU8ArrayResponse set_attribute_u8_array(const StubPtr& stub, const ni
TimestampFromValuesResponse timestamp_from_values(const StubPtr& stub, const pb::int64& seconds_since_1970, const double& fractional_seconds);
ValuesFromTimestampResponse values_from_timestamp(const StubPtr& stub, const google::protobuf::Timestamp& timestamp);
WaitForAcquisitionCompleteResponse wait_for_acquisition_complete(const StubPtr& stub, const nidevice_grpc::Session& instrument, const double& timeout);
FetchRawIQDataResponse fetch_raw_iq_data(const StubPtr& stub, const nidevice_grpc::Session& instrument, const std::string& selector_string, const double& timeout, const pb::int32& records_to_fetch, const pb::int64& samples_to_read);

} // namespace nirfmxinstr_grpc::experimental::client

Expand Down
15 changes: 10 additions & 5 deletions generated/nirfmxinstr/nirfmxinstr_compilation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ int32 ExportSignal(niRFmxInstrHandle instrumentHandle, int32 exportSignalSource,
return RFmxInstr_ExportSignal(instrumentHandle, exportSignalSource, exportSignalOutputTerminal);
}

int32 FetchRawIQData(niRFmxInstrHandle instrumentHandle, char selectorString[], float64 timeout, int32 recordsToFetch, int64 samplesToRead, float64* x0, float64* dx, NIComplexSingle data[], int32 arraySize, int32* actualArraySize, void* reserved)
{
return RFmxInstr_FetchRawIQData(instrumentHandle, selectorString, timeout, recordsToFetch, samplesToRead, x0, dx, data, arraySize, actualArraySize, reserved);
}

int32 GetAttributeF32(niRFmxInstrHandle instrumentHandle, char channelName[], int32 attributeID, float32* attrVal)
{
return RFmxInstr_GetAttributeF32(instrumentHandle, channelName, attributeID, attrVal);
Expand Down Expand Up @@ -307,6 +312,11 @@ int32 LoadAllConfigurations(niRFmxInstrHandle instrumentHandle, char filePath[],
return RFmxInstr_LoadAllConfigurations(instrumentHandle, filePath, loadRFInstrConfiguration);
}

int32 LoadConfigurations(niRFmxInstrHandle instrumentHandle, char filePath[])
{
return RFmxInstr_LoadConfigurations(instrumentHandle, filePath);
}

int32 LoadSParameterExternalAttenuationTableFromS2PFile(niRFmxInstrHandle instrumentHandle, char selectorString[], char tableName[], char s2PFilePath[], int32 sParameterOrientation)
{
return RFmxInstr_LoadSParameterExternalAttenuationTableFromS2PFile(instrumentHandle, selectorString, tableName, s2PFilePath, sParameterOrientation);
Expand Down Expand Up @@ -477,9 +487,4 @@ int32 WaitForAcquisitionComplete(niRFmxInstrHandle instrumentHandle, float64 tim
return RFmxInstr_WaitForAcquisitionComplete(instrumentHandle, timeout);
}

int32 FetchRawIQData(niRFmxInstrHandle instrumentHandle, char selectorString[], float64 timeout, int32 recordsToFetch, int64 samplesToRead, float64* x0, float64* dx, NIComplexSingle data[], int32 arraySize, int32* actualArraySize, void* reserved)
{
return RFmxInstr_FetchRawIQData(instrumentHandle, selectorString, timeout, recordsToFetch, samplesToRead, x0, dx, data, arraySize, actualArraySize, reserved);
}

} // namespace nirfmxinstr_grpc
27 changes: 18 additions & 9 deletions generated/nirfmxinstr/nirfmxinstr_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ NiRFmxInstrLibrary::NiRFmxInstrLibrary(std::shared_ptr<nidevice_grpc::SharedLibr
function_pointers_.DisableCalibrationPlane = reinterpret_cast<DisableCalibrationPlanePtr>(shared_library_->get_function_pointer("RFmxInstr_DisableCalibrationPlane"));
function_pointers_.EnableCalibrationPlane = reinterpret_cast<EnableCalibrationPlanePtr>(shared_library_->get_function_pointer("RFmxInstr_EnableCalibrationPlane"));
function_pointers_.ExportSignal = reinterpret_cast<ExportSignalPtr>(shared_library_->get_function_pointer("RFmxInstr_ExportSignal"));
function_pointers_.FetchRawIQData = reinterpret_cast<FetchRawIQDataPtr>(shared_library_->get_function_pointer("RFmxInstr_FetchRawIQData"));
function_pointers_.GetAttributeF32 = reinterpret_cast<GetAttributeF32Ptr>(shared_library_->get_function_pointer("RFmxInstr_GetAttributeF32"));
function_pointers_.GetAttributeF32Array = reinterpret_cast<GetAttributeF32ArrayPtr>(shared_library_->get_function_pointer("RFmxInstr_GetAttributeF32Array"));
function_pointers_.GetAttributeF64 = reinterpret_cast<GetAttributeF64Ptr>(shared_library_->get_function_pointer("RFmxInstr_GetAttributeF64"));
Expand Down Expand Up @@ -87,6 +88,7 @@ NiRFmxInstrLibrary::NiRFmxInstrLibrary(std::shared_ptr<nidevice_grpc::SharedLibr
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"));
function_pointers_.LoadAllConfigurations = reinterpret_cast<LoadAllConfigurationsPtr>(shared_library_->get_function_pointer("RFmxInstr_LoadAllConfigurations"));
function_pointers_.LoadConfigurations = reinterpret_cast<LoadConfigurationsPtr>(shared_library_->get_function_pointer("RFmxInstr_LoadConfigurations"));
function_pointers_.LoadSParameterExternalAttenuationTableFromS2PFile = reinterpret_cast<LoadSParameterExternalAttenuationTableFromS2PFilePtr>(shared_library_->get_function_pointer("RFmxInstr_LoadSParameterExternalAttenuationTableFromS2PFile"));
function_pointers_.ResetAttribute = reinterpret_cast<ResetAttributePtr>(shared_library_->get_function_pointer("RFmxInstr_ResetAttribute"));
function_pointers_.ResetDriver = reinterpret_cast<ResetDriverPtr>(shared_library_->get_function_pointer("RFmxInstr_ResetDriver"));
Expand Down Expand Up @@ -121,7 +123,6 @@ NiRFmxInstrLibrary::NiRFmxInstrLibrary(std::shared_ptr<nidevice_grpc::SharedLibr
function_pointers_.TimestampFromValues = reinterpret_cast<TimestampFromValuesPtr>(shared_library_->get_function_pointer("RFmxInstr_TimestampFromValues"));
function_pointers_.ValuesFromTimestamp = reinterpret_cast<ValuesFromTimestampPtr>(shared_library_->get_function_pointer("RFmxInstr_ValuesFromTimestamp"));
function_pointers_.WaitForAcquisitionComplete = reinterpret_cast<WaitForAcquisitionCompletePtr>(shared_library_->get_function_pointer("RFmxInstr_WaitForAcquisitionComplete"));
function_pointers_.FetchRawIQData = reinterpret_cast<FetchRawIQDataPtr>(shared_library_->get_function_pointer("RFmxInstr_FetchRawIQData"));
}

NiRFmxInstrLibrary::~NiRFmxInstrLibrary()
Expand Down Expand Up @@ -319,6 +320,14 @@ int32 NiRFmxInstrLibrary::ExportSignal(niRFmxInstrHandle instrumentHandle, int32
return function_pointers_.ExportSignal(instrumentHandle, exportSignalSource, exportSignalOutputTerminal);
}

int32 NiRFmxInstrLibrary::FetchRawIQData(niRFmxInstrHandle instrumentHandle, char selectorString[], float64 timeout, int32 recordsToFetch, int64 samplesToRead, float64* x0, float64* dx, NIComplexSingle data[], int32 arraySize, int32* actualArraySize, void* reserved)
{
if (!function_pointers_.FetchRawIQData) {
throw nidevice_grpc::LibraryLoadException("Could not find RFmxInstr_FetchRawIQData.");
}
return function_pointers_.FetchRawIQData(instrumentHandle, selectorString, timeout, recordsToFetch, samplesToRead, x0, dx, data, arraySize, actualArraySize, reserved);
}

int32 NiRFmxInstrLibrary::GetAttributeF32(niRFmxInstrHandle instrumentHandle, char channelName[], int32 attributeID, float32* attrVal)
{
if (!function_pointers_.GetAttributeF32) {
Expand Down Expand Up @@ -615,6 +624,14 @@ int32 NiRFmxInstrLibrary::LoadAllConfigurations(niRFmxInstrHandle instrumentHand
return function_pointers_.LoadAllConfigurations(instrumentHandle, filePath, loadRFInstrConfiguration);
}

int32 NiRFmxInstrLibrary::LoadConfigurations(niRFmxInstrHandle instrumentHandle, char filePath[])
{
if (!function_pointers_.LoadConfigurations) {
throw nidevice_grpc::LibraryLoadException("Could not find RFmxInstr_LoadConfigurations.");
}
return function_pointers_.LoadConfigurations(instrumentHandle, filePath);
}

int32 NiRFmxInstrLibrary::LoadSParameterExternalAttenuationTableFromS2PFile(niRFmxInstrHandle instrumentHandle, char selectorString[], char tableName[], char s2PFilePath[], int32 sParameterOrientation)
{
if (!function_pointers_.LoadSParameterExternalAttenuationTableFromS2PFile) {
Expand Down Expand Up @@ -887,12 +904,4 @@ int32 NiRFmxInstrLibrary::WaitForAcquisitionComplete(niRFmxInstrHandle instrumen
return function_pointers_.WaitForAcquisitionComplete(instrumentHandle, timeout);
}

int32 NiRFmxInstrLibrary::FetchRawIQData(niRFmxInstrHandle instrumentHandle, char selectorString[], float64 timeout, int32 recordsToFetch, int64 samplesToRead, float64* x0, float64* dx, NIComplexSingle data[], int32 arraySize, int32* actualArraySize, void* reserved)
{
if (!function_pointers_.FetchRawIQData) {
throw nidevice_grpc::LibraryLoadException("Could not find RFmxInstr_FetchRawIQData.");
}
return function_pointers_.FetchRawIQData(instrumentHandle, selectorString, timeout, recordsToFetch, samplesToRead, x0, dx, data, arraySize, actualArraySize, reserved);
}

} // namespace nirfmxinstr_grpc
Loading

0 comments on commit b16c773

Please sign in to comment.