This commit is contained in:
TraYali 2024-03-29 21:40:50 +01:00
parent 8eb18c12d2
commit fd6476cd6e
10 changed files with 258 additions and 4 deletions

View file

@ -0,0 +1,23 @@
#include <stdint.h>
#include <string>
#include <sstream>
#include "sunspecParameters.h"
SunspecParameterManufacturer::SunspecParameterManufacturer() : SunspecParameterString32("manufacturer", 4, 16) {
this->valueType = string32;
}
void SunspecParameterManufacturer::setValueFromRegisters(uint16_t *registers, int addressOffset) {
std::string readValue;
for(int i{0}; i<this->registerSize; i++) {
std::stringstream readValueStringStream;
readValueStringStream << (registers[addressOffset + this->registerAddressOffset + i] >> 8) << " ";
readValueStringStream << (registers[addressOffset + this->registerAddressOffset + i] & 0x00FF) << " ";
readValue.append(readValueStringStream.str().c_str());
}
this->value = readValue;
}