Skip to content
Snippets Groups Projects
Commit 0d1fb7d6 authored by Grigoris Pavlakis's avatar Grigoris Pavlakis
Browse files

Fix formatting

parent c3d8dfec
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
#define ECSS_SERVICES_PARAMETERSERVICE_HPP
#include "Service.hpp"
#define CONFIGLENGTH 5
/**
......@@ -40,10 +41,12 @@ class ParameterService : public Service {
Parameter paramsList[CONFIGLENGTH]; // CONFIGLENGTH is just a dummy number for now, this should be statically set
public:
ParameterService();
Message reportParameter(Message paramId);
void setParamData(Message newParamValues);
public:
ParameterService();
Message reportParameter(Message paramId);
void setParamData(Message newParamValues);
};
......
#include "Services/ParameterService.hpp"
#define DEMOMODE
#ifdef DEMOMODE
#include <ctime>
#endif
ParameterService::ParameterService() {
......@@ -23,10 +26,10 @@ ParameterService::ParameterService() {
// Test code, setting up one of the parameter fields
time_t currTime = time(nullptr);
struct tm* today = localtime(&currTime);
struct tm *today = localtime(&currTime);
paramsList[2].paramId = 341; // random parameter ID
paramsList[2].settingData = today -> tm_min; // the minute of the current hour
paramsList[2].settingData = today->tm_min; // the minute of the current hour
paramsList[2].ptc = 3; // unsigned int
paramsList[2].pfc = 14; // 32 bits
#endif
......@@ -47,7 +50,8 @@ Message ParameterService::reportParameter(Message paramId) {
Message reqParam(20, 2, Message::TM, 1); // empty TM[20, 2] parameter report message
uint16_t reqParamId = paramId.readUint16(); // parameter ID must be accessed only once
if (paramId.packetType == Message::TC && paramId.serviceType == 20 && paramId.messageType == 1) {
if (paramId.packetType == Message::TC && paramId.serviceType == 20 &&
paramId.messageType == 1) {
for (int i = 0; i < CONFIGLENGTH; i++) {
......
......@@ -17,7 +17,8 @@ int main() {
char string[6];
packet.readString(string, 5);
std::cout << "Word: " << string << " " << packet.readBits(15) << packet.readBits(1) << std::endl;
std::cout << "Word: " << string << " " << packet.readBits(15) << packet.readBits(1)
<< std::endl;
std::cout << packet.readFloat() << " " << std::dec << packet.readSint32() << std::endl;
// ST[17] test
......@@ -34,11 +35,10 @@ int main() {
sentPacket.appendUint16(341); //the packet sent contains the ID of the desired parameter
Message returnedPacket = paramService.reportParameter(sentPacket);
uint16_t id = returnedPacket.readUint16();
uint32_t val = returnedPacket.readUint32();
std::cout << "Parameter ID: " << std::dec << returnedPacket.readUint16() << std::endl
<< "Parameter value: " << std::dec << returnedPacket.readUint32() << std::endl;
std::cout << "Parameter ID: " << std::dec << id << std::endl; //set
std::cout << "Parameter value: " << std::dec << val << std::endl;
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment