数据监控已经连通,还差绘图和注入功能未实现
This commit is contained in:
parent
3fe2d4aa0e
commit
25ca69597b
73
Release/IDL/C909_V1/.vscode/settings.json
vendored
Normal file
73
Release/IDL/C909_V1/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"cctype": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"cstdarg": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"any": "cpp",
|
||||
"array": "cpp",
|
||||
"atomic": "cpp",
|
||||
"bit": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"bitset": "cpp",
|
||||
"chrono": "cpp",
|
||||
"codecvt": "cpp",
|
||||
"compare": "cpp",
|
||||
"complex": "cpp",
|
||||
"concepts": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"deque": "cpp",
|
||||
"forward_list": "cpp",
|
||||
"list": "cpp",
|
||||
"map": "cpp",
|
||||
"set": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"exception": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"functional": "cpp",
|
||||
"iterator": "cpp",
|
||||
"memory": "cpp",
|
||||
"memory_resource": "cpp",
|
||||
"numeric": "cpp",
|
||||
"optional": "cpp",
|
||||
"random": "cpp",
|
||||
"ratio": "cpp",
|
||||
"regex": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"utility": "cpp",
|
||||
"fstream": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"iomanip": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"mutex": "cpp",
|
||||
"new": "cpp",
|
||||
"ostream": "cpp",
|
||||
"ranges": "cpp",
|
||||
"sstream": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"stop_token": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"thread": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"typeindex": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"valarray": "cpp",
|
||||
"variant": "cpp"
|
||||
}
|
||||
}
|
@ -30,7 +30,8 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.aero_model_heartbeat(), model_data->aero_model_heartbeat);
|
||||
assign_value_set(out_data.aero_model_heartbeat(), model_data->aero_model_heartbeat);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -56,33 +56,34 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.l_04_i_aerocomac_alpha_f8(), model_data->l_04_i_aerocomac_alpha_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_alpdot_f8(), model_data->l_04_i_aerocomac_alpdot_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_beta_f8(), model_data->l_04_i_aerocomac_beta_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_press_alt_f8(), model_data->l_04_i_aerocomac_press_alt_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_tas_f8(), model_data->l_04_i_aerocomac_tas_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_mach_f8(), model_data->l_04_i_aerocomac_mach_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_nx_f8(), model_data->l_04_i_aerocomac_nx_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_ny_f8(), model_data->l_04_i_aerocomac_ny_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_nz_f8(), model_data->l_04_i_aerocomac_nz_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_p_f8(), model_data->l_04_i_aerocomac_p_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_q_f8(), model_data->l_04_i_aerocomac_q_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_r_f8(), model_data->l_04_i_aerocomac_r_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_qbar_f8(), model_data->l_04_i_aerocomac_qbar_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_blcg_f8(), model_data->l_04_i_aerocomac_blcg_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_bscg_f8(), model_data->l_04_i_aerocomac_bscg_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_wlcg_f8(), model_data->l_04_i_aerocomac_wlcg_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_ail_f8(), model_data->l_04_i_aerocomac_ail_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_elv_f8(), model_data->l_04_i_aerocomac_elv_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_rud_f8(), model_data->l_04_i_aerocomac_rud_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_stab_f8(), model_data->l_04_i_aerocomac_stab_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_gear_f8(), model_data->l_04_i_aerocomac_gear_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_flap_f8(), model_data->l_04_i_aerocomac_flap_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_slat_f8(), model_data->l_04_i_aerocomac_slat_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_spl_f8(), model_data->l_04_i_aerocomac_spl_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_tnet_f8(), model_data->l_04_i_aerocomac_tnet_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_kice_f8(), model_data->l_04_i_aerocomac_kice_f8);
|
||||
assign_value_set(data.l_04_i_aerocomac_alt_agl_f8(), model_data->l_04_i_aerocomac_alt_agl_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_alpha_f8(), model_data->l_04_i_aerocomac_alpha_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_alpdot_f8(), model_data->l_04_i_aerocomac_alpdot_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_beta_f8(), model_data->l_04_i_aerocomac_beta_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_press_alt_f8(), model_data->l_04_i_aerocomac_press_alt_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_tas_f8(), model_data->l_04_i_aerocomac_tas_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_mach_f8(), model_data->l_04_i_aerocomac_mach_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_nx_f8(), model_data->l_04_i_aerocomac_nx_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_ny_f8(), model_data->l_04_i_aerocomac_ny_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_nz_f8(), model_data->l_04_i_aerocomac_nz_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_p_f8(), model_data->l_04_i_aerocomac_p_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_q_f8(), model_data->l_04_i_aerocomac_q_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_r_f8(), model_data->l_04_i_aerocomac_r_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_qbar_f8(), model_data->l_04_i_aerocomac_qbar_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_blcg_f8(), model_data->l_04_i_aerocomac_blcg_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_bscg_f8(), model_data->l_04_i_aerocomac_bscg_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_wlcg_f8(), model_data->l_04_i_aerocomac_wlcg_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_ail_f8(), model_data->l_04_i_aerocomac_ail_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_elv_f8(), model_data->l_04_i_aerocomac_elv_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_rud_f8(), model_data->l_04_i_aerocomac_rud_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_stab_f8(), model_data->l_04_i_aerocomac_stab_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_gear_f8(), model_data->l_04_i_aerocomac_gear_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_flap_f8(), model_data->l_04_i_aerocomac_flap_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_slat_f8(), model_data->l_04_i_aerocomac_slat_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_spl_f8(), model_data->l_04_i_aerocomac_spl_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_tnet_f8(), model_data->l_04_i_aerocomac_tnet_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_kice_f8(), model_data->l_04_i_aerocomac_kice_f8);
|
||||
assign_value_set(out_data.l_04_i_aerocomac_alt_agl_f8(), model_data->l_04_i_aerocomac_alt_agl_f8);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -42,19 +42,20 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.l_04_o_aerocomac_fxb_f8(), model_data->l_04_o_aerocomac_fxb_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_fyb_f8(), model_data->l_04_o_aerocomac_fyb_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_fzb_f8(), model_data->l_04_o_aerocomac_fzb_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_mxb_f8(), model_data->l_04_o_aerocomac_mxb_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_myb_f8(), model_data->l_04_o_aerocomac_myb_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_mzb_f8(), model_data->l_04_o_aerocomac_mzb_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_cls_f8(), model_data->l_04_o_aerocomac_cls_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_cl_f8(), model_data->l_04_o_aerocomac_cl_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_cd_f8(), model_data->l_04_o_aerocomac_cd_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_cm_f8(), model_data->l_04_o_aerocomac_cm_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_cr_f8(), model_data->l_04_o_aerocomac_cr_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_cy_f8(), model_data->l_04_o_aerocomac_cy_f8);
|
||||
assign_value_set(data.l_04_o_aerocomac_cn_f8(), model_data->l_04_o_aerocomac_cn_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_fxb_f8(), model_data->l_04_o_aerocomac_fxb_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_fyb_f8(), model_data->l_04_o_aerocomac_fyb_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_fzb_f8(), model_data->l_04_o_aerocomac_fzb_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_mxb_f8(), model_data->l_04_o_aerocomac_mxb_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_myb_f8(), model_data->l_04_o_aerocomac_myb_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_mzb_f8(), model_data->l_04_o_aerocomac_mzb_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_cls_f8(), model_data->l_04_o_aerocomac_cls_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_cl_f8(), model_data->l_04_o_aerocomac_cl_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_cd_f8(), model_data->l_04_o_aerocomac_cd_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_cm_f8(), model_data->l_04_o_aerocomac_cm_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_cr_f8(), model_data->l_04_o_aerocomac_cr_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_cy_f8(), model_data->l_04_o_aerocomac_cy_f8);
|
||||
assign_value_set(out_data.l_04_o_aerocomac_cn_f8(), model_data->l_04_o_aerocomac_cn_f8);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -30,7 +30,8 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.groundhandling_model_heartbeat(), model_data->groundhandling_model_heartbeat);
|
||||
assign_value_set(out_data.groundhandling_model_heartbeat(), model_data->groundhandling_model_heartbeat);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -68,45 +68,46 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_pb_active_l1(), model_data->l_04_i_gdcomac_pb_active_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_brake_torq_f8(), model_data->l_04_i_gdcomac_brake_torq_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_tire_pres_f8(), model_data->l_04_i_gdcomac_tire_pres_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2);
|
||||
assign_value_set(data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_reset_braketemp_l1(), model_data->l_04_i_gdcomac_reset_braketemp_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_reset_tirepress_l1(), model_data->l_04_i_gdcomac_reset_tirepress_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_brake_temp_f8(), model_data->l_04_i_gdcomac_brake_temp_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_tire_tburst_l1(), model_data->l_04_i_gdcomac_tire_tburst_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_tire_tflat_l1(), model_data->l_04_i_gdcomac_tire_tflat_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_brk_reset_tpres_l1(), model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_pb_towforce_f8(), model_data->l_04_i_gdcomac_pb_towforce_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_gsteer_state_i4(), model_data->l_04_i_gdcomac_gsteer_state_i4);
|
||||
assign_value_set(data.l_04_i_gdcomac_trim_active_l1(), model_data->l_04_i_gdcomac_trim_active_l1);
|
||||
assign_value_set(data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_theta_deg_f8(), model_data->l_04_i_gdcomac_theta_deg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
|
||||
assign_value_set(data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_frz_l1(), model_data->l_04_i_gdcomac_frz_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_chocks_l1(), model_data->l_04_i_gdcomac_chocks_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_alt_agl_f8(), model_data->l_04_i_gdcomac_alt_agl_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_frzflt_l1(), model_data->l_04_i_gdcomac_frzflt_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_p_f8(), model_data->l_04_i_gdcomac_p_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_q_f8(), model_data->l_04_i_gdcomac_q_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_r_f8(), model_data->l_04_i_gdcomac_r_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_ug_f8(), model_data->l_04_i_gdcomac_ug_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_vg_f8(), model_data->l_04_i_gdcomac_vg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_wg_f8(), model_data->l_04_i_gdcomac_wg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_blcg_f8(), model_data->l_04_i_gdcomac_blcg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_bscg_f8(), model_data->l_04_i_gdcomac_bscg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_wlcg_f8(), model_data->l_04_i_gdcomac_wlcg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_pb_active_l1(), model_data->l_04_i_gdcomac_pb_active_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_brake_torq_f8(), model_data->l_04_i_gdcomac_brake_torq_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_gear_f8(), model_data->l_04_i_gdcomac_gear_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_gsteer_f8(), model_data->l_04_i_gdcomac_gsteer_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_tire_pres_f8(), model_data->l_04_i_gdcomac_tire_pres_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_onjax_l1(), model_data->l_04_i_gdcomac_onjax_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_contdep_f8(), model_data->l_04_i_gdcomac_contdep_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_thetag_f8(), model_data->l_04_i_gdcomac_thetag_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_phig_f8(), model_data->l_04_i_gdcomac_phig_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_rwyrgh_i2(), model_data->l_04_i_gdcomac_rwyrgh_i2);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_rwyhdg_f8(), model_data->l_04_i_gdcomac_rwyhdg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_reset_braketemp_l1(), model_data->l_04_i_gdcomac_reset_braketemp_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_reset_tirepress_l1(), model_data->l_04_i_gdcomac_reset_tirepress_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_temp_c_f8(), model_data->l_04_i_gdcomac_temp_c_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_brake_temp_f8(), model_data->l_04_i_gdcomac_brake_temp_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_tire_tburst_l1(), model_data->l_04_i_gdcomac_tire_tburst_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_tire_tflat_l1(), model_data->l_04_i_gdcomac_tire_tflat_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_brk_reset_tpres_l1(), model_data->l_04_i_gdcomac_brk_reset_tpres_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_rcon_ci_f8(), model_data->l_04_i_gdcomac_rcon_ci_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_pb_towforce_f8(), model_data->l_04_i_gdcomac_pb_towforce_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_gsteer_state_i4(), model_data->l_04_i_gdcomac_gsteer_state_i4);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_trim_active_l1(), model_data->l_04_i_gdcomac_trim_active_l1);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_phi_deg_f8(), model_data->l_04_i_gdcomac_phi_deg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_theta_deg_f8(), model_data->l_04_i_gdcomac_theta_deg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_psi_deg_f8(), model_data->l_04_i_gdcomac_psi_deg_f8);
|
||||
assign_value_set(out_data.l_04_i_gdcomac_resetint_l1(), model_data->l_04_i_gdcomac_resetint_l1);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -63,40 +63,41 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1);
|
||||
assign_value_set(data.l_04_o_gdcomac_ac_on_ground_l1(), model_data->l_04_o_gdcomac_ac_on_ground_l1);
|
||||
assign_value_set(data.l_04_o_gdcomac_ac_stationary_f8(), model_data->l_04_o_gdcomac_ac_stationary_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_zcg_to_tire_f8(), model_data->l_04_o_gdcomac_zcg_to_tire_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_mxb_f8(), model_data->l_04_o_gdcomac_mxb_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_myb_f8(), model_data->l_04_o_gdcomac_myb_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_mzb_f8(), model_data->l_04_o_gdcomac_mzb_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_fygs_f8(), model_data->l_04_o_gdcomac_fygs_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_mzgs_f8(), model_data->l_04_o_gdcomac_mzgs_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_mu_f8(), model_data->l_04_o_gdcomac_mu_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_dstroke_f8(), model_data->l_04_o_gdcomac_dstroke_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_sr_f8(), model_data->l_04_o_gdcomac_sr_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_sy_f8(), model_data->l_04_o_gdcomac_sy_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_sx_f8(), model_data->l_04_o_gdcomac_sx_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_distngrxcg_f8(), model_data->l_04_o_gdcomac_distngrxcg_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_distmgrxcg_f8(), model_data->l_04_o_gdcomac_distmgrxcg_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_distmgrzcg_f8(), model_data->l_04_o_gdcomac_distmgrzcg_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_tire_burst_l1(), model_data->l_04_o_gdcomac_tire_burst_l1);
|
||||
assign_value_set(data.l_04_o_gdcomac_tire_temp_f8(), model_data->l_04_o_gdcomac_tire_temp_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
|
||||
assign_value_set(data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_whl_omega_f8(), model_data->l_04_o_gdcomac_whl_omega_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
|
||||
assign_value_set(data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_frz_l1(), model_data->l_04_o_gdcomac_frz_l1);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_ac_on_ground_l1(), model_data->l_04_o_gdcomac_ac_on_ground_l1);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_ac_stationary_f8(), model_data->l_04_o_gdcomac_ac_stationary_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_alt_tire_f8(), model_data->l_04_o_gdcomac_alt_tire_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_zcg_to_tire_f8(), model_data->l_04_o_gdcomac_zcg_to_tire_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_fxb_f8(), model_data->l_04_o_gdcomac_fxb_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_fyb_f8(), model_data->l_04_o_gdcomac_fyb_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_fzb_f8(), model_data->l_04_o_gdcomac_fzb_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_mxb_f8(), model_data->l_04_o_gdcomac_mxb_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_myb_f8(), model_data->l_04_o_gdcomac_myb_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_mzb_f8(), model_data->l_04_o_gdcomac_mzb_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_fygs_f8(), model_data->l_04_o_gdcomac_fygs_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_mzgs_f8(), model_data->l_04_o_gdcomac_mzgs_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_mu_f8(), model_data->l_04_o_gdcomac_mu_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_dstroke_f8(), model_data->l_04_o_gdcomac_dstroke_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_sr_f8(), model_data->l_04_o_gdcomac_sr_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_sy_f8(), model_data->l_04_o_gdcomac_sy_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_sx_f8(), model_data->l_04_o_gdcomac_sx_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_xft_f8(), model_data->l_04_o_gdcomac_xft_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_yft_f8(), model_data->l_04_o_gdcomac_yft_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_zft_f8(), model_data->l_04_o_gdcomac_zft_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_distngrxcg_f8(), model_data->l_04_o_gdcomac_distngrxcg_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_distmgrxcg_f8(), model_data->l_04_o_gdcomac_distmgrxcg_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_distmgrzcg_f8(), model_data->l_04_o_gdcomac_distmgrzcg_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_tire_vel_f8(), model_data->l_04_o_gdcomac_tire_vel_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_tire_burst_l1(), model_data->l_04_o_gdcomac_tire_burst_l1);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_tire_temp_f8(), model_data->l_04_o_gdcomac_tire_temp_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_wow_l1(), model_data->l_04_o_gdcomac_wow_l1);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_utirew_f8(), model_data->l_04_o_gdcomac_utirew_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_vtirew_f8(), model_data->l_04_o_gdcomac_vtirew_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_whl_omega_f8(), model_data->l_04_o_gdcomac_whl_omega_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_dstruc_f8(), model_data->l_04_o_gdcomac_dstruc_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_wor_par_f8(), model_data->l_04_o_gdcomac_wor_par_f8);
|
||||
assign_value_set(out_data.l_04_o_gdcomac_nd_f8(), model_data->l_04_o_gdcomac_nd_f8);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -30,7 +30,8 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.weightbody_model_heartbeat(), model_data->weightbody_model_heartbeat);
|
||||
assign_value_set(out_data.weightbody_model_heartbeat(), model_data->weightbody_model_heartbeat);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -52,29 +52,30 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.l_04_i_wbcomac_theta_deg_f8(), model_data->l_04_i_wbcomac_theta_deg_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_gear_mode_l1(), model_data->l_04_i_wbcomac_gear_mode_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_acset_gw_f8(), model_data->l_04_i_wbcomac_acset_gw_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_acset_cg_f8(), model_data->l_04_i_wbcomac_acset_cg_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_acset_tankfuel_f4(), model_data->l_04_i_wbcomac_acset_tankfuel_f4);
|
||||
assign_value_set(data.l_04_i_wbcomac_acset_totfuel_f8(), model_data->l_04_i_wbcomac_acset_totfuel_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_acset_zfw_f8(), model_data->l_04_i_wbcomac_acset_zfw_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_acset_zfwcg_f8(), model_data->l_04_i_wbcomac_acset_zfwcg_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_eng_efsep_l1(), model_data->l_04_i_wbcomac_eng_efsep_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_fuel_f8(), model_data->l_04_i_wbcomac_fuel_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_gear_avg_f8(), model_data->l_04_i_wbcomac_gear_avg_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_kice_f8(), model_data->l_04_i_wbcomac_kice_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_bycglim_l1(), model_data->l_04_i_wbcomac_bycglim_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_bygwlim_l1(), model_data->l_04_i_wbcomac_bygwlim_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_frz_l1(), model_data->l_04_i_wbcomac_frz_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_zcgfrz_l1(), model_data->l_04_i_wbcomac_zcgfrz_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_zcgfrz_grfx_l1(), model_data->l_04_i_wbcomac_zcgfrz_grfx_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_ycgfrz_l1(), model_data->l_04_i_wbcomac_ycgfrz_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_inertfrz_l1(), model_data->l_04_i_wbcomac_inertfrz_l1);
|
||||
assign_value_set(data.l_04_i_wbcomac_potreq_gw_f8(), model_data->l_04_i_wbcomac_potreq_gw_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_potreq_gwcg_f8(), model_data->l_04_i_wbcomac_potreq_gwcg_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_phi_deg_f8(), model_data->l_04_i_wbcomac_phi_deg_f8);
|
||||
assign_value_set(data.l_04_i_wbcomac_psi_deg_f8(), model_data->l_04_i_wbcomac_psi_deg_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_theta_deg_f8(), model_data->l_04_i_wbcomac_theta_deg_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_gear_mode_l1(), model_data->l_04_i_wbcomac_gear_mode_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_acset_gw_f8(), model_data->l_04_i_wbcomac_acset_gw_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_acset_cg_f8(), model_data->l_04_i_wbcomac_acset_cg_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_acset_tankfuel_f4(), model_data->l_04_i_wbcomac_acset_tankfuel_f4);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_acset_totfuel_f8(), model_data->l_04_i_wbcomac_acset_totfuel_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_acset_zfw_f8(), model_data->l_04_i_wbcomac_acset_zfw_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_acset_zfwcg_f8(), model_data->l_04_i_wbcomac_acset_zfwcg_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_eng_efsep_l1(), model_data->l_04_i_wbcomac_eng_efsep_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_fuel_f8(), model_data->l_04_i_wbcomac_fuel_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_gear_avg_f8(), model_data->l_04_i_wbcomac_gear_avg_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_kice_f8(), model_data->l_04_i_wbcomac_kice_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_bycglim_l1(), model_data->l_04_i_wbcomac_bycglim_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_bygwlim_l1(), model_data->l_04_i_wbcomac_bygwlim_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_frz_l1(), model_data->l_04_i_wbcomac_frz_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_zcgfrz_l1(), model_data->l_04_i_wbcomac_zcgfrz_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_zcgfrz_grfx_l1(), model_data->l_04_i_wbcomac_zcgfrz_grfx_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_ycgfrz_l1(), model_data->l_04_i_wbcomac_ycgfrz_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_inertfrz_l1(), model_data->l_04_i_wbcomac_inertfrz_l1);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_potreq_gw_f8(), model_data->l_04_i_wbcomac_potreq_gw_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_potreq_gwcg_f8(), model_data->l_04_i_wbcomac_potreq_gwcg_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_phi_deg_f8(), model_data->l_04_i_wbcomac_phi_deg_f8);
|
||||
assign_value_set(out_data.l_04_i_wbcomac_psi_deg_f8(), model_data->l_04_i_wbcomac_psi_deg_f8);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
@ -85,62 +85,63 @@ public:
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
assign_value_set(data.l_04_o_wbcomac_frz_l1(), model_data->l_04_o_wbcomac_frz_l1);
|
||||
assign_value_set(data.l_04_o_wbcomac_zcgfrz_l1(), model_data->l_04_o_wbcomac_zcgfrz_l1);
|
||||
assign_value_set(data.l_04_o_wbcomac_zcgfrz_grfx_l1(), model_data->l_04_o_wbcomac_zcgfrz_grfx_l1);
|
||||
assign_value_set(data.l_04_o_wbcomac_ycgfrz_l1(), model_data->l_04_o_wbcomac_ycgfrz_l1);
|
||||
assign_value_set(data.l_04_o_wbcomac_inertfrz_l1(), model_data->l_04_o_wbcomac_inertfrz_l1);
|
||||
assign_value_set(data.l_04_o_wbcomac_gw_f4(), model_data->l_04_o_wbcomac_gw_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_cg_f4(), model_data->l_04_o_wbcomac_cg_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_blcg_f8(), model_data->l_04_o_wbcomac_blcg_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_bscg_f8(), model_data->l_04_o_wbcomac_bscg_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_wlcg_f8(), model_data->l_04_o_wbcomac_wlcg_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_xcg_f8(), model_data->l_04_o_wbcomac_xcg_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ixx_f8(), model_data->l_04_o_wbcomac_ixx_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ixy_f8(), model_data->l_04_o_wbcomac_ixy_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ixz_f8(), model_data->l_04_o_wbcomac_ixz_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_iyy_f8(), model_data->l_04_o_wbcomac_iyy_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_iyz_f8(), model_data->l_04_o_wbcomac_iyz_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_izz_f8(), model_data->l_04_o_wbcomac_izz_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_zfw_f4(), model_data->l_04_o_wbcomac_zfw_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_zfwcg_f4(), model_data->l_04_o_wbcomac_zfwcg_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_zfw_blcg_f4(), model_data->l_04_o_wbcomac_zfw_blcg_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_zfw_wlcg_f4(), model_data->l_04_o_wbcomac_zfw_wlcg_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_cmd_f8(), model_data->l_04_o_wbcomac_fuel_cmd_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_mode_i4(), model_data->l_04_o_wbcomac_fuel_mode_i4);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_ixx_f8(), model_data->l_04_o_wbcomac_fuel_ixx_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_ixy_f8(), model_data->l_04_o_wbcomac_fuel_ixy_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_ixz_f8(), model_data->l_04_o_wbcomac_fuel_ixz_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_iyy_f8(), model_data->l_04_o_wbcomac_fuel_iyy_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_iyz_f8(), model_data->l_04_o_wbcomac_fuel_iyz_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_fuel_izz_f8(), model_data->l_04_o_wbcomac_fuel_izz_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_l_wt_fuel_f8(), model_data->l_04_o_wbcomac_l_wt_fuel_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_airframe_total_f8(), model_data->l_04_o_wbcomac_ice_airframe_total_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_eng_f8(), model_data->l_04_o_wbcomac_ice_eng_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_eng_total_f8(), model_data->l_04_o_wbcomac_ice_eng_total_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_fuselage_f8(), model_data->l_04_o_wbcomac_ice_fuselage_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_stab_left_f8(), model_data->l_04_o_wbcomac_ice_stab_left_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_stab_right_f8(), model_data->l_04_o_wbcomac_ice_stab_right_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_stab_total_f8(), model_data->l_04_o_wbcomac_ice_stab_total_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_total_f8(), model_data->l_04_o_wbcomac_ice_total_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_total_frac_f8(), model_data->l_04_o_wbcomac_ice_total_frac_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_vert_tail_f8(), model_data->l_04_o_wbcomac_ice_vert_tail_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_wing_left_f8(), model_data->l_04_o_wbcomac_ice_wing_left_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_wing_right_f8(), model_data->l_04_o_wbcomac_ice_wing_right_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_ice_wing_total_f8(), model_data->l_04_o_wbcomac_ice_wing_total_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_init_l1(), model_data->l_04_o_wbcomac_init_l1);
|
||||
assign_value_set(data.l_04_o_wbcomac_potmin_gw_f8(), model_data->l_04_o_wbcomac_potmin_gw_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_potmax_gw_f8(), model_data->l_04_o_wbcomac_potmax_gw_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_potmin_gwcg_f8(), model_data->l_04_o_wbcomac_potmin_gwcg_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_potmax_gwcg_f8(), model_data->l_04_o_wbcomac_potmax_gwcg_f8);
|
||||
assign_value_set(data.l_04_o_wbcomac_min_cg_f4(), model_data->l_04_o_wbcomac_min_cg_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_min_gw_f4(), model_data->l_04_o_wbcomac_min_gw_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_min_zfw_f4(), model_data->l_04_o_wbcomac_min_zfw_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_min_zfwcg_f4(), model_data->l_04_o_wbcomac_min_zfwcg_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_max_cg_f4(), model_data->l_04_o_wbcomac_max_cg_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_max_gw_f4(), model_data->l_04_o_wbcomac_max_gw_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_max_zfw_f4(), model_data->l_04_o_wbcomac_max_zfw_f4);
|
||||
assign_value_set(data.l_04_o_wbcomac_max_zfwcg_f4(), model_data->l_04_o_wbcomac_max_zfwcg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_frz_l1(), model_data->l_04_o_wbcomac_frz_l1);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_zcgfrz_l1(), model_data->l_04_o_wbcomac_zcgfrz_l1);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_zcgfrz_grfx_l1(), model_data->l_04_o_wbcomac_zcgfrz_grfx_l1);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ycgfrz_l1(), model_data->l_04_o_wbcomac_ycgfrz_l1);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_inertfrz_l1(), model_data->l_04_o_wbcomac_inertfrz_l1);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_gw_f4(), model_data->l_04_o_wbcomac_gw_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_cg_f4(), model_data->l_04_o_wbcomac_cg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_blcg_f8(), model_data->l_04_o_wbcomac_blcg_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_bscg_f8(), model_data->l_04_o_wbcomac_bscg_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_wlcg_f8(), model_data->l_04_o_wbcomac_wlcg_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_xcg_f8(), model_data->l_04_o_wbcomac_xcg_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ixx_f8(), model_data->l_04_o_wbcomac_ixx_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ixy_f8(), model_data->l_04_o_wbcomac_ixy_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ixz_f8(), model_data->l_04_o_wbcomac_ixz_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_iyy_f8(), model_data->l_04_o_wbcomac_iyy_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_iyz_f8(), model_data->l_04_o_wbcomac_iyz_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_izz_f8(), model_data->l_04_o_wbcomac_izz_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_zfw_f4(), model_data->l_04_o_wbcomac_zfw_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_zfwcg_f4(), model_data->l_04_o_wbcomac_zfwcg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_zfw_blcg_f4(), model_data->l_04_o_wbcomac_zfw_blcg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_zfw_wlcg_f4(), model_data->l_04_o_wbcomac_zfw_wlcg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_cmd_f8(), model_data->l_04_o_wbcomac_fuel_cmd_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_mode_i4(), model_data->l_04_o_wbcomac_fuel_mode_i4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_ixx_f8(), model_data->l_04_o_wbcomac_fuel_ixx_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_ixy_f8(), model_data->l_04_o_wbcomac_fuel_ixy_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_ixz_f8(), model_data->l_04_o_wbcomac_fuel_ixz_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_iyy_f8(), model_data->l_04_o_wbcomac_fuel_iyy_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_iyz_f8(), model_data->l_04_o_wbcomac_fuel_iyz_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_fuel_izz_f8(), model_data->l_04_o_wbcomac_fuel_izz_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_l_wt_fuel_f8(), model_data->l_04_o_wbcomac_l_wt_fuel_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_airframe_total_f8(), model_data->l_04_o_wbcomac_ice_airframe_total_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_eng_f8(), model_data->l_04_o_wbcomac_ice_eng_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_eng_total_f8(), model_data->l_04_o_wbcomac_ice_eng_total_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_fuselage_f8(), model_data->l_04_o_wbcomac_ice_fuselage_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_stab_left_f8(), model_data->l_04_o_wbcomac_ice_stab_left_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_stab_right_f8(), model_data->l_04_o_wbcomac_ice_stab_right_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_stab_total_f8(), model_data->l_04_o_wbcomac_ice_stab_total_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_total_f8(), model_data->l_04_o_wbcomac_ice_total_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_total_frac_f8(), model_data->l_04_o_wbcomac_ice_total_frac_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_vert_tail_f8(), model_data->l_04_o_wbcomac_ice_vert_tail_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_wing_left_f8(), model_data->l_04_o_wbcomac_ice_wing_left_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_wing_right_f8(), model_data->l_04_o_wbcomac_ice_wing_right_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_ice_wing_total_f8(), model_data->l_04_o_wbcomac_ice_wing_total_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_init_l1(), model_data->l_04_o_wbcomac_init_l1);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_potmin_gw_f8(), model_data->l_04_o_wbcomac_potmin_gw_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_potmax_gw_f8(), model_data->l_04_o_wbcomac_potmax_gw_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_potmin_gwcg_f8(), model_data->l_04_o_wbcomac_potmin_gwcg_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_potmax_gwcg_f8(), model_data->l_04_o_wbcomac_potmax_gwcg_f8);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_min_cg_f4(), model_data->l_04_o_wbcomac_min_cg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_min_gw_f4(), model_data->l_04_o_wbcomac_min_gw_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_min_zfw_f4(), model_data->l_04_o_wbcomac_min_zfw_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_min_zfwcg_f4(), model_data->l_04_o_wbcomac_min_zfwcg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_max_cg_f4(), model_data->l_04_o_wbcomac_max_cg_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_max_gw_f4(), model_data->l_04_o_wbcomac_max_gw_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_max_zfw_f4(), model_data->l_04_o_wbcomac_max_zfw_f4);
|
||||
assign_value_set(out_data.l_04_o_wbcomac_max_zfwcg_f4(), model_data->l_04_o_wbcomac_max_zfwcg_f4);
|
||||
sendOutData();
|
||||
}
|
||||
protected:
|
||||
DDSType data;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -39,13 +39,14 @@ public:
|
||||
* @param varNames: 变量名列表
|
||||
* @return: 变量名到数据的映射
|
||||
*/
|
||||
std::unordered_map<std::string, std::string> getStringData(std::vector<std::string> varNames);
|
||||
std::unordered_map<std::string, std::string>
|
||||
getStringData(const std::vector<std::string> &varNames);
|
||||
|
||||
/**
|
||||
* @brief 批量设置指定变量的数据
|
||||
* @param data: 变量名到数据的映射
|
||||
*/
|
||||
void setDataByString(std::unordered_map<std::string, std::string> data);
|
||||
void setDataByString(const std::unordered_map<std::string, std::string> &data);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -54,7 +55,7 @@ protected:
|
||||
* @return 字节数组
|
||||
*/
|
||||
template <typename T>
|
||||
XNByteArray getByteArray(eprosima::fastcdr::optional<T> data)
|
||||
XNByteArray getByteArray(const eprosima::fastcdr::optional<T> &data)
|
||||
{
|
||||
XNByteArray result(getTypeSize<T>());
|
||||
|
||||
@ -74,7 +75,7 @@ protected:
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"Type must be arithmetic or std::array");
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -108,7 +109,7 @@ protected:
|
||||
setByteArrayFromStdArray(data.value(), thisArray);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"Type must be arithmetic or std::array");
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,10 +126,13 @@ protected:
|
||||
for (std::size_t i = 0; i < N; ++i) {
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
std::memcpy(result.data() + i * getTypeSize<T>(), &data[i], getTypeSize<T>());
|
||||
} else {
|
||||
} else if constexpr (is_std_array_v<T>) {
|
||||
XNByteArray subArray = getByteArrayFromStdArray(data[i]);
|
||||
std::memcpy(result.data() + i * getTypeSize<T>(), subArray.data(),
|
||||
getTypeSize<T>());
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,9 +153,12 @@ protected:
|
||||
for (std::size_t i = 0; i < N; ++i) {
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
std::memcpy(&data[i], byteArray.data() + i * getTypeSize<T>(), getTypeSize<T>());
|
||||
} else {
|
||||
} else if constexpr (is_std_array_v<T>) {
|
||||
XNByteArray subArray(byteArray.data() + i * getTypeSize<T>(), getTypeSize<T>());
|
||||
setByteArrayFromStdArray(data[i], subArray);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,7 +169,7 @@ protected:
|
||||
* @return: 数据(字符串格式)
|
||||
*/
|
||||
template <typename T>
|
||||
std::string getString(eprosima::fastcdr::optional<T> data)
|
||||
std::string getString(const eprosima::fastcdr::optional<T> &data)
|
||||
{
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
if (data) {
|
||||
@ -177,6 +184,9 @@ protected:
|
||||
T zero = {};
|
||||
return getStringFromStdArray(zero);
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
@ -206,6 +216,9 @@ protected:
|
||||
T temp;
|
||||
setStdArrayFromString(temp, items, 0);
|
||||
data = temp;
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +228,7 @@ protected:
|
||||
* @return: 数据(字符串格式)
|
||||
*/
|
||||
template <typename T, std::size_t N>
|
||||
std::string getStringFromStdArray(std::array<T, N> data)
|
||||
std::string getStringFromStdArray(const std::array<T, N> &data)
|
||||
{
|
||||
std::stringstream ss;
|
||||
for (std::size_t i = 0; i < N; ++i) {
|
||||
@ -223,8 +236,11 @@ protected:
|
||||
ss << ",";
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
ss << data[i];
|
||||
} else {
|
||||
} else if constexpr (is_std_array_v<T>) {
|
||||
ss << getStringFromStdArray(data[i]);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
return ss.str();
|
||||
@ -257,59 +273,92 @@ protected:
|
||||
start_pos = setStdArrayFromString(data[i], value, start_pos + i);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"Type must be arithmetic or std::array");
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
throw std::runtime_error("Error parsing element " + std::to_string(i) + ": "
|
||||
+ e.what());
|
||||
throw std::runtime_error("无法解析第 " + std::to_string(i)
|
||||
+ " 个元素: " + e.what());
|
||||
}
|
||||
}
|
||||
return start_pos + N;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void assign_value_get(eprosima::fastcdr::optional<T1> &data, T2 &model_data)
|
||||
void assign_value_get(const eprosima::fastcdr::optional<T1> &data, T2 &model_data)
|
||||
{
|
||||
if (data) {
|
||||
auto temp = data.value();
|
||||
if constexpr (std::is_arithmetic_v<T1>) {
|
||||
static_assert(std::is_arithmetic_v<T2>, "模板参数T2必须是算术类型");
|
||||
static_assert(std::is_convertible_v<T1, T2>, "模板参数T1必须可以转换为T2类型");
|
||||
model_data = temp;
|
||||
} else if constexpr (is_std_array_v<T1>) {
|
||||
size_t arraySize = array_size_v<T1>;
|
||||
for (size_t i = 0; i < arraySize; ++i) {
|
||||
auto temp2 = temp[i];
|
||||
if constexpr (std::is_arithmetic_v<T2>) {
|
||||
auto temp2 = temp[i];
|
||||
using array_type = typename T1::value_type;
|
||||
if constexpr (std::is_arithmetic_v<array_type>) {
|
||||
model_data[i] = temp2;
|
||||
} else if constexpr (is_std_array_v<T2>) {
|
||||
size_t arraySize2 = array_size_v<T2>;
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
model_data[i][j] = temp2[j];
|
||||
} else if constexpr (is_std_array_v<array_type>) {
|
||||
size_t arraySize2 = array_size_v<array_type>;
|
||||
using sub_array_type = typename array_type::value_type;
|
||||
if constexpr (std::is_arithmetic_v<sub_array_type>) {
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
model_data[i][j] = temp2[j];
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<sub_array_type>,
|
||||
"模板参数T1是std::array类型时,它的数组嵌套不能超过两层");
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<array_type>
|
||||
|| is_std_array_v<array_type>,
|
||||
"模板参数T1是std::array类型时,它的value_"
|
||||
"type必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T1> || is_std_array_v<T1>,
|
||||
"模板参数T1必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void assign_value_set(eprosima::fastcdr::optional<T1> &data, T2 &model_data)
|
||||
void assign_value_set(eprosima::fastcdr::optional<T1> &data, const T2 &model_data)
|
||||
{
|
||||
if constexpr (std::is_arithmetic_v<T1>) {
|
||||
static_assert(std::is_arithmetic_v<T2>, "模板参数T2必须是算术类型");
|
||||
static_assert(std::is_convertible_v<T2, T1>, "模板参数T2必须可以转换为T1类型");
|
||||
data = model_data;
|
||||
} else if constexpr (is_std_array_v<T1>) {
|
||||
T1 temp;
|
||||
size_t arraySize = array_size_v<T1>;
|
||||
using array_type = typename T1::value_type;
|
||||
for (size_t i = 0; i < arraySize; ++i) {
|
||||
if constexpr (std::is_arithmetic_v<typename T1::value_type>) {
|
||||
if constexpr (std::is_arithmetic_v<array_type>) {
|
||||
temp[i] = model_data[i];
|
||||
} else if constexpr (is_std_array_v<typename T1::value_type>) {
|
||||
size_t arraySize2 = array_size_v<typename T1::value_type>;
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
temp[i][j] = model_data[i][j];
|
||||
} else if constexpr (is_std_array_v<array_type>) {
|
||||
size_t arraySize2 = array_size_v<array_type>;
|
||||
using sub_array_type = typename array_type::value_type;
|
||||
if constexpr (std::is_arithmetic_v<sub_array_type>) {
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
temp[i][j] = model_data[i][j];
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<sub_array_type>,
|
||||
"模板参数T1是std::array类型时,它的数组嵌套不能超过两层");
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<array_type> || is_std_array_v<array_type>,
|
||||
"模板参数T1是std::array类型时,它的value_"
|
||||
"type必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
data = temp;
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T1> || is_std_array_v<T1>,
|
||||
"模板参数T1必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,10 +379,10 @@ protected:
|
||||
|
||||
#define MAP_DATA_FUNC(NAME) \
|
||||
getDataFunction[#NAME] = [this]() { return getString(data.NAME()); }; \
|
||||
setDataFunction[#NAME] = [this](std::string value) { \
|
||||
setDataFunction[#NAME] = [this](const std::string &value) { \
|
||||
setDataFromString(out_data.NAME(), value); \
|
||||
}; \
|
||||
getByteArrayFunction.push_back([this]() { return getByteArray(data.NAME()); }); \
|
||||
setByteArrayFunction.push_back([this](XNByteArray byteArray, uint32_t &pos) { \
|
||||
setByteArrayFunction.push_back([this](const XNByteArray &byteArray, uint32_t &pos) { \
|
||||
setByteArray(out_data.NAME(), byteArray, pos); \
|
||||
});
|
||||
|
@ -64,7 +64,7 @@ void XNDDSInterface::setDataByUDPPackage(const XNByteArray &package)
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, std::string>
|
||||
XNDDSInterface::getStringData(std::vector<std::string> varNames)
|
||||
XNDDSInterface::getStringData(const std::vector<std::string> &varNames)
|
||||
{
|
||||
std::unordered_map<std::string, std::string> result;
|
||||
|
||||
@ -82,7 +82,7 @@ XNDDSInterface::getStringData(std::vector<std::string> varNames)
|
||||
return result;
|
||||
}
|
||||
|
||||
void XNDDSInterface::setDataByString(std::unordered_map<std::string, std::string> data)
|
||||
void XNDDSInterface::setDataByString(const std::unordered_map<std::string, std::string> &data)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(outDataMutex);
|
||||
clearOutData();
|
||||
|
@ -39,13 +39,14 @@ public:
|
||||
* @param varNames: 变量名列表
|
||||
* @return: 变量名到数据的映射
|
||||
*/
|
||||
std::unordered_map<std::string, std::string> getStringData(std::vector<std::string> varNames);
|
||||
std::unordered_map<std::string, std::string>
|
||||
getStringData(const std::vector<std::string> &varNames);
|
||||
|
||||
/**
|
||||
* @brief 批量设置指定变量的数据
|
||||
* @param data: 变量名到数据的映射
|
||||
*/
|
||||
void setDataByString(std::unordered_map<std::string, std::string> data);
|
||||
void setDataByString(const std::unordered_map<std::string, std::string> &data);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -54,7 +55,7 @@ protected:
|
||||
* @return 字节数组
|
||||
*/
|
||||
template <typename T>
|
||||
XNByteArray getByteArray(eprosima::fastcdr::optional<T> data)
|
||||
XNByteArray getByteArray(const eprosima::fastcdr::optional<T> &data)
|
||||
{
|
||||
XNByteArray result(getTypeSize<T>());
|
||||
|
||||
@ -74,7 +75,7 @@ protected:
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"Type must be arithmetic or std::array");
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -108,7 +109,7 @@ protected:
|
||||
setByteArrayFromStdArray(data.value(), thisArray);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"Type must be arithmetic or std::array");
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,10 +126,13 @@ protected:
|
||||
for (std::size_t i = 0; i < N; ++i) {
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
std::memcpy(result.data() + i * getTypeSize<T>(), &data[i], getTypeSize<T>());
|
||||
} else {
|
||||
} else if constexpr (is_std_array_v<T>) {
|
||||
XNByteArray subArray = getByteArrayFromStdArray(data[i]);
|
||||
std::memcpy(result.data() + i * getTypeSize<T>(), subArray.data(),
|
||||
getTypeSize<T>());
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,9 +153,12 @@ protected:
|
||||
for (std::size_t i = 0; i < N; ++i) {
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
std::memcpy(&data[i], byteArray.data() + i * getTypeSize<T>(), getTypeSize<T>());
|
||||
} else {
|
||||
} else if constexpr (is_std_array_v<T>) {
|
||||
XNByteArray subArray(byteArray.data() + i * getTypeSize<T>(), getTypeSize<T>());
|
||||
setByteArrayFromStdArray(data[i], subArray);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,13 +169,13 @@ protected:
|
||||
* @return: 数据(字符串格式)
|
||||
*/
|
||||
template <typename T>
|
||||
std::string getString(eprosima::fastcdr::optional<T> data)
|
||||
std::string getString(const eprosima::fastcdr::optional<T> &data)
|
||||
{
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
if (data) {
|
||||
return std::to_string(data.value());
|
||||
} else {
|
||||
return std::to_string(0);
|
||||
return "Unknown";
|
||||
}
|
||||
} else if constexpr (is_std_array_v<T>) {
|
||||
if (data) {
|
||||
@ -177,6 +184,9 @@ protected:
|
||||
T zero = {};
|
||||
return getStringFromStdArray(zero);
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
@ -206,6 +216,9 @@ protected:
|
||||
T temp;
|
||||
setStdArrayFromString(temp, items, 0);
|
||||
data = temp;
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +228,7 @@ protected:
|
||||
* @return: 数据(字符串格式)
|
||||
*/
|
||||
template <typename T, std::size_t N>
|
||||
std::string getStringFromStdArray(std::array<T, N> data)
|
||||
std::string getStringFromStdArray(const std::array<T, N> &data)
|
||||
{
|
||||
std::stringstream ss;
|
||||
for (std::size_t i = 0; i < N; ++i) {
|
||||
@ -223,8 +236,11 @@ protected:
|
||||
ss << ",";
|
||||
if constexpr (std::is_arithmetic_v<T>) {
|
||||
ss << data[i];
|
||||
} else {
|
||||
} else if constexpr (is_std_array_v<T>) {
|
||||
ss << getStringFromStdArray(data[i]);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
return ss.str();
|
||||
@ -257,59 +273,92 @@ protected:
|
||||
start_pos = setStdArrayFromString(data[i], value, start_pos + i);
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T> || is_std_array_v<T>,
|
||||
"Type must be arithmetic or std::array");
|
||||
"T 必须是算术类型或std::array类型");
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
throw std::runtime_error("Error parsing element " + std::to_string(i) + ": "
|
||||
+ e.what());
|
||||
throw std::runtime_error("无法解析第 " + std::to_string(i)
|
||||
+ " 个元素: " + e.what());
|
||||
}
|
||||
}
|
||||
return start_pos + N;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void assign_value_get(eprosima::fastcdr::optional<T1> &data, T2 &model_data)
|
||||
void assign_value_get(const eprosima::fastcdr::optional<T1> &data, T2 &model_data)
|
||||
{
|
||||
if (data) {
|
||||
auto temp = data.value();
|
||||
if constexpr (std::is_arithmetic_v<T1>) {
|
||||
static_assert(std::is_arithmetic_v<T2>, "模板参数T2必须是算术类型");
|
||||
static_assert(std::is_convertible_v<T1, T2>, "模板参数T1必须可以转换为T2类型");
|
||||
model_data = temp;
|
||||
} else if constexpr (is_std_array_v<T1>) {
|
||||
size_t arraySize = array_size_v<T1>;
|
||||
for (size_t i = 0; i < arraySize; ++i) {
|
||||
auto temp2 = temp[i];
|
||||
if constexpr (std::is_arithmetic_v<T2>) {
|
||||
auto temp2 = temp[i];
|
||||
using array_type = typename T1::value_type;
|
||||
if constexpr (std::is_arithmetic_v<array_type>) {
|
||||
model_data[i] = temp2;
|
||||
} else if constexpr (is_std_array_v<T2>) {
|
||||
size_t arraySize2 = array_size_v<T2>;
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
model_data[i][j] = temp2[j];
|
||||
} else if constexpr (is_std_array_v<array_type>) {
|
||||
size_t arraySize2 = array_size_v<array_type>;
|
||||
using sub_array_type = typename array_type::value_type;
|
||||
if constexpr (std::is_arithmetic_v<sub_array_type>) {
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
model_data[i][j] = temp2[j];
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<sub_array_type>,
|
||||
"模板参数T1是std::array类型时,它的数组嵌套不能超过两层");
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<array_type>
|
||||
|| is_std_array_v<array_type>,
|
||||
"模板参数T1是std::array类型时,它的value_"
|
||||
"type必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T1> || is_std_array_v<T1>,
|
||||
"模板参数T1必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
void assign_value_set(eprosima::fastcdr::optional<T1> &data, T2 &model_data)
|
||||
void assign_value_set(eprosima::fastcdr::optional<T1> &data, const T2 &model_data)
|
||||
{
|
||||
if constexpr (std::is_arithmetic_v<T1>) {
|
||||
static_assert(std::is_arithmetic_v<T2>, "模板参数T2必须是算术类型");
|
||||
static_assert(std::is_convertible_v<T2, T1>, "模板参数T2必须可以转换为T1类型");
|
||||
data = model_data;
|
||||
} else if constexpr (is_std_array_v<T1>) {
|
||||
T1 temp;
|
||||
size_t arraySize = array_size_v<T1>;
|
||||
using array_type = typename T1::value_type;
|
||||
for (size_t i = 0; i < arraySize; ++i) {
|
||||
if constexpr (std::is_arithmetic_v<typename T1::value_type>) {
|
||||
if constexpr (std::is_arithmetic_v<array_type>) {
|
||||
temp[i] = model_data[i];
|
||||
} else if constexpr (is_std_array_v<typename T1::value_type>) {
|
||||
size_t arraySize2 = array_size_v<typename T1::value_type>;
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
temp[i][j] = model_data[i][j];
|
||||
} else if constexpr (is_std_array_v<array_type>) {
|
||||
size_t arraySize2 = array_size_v<array_type>;
|
||||
using sub_array_type = typename array_type::value_type;
|
||||
if constexpr (std::is_arithmetic_v<sub_array_type>) {
|
||||
for (size_t j = 0; j < arraySize2; ++j) {
|
||||
temp[i][j] = model_data[i][j];
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<sub_array_type>,
|
||||
"模板参数T1是std::array类型时,它的数组嵌套不能超过两层");
|
||||
}
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<array_type> || is_std_array_v<array_type>,
|
||||
"模板参数T1是std::array类型时,它的value_"
|
||||
"type必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
data = temp;
|
||||
} else {
|
||||
static_assert(std::is_arithmetic_v<T1> || is_std_array_v<T1>,
|
||||
"模板参数T1必须是算术类型或std::array类型");
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,10 +379,10 @@ protected:
|
||||
|
||||
#define MAP_DATA_FUNC(NAME) \
|
||||
getDataFunction[#NAME] = [this]() { return getString(data.NAME()); }; \
|
||||
setDataFunction[#NAME] = [this](std::string value) { \
|
||||
setDataFunction[#NAME] = [this](const std::string &value) { \
|
||||
setDataFromString(out_data.NAME(), value); \
|
||||
}; \
|
||||
getByteArrayFunction.push_back([this]() { return getByteArray(data.NAME()); }); \
|
||||
setByteArrayFunction.push_back([this](XNByteArray byteArray, uint32_t &pos) { \
|
||||
setByteArrayFunction.push_back([this](const XNByteArray &byteArray, uint32_t &pos) { \
|
||||
setByteArray(out_data.NAME(), byteArray, pos); \
|
||||
});
|
||||
|
@ -85,9 +85,10 @@ bool DDSInterfaceGen::generateDDSInterfaceHpp(const std::string &nameSpace,
|
||||
hppFile << "\t\t" << "std::lock_guard<std::mutex> lock(outDataMutex);" << std::endl;
|
||||
hppFile << "\t\t" << "clearOutData();" << std::endl;
|
||||
for (const auto &interface : interfaceData) {
|
||||
hppFile << "\t\t" << "assign_value_set(data." << interface.interfaceName
|
||||
hppFile << "\t\t" << "assign_value_set(out_data." << interface.interfaceName
|
||||
<< "(), model_data->" << interface.interfaceName << ");" << std::endl;
|
||||
}
|
||||
hppFile << "\t\t" << "sendOutData();" << std::endl;
|
||||
hppFile << "\t" << "}" << std::endl;
|
||||
// 11. 写入私有成员变量
|
||||
hppFile << "" << "protected:" << std::endl;
|
||||
|
8
XNModels/CMakeLists.txt
Executable file
8
XNModels/CMakeLists.txt
Executable file
@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(XNModels)
|
||||
|
||||
add_subdirectory(XNATA04DataProcessor)
|
||||
add_subdirectory(XNAerodynamics)
|
||||
add_subdirectory(XNGroundHandling)
|
||||
add_subdirectory(XNWeightBalance)
|
@ -392,10 +392,6 @@ void XN_StopDataMonitor(const char *structName, const int structNameLen, char *e
|
||||
}
|
||||
std::string structNameStr(structName, structNameLen);
|
||||
DataMonitorFactory::ReleaseInstance(structNameStr);
|
||||
if (errorMsg && errorMsgSize > 0) {
|
||||
strncpy(errorMsg, "Data Monitor Stopped Successfully", errorMsgSize - 1);
|
||||
errorMsg[errorMsgSize - 1] = '\0';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@ class DataMonitor extends HTMLElement {
|
||||
this.dragStartWidth = 0;
|
||||
this._colWidthInited = false;
|
||||
this._resizeEventBinded = false;
|
||||
this.monitorId = `data_monitor_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; // 添加监控器ID
|
||||
this.dataUpdateTimer = null; // 数据更新定时器
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
@ -73,11 +75,25 @@ class DataMonitor extends HTMLElement {
|
||||
|
||||
/**
|
||||
* @description 从localStorage获取当前选择的配置
|
||||
* @returns {Object} 包含plane和configurationId的对象
|
||||
* @returns {Object} 包含plane、configurationId和domainId的对象
|
||||
*/
|
||||
getCurrentSelection() {
|
||||
const selection = localStorage.getItem('xnsim-selection');
|
||||
return selection ? JSON.parse(selection) : { plane: '', configurationId: '' };
|
||||
|
||||
if (!selection) {
|
||||
return { plane: '', configurationId: '', domainId: '' };
|
||||
}
|
||||
|
||||
try {
|
||||
const parsedSelection = JSON.parse(selection);
|
||||
return {
|
||||
plane: parsedSelection.plane || '',
|
||||
configurationId: parsedSelection.configurationId || '',
|
||||
domainId: parsedSelection.domainId || ''
|
||||
};
|
||||
} catch (error) {
|
||||
return { plane: '', configurationId: '', domainId: '' };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,12 +172,231 @@ class DataMonitor extends HTMLElement {
|
||||
ModelStructName: item.ModelStructName,
|
||||
InjectValue: '',
|
||||
Drawing: false,
|
||||
isMonitoring: false,
|
||||
color: this.getRandomColor()
|
||||
});
|
||||
this.renderTable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化DDS监控服务
|
||||
* @returns {Promise<boolean>} 初始化是否成功
|
||||
*/
|
||||
async initializeDDSMonitor() {
|
||||
try {
|
||||
// 获取当前选择的配置
|
||||
const selection = this.getCurrentSelection();
|
||||
const { domainId } = selection;
|
||||
if (!domainId) {
|
||||
throw new Error('未找到有效的域ID,请确保已选择构型并等待构型加载完成');
|
||||
}
|
||||
|
||||
// 检查DDS监控状态
|
||||
const statusResponse = await fetch('/api/dds-monitor/status');
|
||||
if (!statusResponse.ok) {
|
||||
throw new Error(`获取DDS监控状态失败: ${statusResponse.status} ${statusResponse.statusText}`);
|
||||
}
|
||||
const statusData = await statusResponse.json();
|
||||
|
||||
// 如果未初始化,则初始化
|
||||
if (!statusData.isInitialized) {
|
||||
const initResponse = await fetch('/api/dds-monitor/initialize', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
domainId,
|
||||
monitorId: this.monitorId
|
||||
})
|
||||
});
|
||||
|
||||
if (!initResponse.ok) {
|
||||
const errorData = await initResponse.json();
|
||||
throw new Error(`初始化DDS监控失败: ${errorData.error || initResponse.statusText}`);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 按结构体名称分组获取接口数据
|
||||
* @returns {Object} 按结构体名称分组的接口数据
|
||||
*/
|
||||
getGroupedInterfaces() {
|
||||
return this.tableData.reduce((groups, row) => {
|
||||
if (!groups[row.ModelStructName]) {
|
||||
groups[row.ModelStructName] = [];
|
||||
}
|
||||
groups[row.ModelStructName].push(row.InterfaceName);
|
||||
return groups;
|
||||
}, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 估算数据缓冲区大小
|
||||
* @param {Array<string>} interfaceNames - 接口名称数组
|
||||
* @returns {number} 估算的缓冲区大小(字节)
|
||||
*/
|
||||
estimateBufferSize(interfaceNames) {
|
||||
// 基础开销:JSON格式的开销(括号、引号、逗号等)
|
||||
const baseOverhead = 100;
|
||||
|
||||
// 每个接口的估算大小
|
||||
const interfaceSize = interfaceNames.reduce((total, name) => {
|
||||
// 接口名称长度 + 引号 + 冒号
|
||||
const nameOverhead = name.length + 4;
|
||||
// 假设每个数据值平均长度为50字节(包括数字、字符串等)
|
||||
const estimatedValueSize = 50;
|
||||
// 逗号分隔符
|
||||
const separatorSize = 1;
|
||||
|
||||
return total + nameOverhead + estimatedValueSize + separatorSize;
|
||||
}, 0);
|
||||
|
||||
// 添加一些额外的缓冲空间(20%)
|
||||
const safetyMargin = Math.ceil((baseOverhead + interfaceSize) * 0.2);
|
||||
|
||||
// 确保返回的大小是4KB的倍数,并设置最小值为8KB
|
||||
const minSize = 8192;
|
||||
const size = Math.max(minSize, Math.ceil((baseOverhead + interfaceSize + safetyMargin) / 4096) * 4096);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 启动数据更新定时器
|
||||
*/
|
||||
startDataUpdateTimer() {
|
||||
if (this.dataUpdateTimer) {
|
||||
clearInterval(this.dataUpdateTimer);
|
||||
}
|
||||
|
||||
this.dataUpdateTimer = setInterval(async () => {
|
||||
try {
|
||||
const groupedInterfaces = this.getGroupedInterfaces();
|
||||
|
||||
// 对每个结构体启动监控并获取数据
|
||||
for (const [structName, interfaceNames] of Object.entries(groupedInterfaces)) {
|
||||
try {
|
||||
// 启动数据监控
|
||||
const startResponse = await fetch('/api/data-monitor/start', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ structName })
|
||||
});
|
||||
|
||||
if (!startResponse.ok) {
|
||||
throw new Error(`启动数据监控失败: ${structName}`);
|
||||
}
|
||||
|
||||
// 获取监控数据
|
||||
const interfaceNamesStr = JSON.stringify(interfaceNames);
|
||||
// 估算所需的缓冲区大小
|
||||
const bufferSize = this.estimateBufferSize(interfaceNames);
|
||||
|
||||
const infoResponse = await fetch(`/api/data-monitor/info?structName=${encodeURIComponent(structName)}&interfaceName=${encodeURIComponent(interfaceNamesStr)}&bufferSize=${bufferSize}`);
|
||||
|
||||
if (!infoResponse.ok) {
|
||||
throw new Error(`获取监控数据失败: ${structName}`);
|
||||
}
|
||||
|
||||
const responseData = await infoResponse.json();
|
||||
|
||||
if (!responseData.success) {
|
||||
throw new Error(`获取监控数据失败: ${responseData.message || '未知错误'}`);
|
||||
}
|
||||
|
||||
if (!responseData.data) {
|
||||
throw new Error(`获取监控数据失败: 返回数据为空`);
|
||||
}
|
||||
|
||||
// 更新表格数据
|
||||
this.tableData.forEach(row => {
|
||||
if (row.ModelStructName === structName && responseData.data[row.InterfaceName]) {
|
||||
row.monitorData = responseData.data[row.InterfaceName];
|
||||
}
|
||||
});
|
||||
} catch (structError) {
|
||||
console.error(`处理结构体 ${structName} 时出错:`, structError);
|
||||
// 继续处理其他结构体
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新表格显示
|
||||
this.renderTable();
|
||||
} catch (error) {
|
||||
console.error('数据更新失败:', error);
|
||||
// 如果发生错误,停止定时器
|
||||
this.stopDataUpdateTimer();
|
||||
// 更新UI状态
|
||||
const globalMonitorBtn = this.shadowRoot.getElementById('globalMonitorBtn');
|
||||
const statusIndicator = this.shadowRoot.getElementById('statusIndicator');
|
||||
const statusText = this.shadowRoot.getElementById('statusText');
|
||||
|
||||
if (globalMonitorBtn) {
|
||||
globalMonitorBtn.textContent = '开始监控';
|
||||
globalMonitorBtn.classList.remove('monitoring');
|
||||
}
|
||||
if (statusIndicator) {
|
||||
statusIndicator.classList.remove('active');
|
||||
statusIndicator.classList.add('error');
|
||||
}
|
||||
if (statusText) {
|
||||
statusText.textContent = '监控错误';
|
||||
}
|
||||
|
||||
// 清空所有监控数据
|
||||
this.tableData.forEach(row => {
|
||||
row.isMonitoring = false;
|
||||
row.monitorData = '';
|
||||
});
|
||||
|
||||
this.renderTable();
|
||||
alert(`数据监控发生错误: ${error.message}`);
|
||||
}
|
||||
}, 1000); // 每秒更新一次
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 停止数据更新定时器,并通知后端停止监控所有相关结构体
|
||||
*/
|
||||
async stopDataUpdateTimer() {
|
||||
// 先清理前端定时器
|
||||
if (this.dataUpdateTimer) {
|
||||
clearInterval(this.dataUpdateTimer);
|
||||
this.dataUpdateTimer = null;
|
||||
}
|
||||
// 收集所有正在监控的结构体名(去重)
|
||||
const monitoringStructs = Array.from(new Set(
|
||||
this.tableData
|
||||
.filter(row => row.isMonitoring)
|
||||
.map(row => row.ModelStructName)
|
||||
));
|
||||
// 并发调用后端接口,通知停止监控
|
||||
try {
|
||||
await Promise.all(
|
||||
monitoringStructs.map(structName =>
|
||||
fetch('/api/data-monitor/stop', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ structName })
|
||||
})
|
||||
)
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('停止后端监控时发生错误:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 渲染表格内容
|
||||
*/
|
||||
@ -172,15 +407,14 @@ class DataMonitor extends HTMLElement {
|
||||
<tr>
|
||||
<td><span class="cell-text">${row.InterfaceName}</span></td>
|
||||
<td><span class="cell-text">${row.ModelStructName}</span></td>
|
||||
<td><span class="cell-text"></span></td>
|
||||
<td><span class="cell-text">${row.monitorData || ''}</span></td>
|
||||
<td>
|
||||
<input type="text" class="inject-input" data-index="${idx}" value="${row.InjectValue || ''}" placeholder="注入值" style="width:90px;" />
|
||||
</td>
|
||||
<td style="min-width:120px; white-space:nowrap;">
|
||||
<button class="action-btn monitor-btn" data-index="${idx}">开始监控</button>
|
||||
<button class="action-btn chart-btn${row.Drawing ? ' drawing' : ''}" data-index="${idx}">绘图</button>
|
||||
<button class="action-btn inject-once-btn" data-index="${idx}">单次注入</button>
|
||||
<button class="action-btn inject-loop-btn" data-index="${idx}">连续注入</button>
|
||||
<button class="action-btn chart-btn${row.Drawing ? ' drawing' : ''}" data-index="${idx}" ${!row.isMonitoring ? 'disabled' : ''}>绘图</button>
|
||||
<button class="action-btn inject-once-btn" data-index="${idx}" ${!row.isMonitoring ? 'disabled' : ''}>单次注入</button>
|
||||
<button class="action-btn inject-loop-btn" data-index="${idx}" ${!row.isMonitoring ? 'disabled' : ''}>连续注入</button>
|
||||
<button class="action-btn delete-btn" data-index="${idx}">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
@ -214,6 +448,7 @@ class DataMonitor extends HTMLElement {
|
||||
this.updateChart();
|
||||
};
|
||||
});
|
||||
|
||||
this.shadowRoot.querySelectorAll('.delete-btn').forEach(btn => {
|
||||
btn.onclick = (e) => {
|
||||
const idx = parseInt(btn.getAttribute('data-index'));
|
||||
@ -329,12 +564,81 @@ class DataMonitor extends HTMLElement {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 16px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.toolbar-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.monitor-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.status-indicator {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
.status-indicator.active {
|
||||
background: #52c41a;
|
||||
}
|
||||
|
||||
.status-indicator.error {
|
||||
background: #ff4d4f;
|
||||
}
|
||||
|
||||
.global-monitor-btn {
|
||||
padding: 6px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: #1890ff;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.global-monitor-btn:hover {
|
||||
background: #40a9ff;
|
||||
}
|
||||
|
||||
.global-monitor-btn.monitoring {
|
||||
background: #ff4d4f;
|
||||
}
|
||||
|
||||
.global-monitor-btn.monitoring:hover {
|
||||
background: #ff7875;
|
||||
}
|
||||
|
||||
.monitor-container {
|
||||
background-color: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 16px;
|
||||
height: 100%;
|
||||
height: calc(100% - 72px);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
@ -611,7 +915,26 @@ class DataMonitor extends HTMLElement {
|
||||
.th-resize.active::after {
|
||||
background: #1890ff;
|
||||
}
|
||||
.monitor-btn.monitoring {
|
||||
background: #ff4d4f;
|
||||
color: #fff;
|
||||
}
|
||||
.action-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<button class="global-monitor-btn" id="globalMonitorBtn">开始监控</button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<div class="monitor-status">
|
||||
<div class="status-indicator" id="statusIndicator"></div>
|
||||
<span id="statusText">未监控</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="monitor-container">
|
||||
<div class="tree-container">
|
||||
<div class="search-box">
|
||||
@ -763,6 +1086,64 @@ class DataMonitor extends HTMLElement {
|
||||
document.body.style.userSelect = '';
|
||||
}
|
||||
};
|
||||
|
||||
// 绑定全局监控按钮事件
|
||||
const globalMonitorBtn = this.shadowRoot.getElementById('globalMonitorBtn');
|
||||
const statusIndicator = this.shadowRoot.getElementById('statusIndicator');
|
||||
const statusText = this.shadowRoot.getElementById('statusText');
|
||||
|
||||
globalMonitorBtn.addEventListener('click', async () => {
|
||||
try {
|
||||
if (!globalMonitorBtn.classList.contains('monitoring')) {
|
||||
// 开始监控
|
||||
const ddsInitialized = await this.initializeDDSMonitor();
|
||||
if (!ddsInitialized) {
|
||||
throw new Error('DDS监控初始化失败');
|
||||
}
|
||||
|
||||
// 更新所有行的监控状态
|
||||
this.tableData.forEach(row => {
|
||||
row.isMonitoring = true;
|
||||
});
|
||||
|
||||
// 启动数据更新定时器
|
||||
this.startDataUpdateTimer();
|
||||
|
||||
// 更新状态
|
||||
globalMonitorBtn.textContent = '停止监控';
|
||||
globalMonitorBtn.classList.add('monitoring');
|
||||
statusIndicator.classList.add('active');
|
||||
statusText.textContent = '监控中';
|
||||
this.renderTable();
|
||||
} else {
|
||||
// 停止监控
|
||||
// 停止数据更新定时器
|
||||
await this.stopDataUpdateTimer();
|
||||
|
||||
// 更新所有行的监控状态
|
||||
this.tableData.forEach(row => {
|
||||
row.isMonitoring = false;
|
||||
row.monitorData = ''; // 清空监控数据
|
||||
});
|
||||
|
||||
// 更新状态
|
||||
globalMonitorBtn.textContent = '开始监控';
|
||||
globalMonitorBtn.classList.remove('monitoring');
|
||||
statusIndicator.classList.remove('active');
|
||||
statusText.textContent = '未监控';
|
||||
this.renderTable();
|
||||
}
|
||||
} catch (error) {
|
||||
statusIndicator.classList.add('error');
|
||||
statusText.textContent = '监控错误';
|
||||
alert(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
// 组件销毁时清理定时器
|
||||
this.stopDataUpdateTimer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,18 @@ class HeaderTools extends HTMLElement {
|
||||
return this.shadowRoot.getElementById('configurationSelect').value;
|
||||
}
|
||||
|
||||
get selectedDomain() {
|
||||
const select = this.shadowRoot.getElementById('configurationSelect');
|
||||
const selectedOption = select.options[select.selectedIndex];
|
||||
return selectedOption ? selectedOption.dataset.domainId : '';
|
||||
}
|
||||
|
||||
// 保存选择到localStorage
|
||||
saveSelection() {
|
||||
const selection = {
|
||||
plane: this.selectedPlane,
|
||||
configurationId: this.selectedConfiguration
|
||||
configurationId: this.selectedConfiguration,
|
||||
domainId: this.selectedDomain
|
||||
};
|
||||
localStorage.setItem('xnsim-selection', JSON.stringify(selection));
|
||||
}
|
||||
@ -40,6 +47,8 @@ class HeaderTools extends HTMLElement {
|
||||
this.loadConfigurations(selection.plane).then(() => {
|
||||
if (selection.configurationId) {
|
||||
configurationSelect.value = selection.configurationId;
|
||||
// 触发change事件以确保domainId被更新
|
||||
configurationSelect.dispatchEvent(new Event('change'));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -183,9 +192,6 @@ class HeaderTools extends HTMLElement {
|
||||
|
||||
// 机型选择
|
||||
this.shadowRoot.getElementById('planeSelect').addEventListener('change', (e) => {
|
||||
this.dispatchEvent(new CustomEvent('plane-change', {
|
||||
detail: { plane: e.target.value }
|
||||
}));
|
||||
// 当机型改变时,重新加载该机型下的构型列表
|
||||
this.loadConfigurations(e.target.value);
|
||||
// 保存选择
|
||||
@ -194,13 +200,6 @@ class HeaderTools extends HTMLElement {
|
||||
|
||||
// 构型选择
|
||||
this.shadowRoot.getElementById('configurationSelect').addEventListener('change', (e) => {
|
||||
const selectedOption = e.target.options[e.target.selectedIndex];
|
||||
this.dispatchEvent(new CustomEvent('configuration-change', {
|
||||
detail: {
|
||||
configurationId: e.target.value,
|
||||
configurationName: selectedOption.textContent
|
||||
}
|
||||
}));
|
||||
// 保存选择
|
||||
this.saveSelection();
|
||||
});
|
||||
@ -246,6 +245,8 @@ class HeaderTools extends HTMLElement {
|
||||
const option = document.createElement('option');
|
||||
option.value = config.ConfID;
|
||||
option.textContent = config.ConfName;
|
||||
// 将DomainID存储在option的data属性中
|
||||
option.dataset.domainId = config.DomainID;
|
||||
select.appendChild(option);
|
||||
});
|
||||
} catch (error) {
|
||||
|
@ -1039,6 +1039,23 @@ class RunSim extends HTMLElement {
|
||||
if (!ddsStatus.isInitialized) {
|
||||
throw new Error('DDS监控未初始化');
|
||||
}
|
||||
|
||||
// 初始化引擎控制
|
||||
const initResponse = await fetch('/api/system-control/initialize', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (!initResponse.ok) {
|
||||
throw new Error('初始化引擎控制失败');
|
||||
}
|
||||
|
||||
const initResult = await initResponse.json();
|
||||
if (!initResult.success) {
|
||||
throw new Error(initResult.message || '初始化引擎控制失败');
|
||||
}
|
||||
|
||||
// 根据当前暂停状态调用不同的接口
|
||||
const apiEndpoint = this.isPaused ? '/api/system-control/resume' : '/api/system-control/pause';
|
||||
@ -1085,7 +1102,24 @@ class RunSim extends HTMLElement {
|
||||
throw new Error('DDS监控未初始化');
|
||||
}
|
||||
|
||||
// 首先使用新的引擎控制接口
|
||||
// 初始化引擎控制
|
||||
const initResponse = await fetch('/api/system-control/initialize', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (!initResponse.ok) {
|
||||
throw new Error('初始化引擎控制失败');
|
||||
}
|
||||
|
||||
const initResult = await initResponse.json();
|
||||
if (!initResult.success) {
|
||||
throw new Error(initResult.message || '初始化引擎控制失败');
|
||||
}
|
||||
|
||||
// 使用引擎控制接口停止仿真
|
||||
const response = await fetch('/api/system-control/stop', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
177
XNSimHtml/routes/DataMonitor.js
Normal file
177
XNSimHtml/routes/DataMonitor.js
Normal file
@ -0,0 +1,177 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const systemMonitor = require('../utils/systemMonitor');
|
||||
|
||||
/**
|
||||
* @brief 启动数据监控
|
||||
* @route POST /api/data-monitor/start
|
||||
* @param {string} structName - 结构体名称
|
||||
* @returns {Object} 返回启动结果
|
||||
*/
|
||||
router.post('/start', async (req, res) => {
|
||||
try {
|
||||
const { structName } = req.body;
|
||||
if (!structName) {
|
||||
return res.status(400).json({ success: false, message: '结构体名称不能为空' });
|
||||
}
|
||||
|
||||
const result = systemMonitor.startDataMonitor(structName);
|
||||
if (result.includes('失败')) {
|
||||
return res.status(500).json({ success: false, message: result });
|
||||
}
|
||||
res.json({ success: true, message: result });
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, message: `启动数据监控失败: ${error.message}` });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @brief 停止数据监控
|
||||
* @route POST /api/data-monitor/stop
|
||||
* @param {string} structName - 结构体名称
|
||||
* @returns {Object} 返回停止结果
|
||||
*/
|
||||
router.post('/stop', async (req, res) => {
|
||||
try {
|
||||
const { structName } = req.body;
|
||||
if (!structName) {
|
||||
return res.status(400).json({ success: false, message: '结构体名称不能为空' });
|
||||
}
|
||||
|
||||
const result = systemMonitor.stopDataMonitor(structName);
|
||||
if (result.includes('失败')) {
|
||||
return res.status(500).json({ success: false, message: result });
|
||||
}
|
||||
res.json({ success: true, message: result });
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, message: `停止数据监控失败: ${error.message}` });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @brief 获取数据监控信息
|
||||
* @route GET /api/data-monitor/info
|
||||
* @param {string} structName - 结构体名称
|
||||
* @param {string} interfaceName - 接口名称
|
||||
* @param {number} [bufferSize=8192] - 数据缓冲区大小(可选)
|
||||
* @returns {Object} 返回监控信息,data字段包含解析后的JSON对象
|
||||
*/
|
||||
router.get('/info', async (req, res) => {
|
||||
try {
|
||||
const { structName, interfaceName, bufferSize } = req.query;
|
||||
if (!structName || !interfaceName) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
message: '结构体名称和接口名称不能为空'
|
||||
});
|
||||
}
|
||||
|
||||
const result = systemMonitor.getDataMonitorInfo(
|
||||
structName,
|
||||
interfaceName,
|
||||
bufferSize ? parseInt(bufferSize) : undefined
|
||||
);
|
||||
if (typeof result === 'string' && result.includes('失败')) {
|
||||
return res.status(500).json({ success: false, message: result });
|
||||
}
|
||||
|
||||
// 解析数据字符串为JSON对象
|
||||
let parsedData;
|
||||
try {
|
||||
parsedData = JSON.parse(result.data);
|
||||
} catch (parseError) {
|
||||
return res.status(500).json({
|
||||
success: false,
|
||||
message: `数据解析失败: ${parseError.message}`
|
||||
});
|
||||
}
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
data: parsedData,
|
||||
info: result.info
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, message: `获取数据监控信息失败: ${error.message}` });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @brief 注入数据接口
|
||||
* @route POST /api/data-monitor/inject
|
||||
* @param {string} structName - 结构体名称
|
||||
* @param {string} interfaceNameAndData - 接口名称和数据JSON字符串
|
||||
* @returns {Object} 返回注入结果
|
||||
*/
|
||||
router.post('/inject', async (req, res) => {
|
||||
try {
|
||||
const { structName, interfaceNameAndData } = req.body;
|
||||
if (!structName || !interfaceNameAndData) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
message: '结构体名称和接口数据不能为空'
|
||||
});
|
||||
}
|
||||
|
||||
const result = systemMonitor.injectDataInterface(structName, interfaceNameAndData);
|
||||
if (result.includes('失败')) {
|
||||
return res.status(500).json({ success: false, message: result });
|
||||
}
|
||||
res.json({ success: true, message: result });
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, message: `注入数据接口失败: ${error.message}` });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @brief 启动持续注入数据
|
||||
* @route POST /api/data-monitor/start-continuous
|
||||
* @param {string} structName - 结构体名称
|
||||
* @param {string} interfaceNameAndData - 接口名称和数据JSON字符串
|
||||
* @param {number} frequency - 注入频率
|
||||
* @returns {Object} 返回启动结果
|
||||
*/
|
||||
router.post('/start-continuous', async (req, res) => {
|
||||
try {
|
||||
const { structName, interfaceNameAndData, frequency } = req.body;
|
||||
if (!structName || !interfaceNameAndData || frequency === undefined) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
message: '结构体名称、接口数据和注入频率不能为空'
|
||||
});
|
||||
}
|
||||
|
||||
const result = systemMonitor.startInjectContinuous(structName, interfaceNameAndData, frequency);
|
||||
if (result.includes('失败')) {
|
||||
return res.status(500).json({ success: false, message: result });
|
||||
}
|
||||
res.json({ success: true, message: result });
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, message: `启动持续注入数据失败: ${error.message}` });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @brief 停止持续注入数据
|
||||
* @route POST /api/data-monitor/stop-continuous
|
||||
* @param {string} structName - 结构体名称
|
||||
* @returns {Object} 返回停止结果
|
||||
*/
|
||||
router.post('/stop-continuous', async (req, res) => {
|
||||
try {
|
||||
const { structName } = req.body;
|
||||
if (!structName) {
|
||||
return res.status(400).json({ success: false, message: '结构体名称不能为空' });
|
||||
}
|
||||
|
||||
const result = systemMonitor.stopInjectContinuous(structName);
|
||||
if (result.includes('失败')) {
|
||||
return res.status(500).json({ success: false, message: result });
|
||||
}
|
||||
res.json({ success: true, message: result });
|
||||
} catch (error) {
|
||||
res.status(500).json({ success: false, message: `停止持续注入数据失败: ${error.message}` });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
@ -30,6 +30,7 @@ const ddsMonitorRoutes = require('./routes/DDSMonitor');
|
||||
const systemMonitorRoutes = require('./routes/SystemMonitor');
|
||||
const modelMonitorRoutes = require('./routes/ModelMonitor');
|
||||
const systemControlRoutes = require('./routes/SystemControl');
|
||||
const dataMonitorRoutes = require('./routes/DataMonitor');
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
@ -101,6 +102,7 @@ app.use('/api/dds-monitor', ddsMonitorRoutes);
|
||||
app.use('/api/system-monitor', systemMonitorRoutes);
|
||||
app.use('/api/model-monitor', modelMonitorRoutes);
|
||||
app.use('/api/system-control', systemControlRoutes);
|
||||
app.use('/api/data-monitor', dataMonitorRoutes);
|
||||
|
||||
// 接口配置页面路由
|
||||
app.get('/interface-config', (req, res) => {
|
||||
|
@ -53,7 +53,13 @@ try {
|
||||
'XN_InitializeEngineControl': ['int', [StringType, 'int']],
|
||||
'XN_PauseEngine': ['void', [StringType, 'int']],
|
||||
'XN_ResumeEngine': ['void', [StringType, 'int']],
|
||||
'XN_StopEngine': ['void', [StringType, 'int']]
|
||||
'XN_StopEngine': ['void', [StringType, 'int']],
|
||||
'XN_StartDataMonitor': ['int', [StringType, 'int', StringType, 'int']],
|
||||
'XN_StopDataMonitor': ['void', [StringType, 'int', StringType, 'int']],
|
||||
'XN_GetDataMonitorInfo': ['int', [StringType, 'int', StringType, 'int', StringType, 'int', StringType, 'int']],
|
||||
'XN_InjectDataInterface': ['int', [StringType, 'int', StringType, 'int', StringType, 'int']],
|
||||
'XN_StartInjectContinuous': ['int', [StringType, 'int', StringType, 'int', 'double', StringType, 'int']],
|
||||
'XN_StopInjectContinuous': ['int', [StringType, 'int', StringType, 'int']]
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`加载 ${monitorLibName} 失败:`, error);
|
||||
@ -291,6 +297,131 @@ function stopEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
// 启动数据监控
|
||||
function startDataMonitor(structName) {
|
||||
if (!monitorLib) {
|
||||
return '监控服务器库未加载';
|
||||
}
|
||||
try {
|
||||
const errorMsg = Buffer.alloc(1024);
|
||||
const result = monitorLib.XN_StartDataMonitor(structName, structName.length, errorMsg, errorMsg.length);
|
||||
if (result !== 0) {
|
||||
return `启动数据监控失败: ${errorMsg.toString('utf8').replace(/\0/g, '')}`;
|
||||
}
|
||||
return '启动数据监控成功';
|
||||
} catch (error) {
|
||||
return `启动数据监控失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 停止数据监控
|
||||
function stopDataMonitor(structName) {
|
||||
if (!monitorLib) {
|
||||
return '监控服务器库未加载';
|
||||
}
|
||||
try {
|
||||
const errorMsg = Buffer.alloc(1024);
|
||||
monitorLib.XN_StopDataMonitor(structName, structName.length, errorMsg, errorMsg.length);
|
||||
const error = errorMsg.toString('utf8').replace(/\0/g, '');
|
||||
return error ? `停止数据监控失败: ${error}` : '停止数据监控成功';
|
||||
} catch (error) {
|
||||
return `停止数据监控失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取数据监控信息
|
||||
function getDataMonitorInfo(structName, interfaceName, bufferSize = 8192) {
|
||||
if (!monitorLib) {
|
||||
return '监控服务器库未加载';
|
||||
}
|
||||
try {
|
||||
const infoMsg = Buffer.alloc(1024);
|
||||
const dataBuffer = Buffer.alloc(bufferSize); // 使用指定的缓冲区大小
|
||||
const result = monitorLib.XN_GetDataMonitorInfo(
|
||||
structName, structName.length,
|
||||
interfaceName, interfaceName.length,
|
||||
dataBuffer, dataBuffer.length,
|
||||
infoMsg, infoMsg.length
|
||||
);
|
||||
|
||||
if (result !== 0) {
|
||||
return `获取数据监控信息失败: ${infoMsg.toString('utf8').replace(/\0/g, '')}`;
|
||||
}
|
||||
return {
|
||||
data: dataBuffer.toString('utf8').replace(/\0/g, ''),
|
||||
info: infoMsg.toString('utf8').replace(/\0/g, '')
|
||||
};
|
||||
} catch (error) {
|
||||
return `获取数据监控信息失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 注入数据接口
|
||||
function injectDataInterface(structName, interfaceNameAndData) {
|
||||
if (!monitorLib) {
|
||||
return '监控服务器库未加载';
|
||||
}
|
||||
try {
|
||||
const infoMsg = Buffer.alloc(1024);
|
||||
const result = monitorLib.XN_InjectDataInterface(
|
||||
structName, structName.length,
|
||||
interfaceNameAndData, interfaceNameAndData.length,
|
||||
infoMsg, infoMsg.length
|
||||
);
|
||||
|
||||
if (result !== 0) {
|
||||
return `注入数据接口失败: ${infoMsg.toString('utf8').replace(/\0/g, '')}`;
|
||||
}
|
||||
return '注入数据接口成功';
|
||||
} catch (error) {
|
||||
return `注入数据接口失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 持续注入数据接口
|
||||
function startInjectContinuous(structName, interfaceNameAndData, frequency) {
|
||||
if (!monitorLib) {
|
||||
return '监控服务器库未加载';
|
||||
}
|
||||
try {
|
||||
const infoMsg = Buffer.alloc(1024);
|
||||
const result = monitorLib.XN_StartInjectContinuous(
|
||||
structName, structName.length,
|
||||
interfaceNameAndData, interfaceNameAndData.length,
|
||||
frequency,
|
||||
infoMsg, infoMsg.length
|
||||
);
|
||||
|
||||
if (result !== 0) {
|
||||
return `启动持续注入数据失败: ${infoMsg.toString('utf8').replace(/\0/g, '')}`;
|
||||
}
|
||||
return '启动持续注入数据成功';
|
||||
} catch (error) {
|
||||
return `启动持续注入数据失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 停止持续注入数据接口
|
||||
function stopInjectContinuous(structName) {
|
||||
if (!monitorLib) {
|
||||
return '监控服务器库未加载';
|
||||
}
|
||||
try {
|
||||
const infoMsg = Buffer.alloc(1024);
|
||||
const result = monitorLib.XN_StopInjectContinuous(
|
||||
structName, structName.length,
|
||||
infoMsg, infoMsg.length
|
||||
);
|
||||
|
||||
if (result !== 0) {
|
||||
return `停止持续注入数据失败: ${infoMsg.toString('utf8').replace(/\0/g, '')}`;
|
||||
}
|
||||
return '停止持续注入数据成功';
|
||||
} catch (error) {
|
||||
return `停止持续注入数据失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
loginLib,
|
||||
monitorLib,
|
||||
@ -308,5 +439,11 @@ module.exports = {
|
||||
initializeEngineControl,
|
||||
pauseEngine,
|
||||
resumeEngine,
|
||||
stopEngine
|
||||
stopEngine,
|
||||
startDataMonitor,
|
||||
stopDataMonitor,
|
||||
getDataMonitorInfo,
|
||||
injectDataInterface,
|
||||
startInjectContinuous,
|
||||
stopInjectContinuous
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user