eive-obsw/linux/acs/startracker/strJsonCommands.cpp

918 lines
26 KiB
C++
Raw Normal View History

2023-03-22 02:20:14 +01:00
#include "strJsonCommands.h"
2022-01-17 15:58:27 +01:00
2023-03-22 02:20:14 +01:00
#include "arcsecJsonKeys.h"
Limits::Limits() : ArcsecJsonParamBase(arcseckeys::LIMITS) {}
2022-01-17 15:58:27 +01:00
size_t Limits::getSize() { return COMMAND_SIZE; }
ReturnValue_t Limits::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::LIMITS);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::ACTION, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::FPGA18CURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::FPGA25CURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::FPGA10CURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MCUCURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::CMOS21CURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::CMOSPIXCURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::CMOS33CURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::CMOSVRESCURRENT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::CMOS_TEMPERATURE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MCU_TEMPERATURE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
}
Tracking::Tracking() : ArcsecJsonParamBase(arcseckeys::TRACKING) {}
2022-01-17 15:58:27 +01:00
size_t Tracking::getSize() { return COMMAND_SIZE; }
ReturnValue_t Tracking::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::TRACKING);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::THIN_LIMIT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::OUTLIER_THRESHOLD, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::OUTLIER_THRESHOLD_QUEST, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::TRACKER_CHOICE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
}
Mounting::Mounting() : ArcsecJsonParamBase(arcseckeys::MOUNTING) {}
2022-01-17 15:58:27 +01:00
size_t Mounting::getSize() { return COMMAND_SIZE; }
ReturnValue_t Mounting::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::MOUNTING);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::qw, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::qx, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::qy, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::qz, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
}
2022-01-29 12:27:26 +01:00
ImageProcessor::ImageProcessor() : ArcsecJsonParamBase(arcseckeys::IMAGE_PROCESSOR) {}
size_t ImageProcessor::getSize() { return COMMAND_SIZE; }
ReturnValue_t ImageProcessor::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-29 12:27:26 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::IMAGE_PROCESSOR);
2022-01-29 12:27:26 +01:00
offset = 2;
result = getParam(arcseckeys::IMAGE_PROCESSOR_MODE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-29 12:27:26 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::STORE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-29 12:27:26 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::SIGNAL_THRESHOLD, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-29 12:27:26 +01:00
return result;
}
adduint16(param, buffer + offset);
offset += sizeof(uint16_t);
result = getParam(arcseckeys::IMAGE_PROCESSOR_DARK_THRESHOLD, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-29 12:27:26 +01:00
return result;
}
adduint16(param, buffer + offset);
offset += sizeof(uint16_t);
result = getParam(arcseckeys::BACKGROUND_COMPENSATION, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-29 12:27:26 +01:00
return result;
}
adduint8(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2022-01-29 12:27:26 +01:00
}
Camera::Camera() : ArcsecJsonParamBase(arcseckeys::CAMERA) {}
2022-01-17 15:58:27 +01:00
size_t Camera::getSize() { return COMMAND_SIZE; }
ReturnValue_t Camera::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::CAMERA);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::MODE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::FOCALLENGTH, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::EXPOSURE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::INTERVAL, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::OFFSET, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addint16(param, buffer + offset);
offset += sizeof(int16_t);
result = getParam(arcseckeys::PGAGAIN, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::ADCGAIN, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_1, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_1, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_2, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_2, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_3, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_3, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_4, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_4, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_5, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_5, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_6, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_6, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_7, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_7, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::REG_8, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::VAL_8, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::FREQ_1, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
2022-01-28 12:43:26 +01:00
adduint32(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
}
2021-12-08 12:50:55 +01:00
Centroiding::Centroiding() : ArcsecJsonParamBase(arcseckeys::CENTROIDING) {}
2022-01-17 15:58:27 +01:00
size_t Centroiding::getSize() { return COMMAND_SIZE; }
ReturnValue_t Centroiding::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::CENTROIDING);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::ENABLE_FILTER, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::MAX_QUALITY, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
2022-01-28 12:43:26 +01:00
result = getParam(arcseckeys::DARK_THRESHOLD, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-28 12:43:26 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
2022-01-17 15:58:27 +01:00
result = getParam(arcseckeys::MIN_QUALITY, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MAX_INTENSITY, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MIN_INTENSITY, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MAX_MAGNITUDE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::GAUSSIAN_CMAX, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::GAUSSIAN_CMIN, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::TRANSMATRIX_00, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::TRANSMATRIX_01, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::TRANSMATRIX_10, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::TRANSMATRIX_11, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2021-12-08 12:50:55 +01:00
}
Lisa::Lisa() : ArcsecJsonParamBase(arcseckeys::LISA) {}
2022-01-17 15:58:27 +01:00
size_t Lisa::getSize() { return COMMAND_SIZE; }
2021-12-08 12:50:55 +01:00
ReturnValue_t Lisa::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::LISA);
2022-01-17 15:58:27 +01:00
offset = 2;
2022-01-28 12:43:26 +01:00
result = getParam(arcseckeys::LISA_MODE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-28 12:43:26 +01:00
return result;
}
adduint32(param, buffer + offset);
offset += sizeof(uint32_t);
2022-01-17 15:58:27 +01:00
result = getParam(arcseckeys::PREFILTER_DIST_THRESHOLD, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::PREFILTER_ANGLE_THRESHOLD, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::FOV_WIDTH, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::FOV_HEIGHT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::FLOAT_STAR_LIMIT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::CLOSE_STAR_LIMIT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::RATING_WEIGHT_CLOSE_STAR_COUNT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::RATING_WEIGHT_FRACTION_CLOSE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
2022-02-10 18:39:37 +01:00
result = getParam(arcseckeys::RATING_WEIGHT_MEAN_SUM, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
2022-01-17 15:58:27 +01:00
result = getParam(arcseckeys::RATING_WEIGHT_DB_STAR_COUNT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MAX_COMBINATIONS, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::NR_STARS_STOP, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::FRACTION_CLOSE_STOP, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2021-12-08 12:50:55 +01:00
}
Matching::Matching() : ArcsecJsonParamBase(arcseckeys::MATCHING) {}
2022-01-17 15:58:27 +01:00
size_t Matching::getSize() { return COMMAND_SIZE; }
2021-12-08 12:50:55 +01:00
ReturnValue_t Matching::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::MATCHING);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::SQUARED_DISTANCE_LIMIT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::SQUARED_SHIFT_LIMIT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2021-12-08 12:50:55 +01:00
}
Validation::Validation() : ArcsecJsonParamBase(arcseckeys::VALIDATION) {}
2022-01-17 15:58:27 +01:00
size_t Validation::getSize() { return COMMAND_SIZE; }
2021-12-08 12:50:55 +01:00
ReturnValue_t Validation::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::VALIDATION);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::STABLE_COUNT, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::MAX_DIFFERENCE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MIN_TRACKER_CONFIDENCE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::MIN_MATCHED_STARS, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2021-12-08 12:50:55 +01:00
}
Algo::Algo() : ArcsecJsonParamBase(arcseckeys::ALGO) {}
2022-01-17 15:58:27 +01:00
size_t Algo::getSize() { return COMMAND_SIZE; }
2021-12-08 12:50:55 +01:00
ReturnValue_t Algo::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-01-17 15:58:27 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::ALGO);
2022-01-17 15:58:27 +01:00
offset = 2;
result = getParam(arcseckeys::MODE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::L2T_MIN_CONFIDENCE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::L2T_MIN_MATCHED, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::T2L_MIN_CONFIDENCE, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::T2L_MIN_MATCHED, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-01-17 15:58:27 +01:00
return result;
}
adduint8(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
}
2022-02-10 18:39:37 +01:00
LogLevel::LogLevel() : ArcsecJsonParamBase(arcseckeys::LOGLEVEL) {}
size_t LogLevel::getSize() { return COMMAND_SIZE; }
ReturnValue_t LogLevel::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-02-10 18:39:37 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::LOG_LEVEL);
2022-02-10 18:39:37 +01:00
offset = 2;
result = getParam(arcseckeys::LOGLEVEL1, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL2, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL3, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL4, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL5, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL6, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL7, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL8, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL9, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL10, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL11, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL12, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL13, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL14, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL15, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL16, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2022-02-10 18:39:37 +01:00
}
Subscription::Subscription() : ArcsecJsonParamBase(arcseckeys::SUBSCRIPTION) {}
size_t Subscription::getSize() { return COMMAND_SIZE; }
ReturnValue_t Subscription::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-02-10 18:39:37 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::SUBSCRIPTION);
2022-02-10 18:39:37 +01:00
offset = 2;
result = getParam(arcseckeys::TELEMETRY_1, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_2, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_3, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_4, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_5, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_6, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_7, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_8, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_9, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_10, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_11, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_12, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_13, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_14, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_15, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_16, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2022-02-10 18:39:37 +01:00
}
LogSubscription::LogSubscription() : ArcsecJsonParamBase(arcseckeys::LOG_SUBSCRIPTION) {}
size_t LogSubscription::getSize() { return COMMAND_SIZE; }
ReturnValue_t LogSubscription::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-02-10 18:39:37 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::LOG_SUBSCRIPTION);
2022-02-10 18:39:37 +01:00
offset = 2;
result = getParam(arcseckeys::LEVEL1, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::MODULE1, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LEVEL2, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::MODULE2, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint8(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2022-02-10 18:39:37 +01:00
}
DebugCamera::DebugCamera() : ArcsecJsonParamBase(arcseckeys::DEBUG_CAMERA) {}
size_t DebugCamera::getSize() { return COMMAND_SIZE; }
ReturnValue_t DebugCamera::createCommand(uint8_t* buffer) {
2022-08-24 17:27:47 +02:00
ReturnValue_t result = returnvalue::OK;
2022-02-10 18:39:37 +01:00
uint8_t offset = 0;
std::string param;
2022-02-14 11:28:15 +01:00
addSetParamHeader(buffer, startracker::ID::DEBUG_CAMERA);
2022-02-10 18:39:37 +01:00
offset = 2;
result = getParam(arcseckeys::TIMING, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint32(param, buffer + offset);
offset += sizeof(uint32_t);
result = getParam(arcseckeys::TEST, param);
2022-08-24 17:27:47 +02:00
if (result != returnvalue::OK) {
2022-02-10 18:39:37 +01:00
return result;
}
adduint32(param, buffer + offset);
2022-08-24 17:27:47 +02:00
return returnvalue::OK;
2022-02-10 18:39:37 +01:00
}