| 115 | } |
| 116 | |
| 117 | void OrbcommPlotterModule::process() |
| 118 | { |
| 119 | std::ifstream data_in; |
| 120 | if (input_data_type == DATA_FILE) |
| 121 | filesize = getFilesize(d_input_file); |
| 122 | else |
| 123 | filesize = 0; |
| 124 | if (input_data_type == DATA_FILE) |
| 125 | data_in = std::ifstream(d_input_file, std::ios::binary); |
| 126 | |
| 127 | std::ofstream data_out(d_output_file_hint + "_plotter.frm", std::ios::binary); |
| 128 | logger->info("Using input frames " + d_input_file); |
| 129 | uint8_t frm[600]; |
| 130 | |
| 131 | double qth_lon = satdump::config::main_cfg["satdump_general"]["qth_lon"]["value"].get<double>(); |
| 132 | double qth_lat = satdump::config::main_cfg["satdump_general"]["qth_lat"]["value"].get<double>(); |
| 133 | double qth_alt = satdump::config::main_cfg["satdump_general"]["qth_alt"]["value"].get<double>(); |
| 134 | |
| 135 | predict_observer_t *predict_obs = predict_create_observer("Main", qth_lat * DEG_TO_RAD, qth_lon * DEG_TO_RAD, qth_alt); |
| 136 | |
| 137 | time_t lastTime = 0; |
| 138 | |
| 139 | while (input_data_type == DATA_FILE ? !data_in.eof() : input_active.load()) |
| 140 | { |
| 141 | // Read buffer |
| 142 | if (input_data_type == DATA_FILE) |
| 143 | data_in.read((char *)frm, 600); |
| 144 | else |
| 145 | input_fifo->read((uint8_t *)frm, 600); |
| 146 | |
| 147 | data_out.write((char *)frm, 600); |
| 148 | |
| 149 | for (int i = 0; i < 50; i++) |
| 150 | { |
| 151 | if (frm[i * 12] == 0x1F) |
| 152 | { |
| 153 | if (orbcomm_fcs(&frm[i * 12], 24) == 0) |
| 154 | { |
| 155 | std::reverse(&frm[i * 12 + 2], &frm[i * 12 + 22]); |
| 156 | |
| 157 | int scid = frm[i * 12 + 1]; |
| 158 | int week_number = frm[i * 12 + 2] << 8 | frm[i * 12 + 3]; |
| 159 | int time_of_week = frm[i * 12 + 4] << 16 | frm[i * 12 + 5] << 8 | frm[i * 12 + 6]; |
| 160 | |
| 161 | // logger->info("Week Number %d, Time Of Week %d", week_number, time_of_week); |
| 162 | |
| 163 | const double MAX_R_SAT = 8378155.0; |
| 164 | const double VAL_20_BITS = 1048576.0; |
| 165 | const double MAX_V_SAT = 7700.0; |
| 166 | |
| 167 | uint32_t values[6]; |
| 168 | repackBytesTo20bits(&frm[i * 12 + 7], 15, values); |
| 169 | |
| 170 | long x_raw = values[5]; |
| 171 | long y_raw = values[4]; |
| 172 | long z_raw = values[3]; |
| 173 | |
| 174 | long x_raw2 = values[2]; |
nothing calls this directly
no test coverage detected