This repository has been archived on 2025-06-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
compLIB/server_v2/include/communication/MessageBuilder.hpp
2022-05-22 02:30:07 +02:00

29 lines
1,000 B
C++

#ifndef COMPLIB_SERVER_MESSAGEBUILDER_HPP
#define COMPLIB_SERVER_MESSAGEBUILDER_HPP
#include "CompLib.pb.h"
#include "include/Robot.hpp"
class MessageBuilder {
public:
static CompLib::Header *header(const std::string &message_type);
static CompLib::Status *status(bool successful, const std::string &error_message);
static CompLib::GenericResponse *generic_response(bool successful, const std::string &error_message);
static CompLib::Status *default_successful_status();
static CompLib::GenericResponse *default_successful_generic_response();
static CompLib::EncoderReadPositionsResponse *encoder_read_positions_response(std::array<int32_t, ROBOT_MOTOR_COUNT> positions);
static CompLib::EncoderReadVelocitiesResponse *encoder_read_velocities_response(std::array<double, ROBOT_MOTOR_COUNT> velocities);
static CompLib::IRSensorsReadAllResponse *ir_sensors_read_all_response(std::array<uint16_t, ROBOT_IR_SENSOR_COUNT> data);
};
#endif //COMPLIB_SERVER_MESSAGEBUILDER_HPP