RPS Client Header File (rps_client.h)
- Mise à jour2024-07-03
- Temps de lecture : 2 minute(s)
You can use this example C++ client file as the basis for your RPS client header file.
Save this file as rps_client.h and put it in the same directory as the code you create in Using Reference Examples with Your System. You will also require a an RPS client file (rps_client.cpp). Refer to the gRPC Open Source Framework Website for more information about gRPC client and header files.
#pragma once
#include <memory>
#include <vector>
#include <grpcpp/grpcpp.h>
#include "rps.pb.h"
#include "rps.grpc.pb.h"
#include "rps_enums.h"
class RpsClient
{
private:
std::unique_ptr<rps_grpc::RpsService::Stub> stub_;
public:
rps_grpc::Session session_;
int status;
//////////////////// Constructor/Destructor ////////////////////
RpsClient(std::shared_ptr<grpc::Channel> channel);
~RpsClient();
//////////////////// Server ////////////////////
int ServerGetStatus(bool& ready, std::string& message);
//////////////////// Core ////////////////////
int Abort();
int Close();
int Commit();
int GetStatus(std::vector<int32_t>& logged_statuses, std::string& state, bool& ready, bool& done,
std::vector<std::string>& acquisition_tasks, bool& acquisition_tasks_done, std::vector<bool>& overflows);
int Initialize(std::string session_name, std::string options = "");
int Start();
//////////////////// Acquisition ////////////////////
int AcquisitionFetchIQ(std::string task_name, rps_grpc::AcquisitionFetchIQResponse& response);
int AcquisitionGetStatus(std::string task_name, rps_grpc::AcquisitionGetStatusResponse& response);
int AcquisitionSetBandwidth(std::string task_name, int64_t bandwidth_hz);
int AcquisitionSetFetchSize(std::string task_name, uint64_t fetch_size);
int AcquisitionSetFrequency(std::string task_name, double center_frequency_hz);
int AcquisitionSetFrequencies(std::string task_name, std::vector<double> center_frequency_hz);
int AcquisitionSetLO(std::string task_name, RpsType::LOType lo_type, std::string lo = "");
int AcquisitionSetPhaseCal(std::string task_name, RpsType::PhaseCalType type, std::string data = "");
int AcquisitionSetReferenceClock(std::string task_name, std::string reference_clock);
int AcquisitionSetReferenceLevel(std::string task_name, double reference_level);
int AcquisitionSetSampleRate(std::string task_name, int64_t sample_rate);
int AcquisitionCreateTask(std::string task_name, std::string instrument_names, std::string option_string = "");
//////////////////// Sync ////////////////////
int SynchronizationCreateConfiguration (RpsType::SynchronizationType sync_config_type);
int SynchronizationSetMasterTask (std::string task_name);
int SynchronizationSetSlaveTask (std::string task_name);
//////////////////// Stream ////////////////////
int StreamCreateConfiguration(std::string configuration_name, rps_grpc::StreamType configuration_type,
rps_grpc::Unit length_unit, int64_t length);
int StreamSetDestinationEndpoint(std::string configuration_name, rps_grpc::StreamDestinationEndpoint endpoint,
std::string data);
int StreamSetSourceEndpoint(std::string configuration_name, rps_grpc::StreamSourceEndpoint endpoint,
std::string data);
int StreamGetStatus(std::string configuration_name, int32_t& stream_status,
std::vector<std::string>& task_names, std::vector<std::string>& instr_names,
std::vector<uint64_t>& samples_to_stream, std::vector<uint64_t>& samples_streamed,
std::vector<bool>& overflow, bool& any_overflow, bool& done);
//////////////////// Advanced ////////////////////
int GetErrorString(int32_t error_code, std::string& error_string);
int Message(std::string name, std::string& data);
};
Contenu associé
- gRPC Open Source Framework Website
- Using Reference Examples with Your System
Use the RF Recording Software reference examples for your application.