сделал чтение настроек, удалил пару рудиментов
This commit is contained in:
40
dependencies/control_system/client/main.cpp
vendored
40
dependencies/control_system/client/main.cpp
vendored
@@ -6,6 +6,46 @@ std::shared_mutex mtx;
|
||||
TSID sid_counter { 0 };
|
||||
std::map<TSID, std::unique_ptr<system_client>> clients;
|
||||
|
||||
|
||||
EXTERNC CP_Result CP_SetBUC_LNB_settings(TSID sid, buc_lnb_settings &settings){
|
||||
std::shared_lock lock(mtx);
|
||||
try
|
||||
{
|
||||
if (clients.find(sid) == clients.end())
|
||||
return ERROR;
|
||||
auto settings_ = reinterpret_cast<buc_lnb_settings_com&>(settings);
|
||||
auto resp = clients[sid]->send_set_buc_lnb_settings(settings_);
|
||||
if (resp == response_type::error)
|
||||
return ERROR;
|
||||
return OK;
|
||||
}
|
||||
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
EXTERNC CP_Result CP_GetBUC_LNB_settings(TSID sid, buc_lnb_settings &settings){
|
||||
std::shared_lock lock(mtx);
|
||||
try
|
||||
{
|
||||
if (clients.find(sid) == clients.end())
|
||||
return ERROR;
|
||||
|
||||
buc_lnb_settings_com settings_com;
|
||||
auto resp = clients[sid]->send_get_buc_lnb_settings(settings_com);
|
||||
|
||||
if (resp == response_type::error)
|
||||
return ERROR;
|
||||
settings = reinterpret_cast<buc_lnb_settings&>(settings_com);
|
||||
return OK;
|
||||
}
|
||||
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
EXTERNC CP_Result CP_SetModulatorSettings(TSID sid, modulator_settings& settings){
|
||||
std::shared_lock lock(mtx);
|
||||
try
|
||||
|
@@ -337,6 +337,17 @@ void system_client::data_received(const std::vector<uint8_t> & data)
|
||||
break;
|
||||
}
|
||||
|
||||
case cmd_type::get_lnb_buc_settings:
|
||||
{
|
||||
if(cmd.rsp == response_type::ok)
|
||||
{
|
||||
cmd_lnb_buc_settings value;
|
||||
iarchive(value);
|
||||
data_from_serv = value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case cmd_type::get_demodulator_settings:
|
||||
{
|
||||
if(cmd.rsp == response_type::ok)
|
||||
@@ -801,7 +812,6 @@ response_type system_client::send_get_demodulator_settings(demodulator_settings_
|
||||
cmd_header cmd_dpdi_header{curr_id, cmd_type::get_demodulator_settings};
|
||||
cmd_demodulator_settings demodulator;
|
||||
send_to_socket(cmd_dpdi_header, demodulator);
|
||||
std::cout << "END GET_DEMODULATOR SETTINGS SEND TO SOCKET" << std::endl;
|
||||
std::any data_from_serv;
|
||||
|
||||
auto result = wait_for_response(curr_id, cmd_type::get_demodulator_settings, data_from_serv);
|
||||
@@ -841,6 +851,39 @@ response_type system_client::send_get_modulator_state(modulator_state_com &modul
|
||||
return result;
|
||||
}
|
||||
|
||||
response_type system_client::send_set_buc_lnb_settings(buc_lnb_settings_com &settings){
|
||||
std::scoped_lock lock(cmd_in_progress_mtx);
|
||||
uint32_t curr_id { ++cmd_id };
|
||||
cmd_header cmd_acm_header{curr_id, cmd_type::set_lnb_buc_settings};
|
||||
|
||||
cmd_lnb_buc_settings settings_;
|
||||
settings_.buc_lnb = settings;
|
||||
send_to_socket(cmd_acm_header, settings_);
|
||||
|
||||
std::any data_to_serv;
|
||||
|
||||
auto result = wait_for_response(curr_id, cmd_type::set_lnb_buc_settings, data_to_serv);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
response_type system_client::send_get_buc_lnb_settings(buc_lnb_settings_com &settings){
|
||||
std::scoped_lock lock(cmd_in_progress_mtx);
|
||||
uint32_t curr_id { ++cmd_id };
|
||||
cmd_header cmd_buc_lnb_header{curr_id, cmd_type::get_lnb_buc_settings};
|
||||
cmd_lnb_buc_settings lnb_buc;
|
||||
send_to_socket(cmd_buc_lnb_header, lnb_buc);
|
||||
|
||||
std::any data_from_serv;
|
||||
|
||||
auto result = wait_for_response(curr_id, cmd_type::get_lnb_buc_settings, data_from_serv);
|
||||
if (data_from_serv.has_value())
|
||||
settings = std::any_cast<cmd_lnb_buc_settings>(data_from_serv).buc_lnb;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
response_type system_client::send_get_device_state(device_state_com &device_state ){
|
||||
std::scoped_lock lock(cmd_in_progress_mtx);
|
||||
uint32_t curr_id { ++cmd_id };
|
||||
|
@@ -59,6 +59,8 @@ public:
|
||||
response_type send_get_modulator_settings(modulator_settings_com &settings);
|
||||
response_type send_get_demodulator_settings(demodulator_settings_com &settings);
|
||||
|
||||
response_type send_set_buc_lnb_settings(buc_lnb_settings_com &settings);
|
||||
response_type send_get_buc_lnb_settings(buc_lnb_settings_com &settings);
|
||||
|
||||
response_type send_set_dpdi_params(dpdi_parameters &dpdi_params);
|
||||
response_type send_get_dpdi_params(dpdi_parameters &dpdi_params);
|
||||
|
@@ -120,6 +120,21 @@ struct device_state_com{
|
||||
double pl_temp;
|
||||
};
|
||||
|
||||
enum class voltage_lnb_com{
|
||||
DISABLE = 0, _13V, _18V, _24V
|
||||
};
|
||||
enum class voltage_buc_com{
|
||||
DISABLE = 0, _24V, _48V
|
||||
};
|
||||
struct buc_lnb_settings_com
|
||||
{
|
||||
voltage_lnb_com lnb;
|
||||
bool is_ref_10MHz_lnb = false;
|
||||
voltage_buc_com buc;
|
||||
bool is_ref_10MHz_buc = false;
|
||||
bool is_ref_10MHz_output = false;
|
||||
bool is_save_current_state = false;
|
||||
};
|
||||
enum class name_classes_qos
|
||||
{
|
||||
realtime1 = 0,
|
||||
@@ -373,7 +388,9 @@ enum class cmd_type
|
||||
set_modulator_settings = 35,
|
||||
set_demodulator_settings = 36,
|
||||
get_modulator_settings = 37,
|
||||
get_demodulator_settings = 38
|
||||
get_demodulator_settings = 38,
|
||||
set_lnb_buc_settings = 39,
|
||||
get_lnb_buc_settings = 40
|
||||
};
|
||||
|
||||
struct cmd_lbq_params
|
||||
@@ -387,6 +404,15 @@ struct cmd_lbq_params
|
||||
}
|
||||
};
|
||||
|
||||
struct cmd_lnb_buc_settings{
|
||||
buc_lnb_settings_com buc_lnb;
|
||||
template<class Archive>
|
||||
void serialize(Archive & archive)
|
||||
{
|
||||
archive(buc_lnb.buc, buc_lnb.is_ref_10MHz_buc, buc_lnb.lnb,buc_lnb.is_ref_10MHz_lnb, buc_lnb.is_ref_10MHz_output, buc_lnb.is_save_current_state);
|
||||
}
|
||||
};
|
||||
|
||||
struct cmd_get_cinc_state
|
||||
{
|
||||
CinC_state_com cinc_state;
|
||||
|
@@ -156,6 +156,25 @@ struct demodulator_settings
|
||||
EXTERNC CP_Result CP_SetDemodulatorSettings(TSID sid, demodulator_settings& settings);
|
||||
EXTERNC CP_Result CP_GetDemodulatorSettings(TSID sid, demodulator_settings& settings);
|
||||
|
||||
enum class voltage_lnb{
|
||||
DISABLE = 0, _13V, _18V, _24V
|
||||
};
|
||||
enum class voltage_buc{
|
||||
DISABLE = 0, _24V, _48V
|
||||
};
|
||||
struct buc_lnb_settings
|
||||
{
|
||||
voltage_lnb lnb;
|
||||
bool is_ref_10MHz_lnb = false;
|
||||
voltage_buc buc;
|
||||
bool is_ref_10MHz_buc = false;
|
||||
bool is_ref_10MHz_output = false;
|
||||
bool is_save_current_state = false;
|
||||
};
|
||||
|
||||
EXTERNC CP_Result CP_SetBUC_LNB_settings(TSID sid, buc_lnb_settings &settings);
|
||||
EXTERNC CP_Result CP_GetBUC_LNB_settings(TSID sid, buc_lnb_settings &settings);
|
||||
|
||||
|
||||
EXTERNC CP_Result CP_GetModulatorParams(TSID sid, const char *modulator_param, uint32_t *value);
|
||||
|
||||
|
Reference in New Issue
Block a user