Use references instead of pointers whenver possible
This commit is contained in:
parent
8fb43fedf8
commit
e95afbf2cc
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class DatastoreClass {
|
class DatastoreClass {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
// Sum of yield total of all enabled inverters, a inverter which is just disabled at night is also included
|
// Sum of yield total of all enabled inverters, a inverter which is just disabled at night is also included
|
||||||
float getTotalAcYieldTotalEnabled();
|
float getTotalAcYieldTotalEnabled();
|
||||||
|
|||||||
@ -17,7 +17,7 @@ public:
|
|||||||
DisplayGraphicClass();
|
DisplayGraphicClass();
|
||||||
~DisplayGraphicClass();
|
~DisplayGraphicClass();
|
||||||
|
|
||||||
void init(Scheduler* scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset);
|
void init(Scheduler& scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset);
|
||||||
void setContrast(const uint8_t contrast);
|
void setContrast(const uint8_t contrast);
|
||||||
void setStatus(const bool turnOn);
|
void setStatus(const bool turnOn);
|
||||||
void setOrientation(const uint8_t rotation = DISPLAY_ROTATION);
|
void setOrientation(const uint8_t rotation = DISPLAY_ROTATION);
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
class InverterSettingsClass {
|
class InverterSettingsClass {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void settingsLoop();
|
void settingsLoop();
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
class LedSingleClass {
|
class LedSingleClass {
|
||||||
public:
|
public:
|
||||||
LedSingleClass();
|
LedSingleClass();
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
void turnAllOff();
|
void turnAllOff();
|
||||||
void turnAllOn();
|
void turnAllOn();
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
class MessageOutputClass : public Print {
|
class MessageOutputClass : public Print {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
size_t write(uint8_t c) override;
|
size_t write(uint8_t c) override;
|
||||||
size_t write(const uint8_t* buffer, size_t size) override;
|
size_t write(const uint8_t* buffer, size_t size) override;
|
||||||
void register_ws_output(AsyncWebSocket* output);
|
void register_ws_output(AsyncWebSocket* output);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class MqttHandleDtuClass {
|
class MqttHandleDtuClass {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
|
|||||||
@ -51,7 +51,7 @@ const byteAssign_fieldDeviceClass_t deviceFieldAssignment[] = {
|
|||||||
|
|
||||||
class MqttHandleHassClass {
|
class MqttHandleHassClass {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
void publishConfig();
|
void publishConfig();
|
||||||
void forceUpdate();
|
void forceUpdate();
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
class MqttHandleInverterClass {
|
class MqttHandleInverterClass {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
static String getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
static String getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class MqttHandleInverterTotalClass {
|
class MqttHandleInverterTotalClass {
|
||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
|
|||||||
@ -39,7 +39,7 @@ typedef struct NetworkEventCbList {
|
|||||||
class NetworkSettingsClass {
|
class NetworkSettingsClass {
|
||||||
public:
|
public:
|
||||||
NetworkSettingsClass();
|
NetworkSettingsClass();
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
void applyConfig();
|
void applyConfig();
|
||||||
void enableAdminMode();
|
void enableAdminMode();
|
||||||
String getApName() const;
|
String getApName() const;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
class SunPositionClass {
|
class SunPositionClass {
|
||||||
public:
|
public:
|
||||||
SunPositionClass();
|
SunPositionClass();
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
bool isDayPeriod() const;
|
bool isDayPeriod() const;
|
||||||
bool isSunsetAvailable() const;
|
bool isSunsetAvailable() const;
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
class WebApiClass {
|
class WebApiClass {
|
||||||
public:
|
public:
|
||||||
WebApiClass();
|
WebApiClass();
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler& scheduler);
|
||||||
|
|
||||||
static bool checkCredentials(AsyncWebServerRequest* request);
|
static bool checkCredentials(AsyncWebServerRequest* request);
|
||||||
static bool checkCredentialsReadonly(AsyncWebServerRequest* request);
|
static bool checkCredentialsReadonly(AsyncWebServerRequest* request);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiConfigClass {
|
class WebApiConfigClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiDeviceClass {
|
class WebApiDeviceClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiDevInfoClass {
|
class WebApiDevInfoClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiDtuClass {
|
class WebApiDtuClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiEventlogClass {
|
class WebApiEventlogClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiFirmwareClass {
|
class WebApiFirmwareClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiGridProfileClass {
|
class WebApiGridProfileClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiInverterClass {
|
class WebApiInverterClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiLimitClass {
|
class WebApiLimitClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiMaintenanceClass {
|
class WebApiMaintenanceClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
class WebApiMqttClass {
|
class WebApiMqttClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiNetworkClass {
|
class WebApiNetworkClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiNtpClass {
|
class WebApiNtpClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiPowerClass {
|
class WebApiPowerClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
class WebApiPrometheusClass {
|
class WebApiPrometheusClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiSecurityClass {
|
class WebApiSecurityClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiSysstatusClass {
|
class WebApiSysstatusClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class WebApiWebappClass {
|
class WebApiWebappClass {
|
||||||
public:
|
public:
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
class WebApiWsConsoleClass {
|
class WebApiWsConsoleClass {
|
||||||
public:
|
public:
|
||||||
WebApiWsConsoleClass();
|
WebApiWsConsoleClass();
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
class WebApiWsLiveClass {
|
class WebApiWsLiveClass {
|
||||||
public:
|
public:
|
||||||
WebApiWsLiveClass();
|
WebApiWsLiveClass();
|
||||||
void init(AsyncWebServer* server);
|
void init(AsyncWebServer& server);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -198,9 +198,9 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterBySerial(const uint6
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fragment_t* fragment)
|
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fragment_t& fragment)
|
||||||
{
|
{
|
||||||
if (fragment->len <= 4) {
|
if (fragment.len <= 4) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,10 +210,10 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fra
|
|||||||
serial_u p;
|
serial_u p;
|
||||||
p.u64 = inv->serial();
|
p.u64 = inv->serial();
|
||||||
|
|
||||||
if ((p.b[3] == fragment->fragment[1])
|
if ((p.b[3] == fragment.fragment[1])
|
||||||
&& (p.b[2] == fragment->fragment[2])
|
&& (p.b[2] == fragment.fragment[2])
|
||||||
&& (p.b[1] == fragment->fragment[3])
|
&& (p.b[1] == fragment.fragment[3])
|
||||||
&& (p.b[0] == fragment->fragment[4])) {
|
&& (p.b[0] == fragment.fragment[4])) {
|
||||||
|
|
||||||
return inv;
|
return inv;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public:
|
|||||||
std::shared_ptr<InverterAbstract> addInverter(const char* name, const uint64_t serial);
|
std::shared_ptr<InverterAbstract> addInverter(const char* name, const uint64_t serial);
|
||||||
std::shared_ptr<InverterAbstract> getInverterByPos(const uint8_t pos);
|
std::shared_ptr<InverterAbstract> getInverterByPos(const uint8_t pos);
|
||||||
std::shared_ptr<InverterAbstract> getInverterBySerial(const uint64_t serial);
|
std::shared_ptr<InverterAbstract> getInverterBySerial(const uint64_t serial);
|
||||||
std::shared_ptr<InverterAbstract> getInverterByFragment(const fragment_t* fragment);
|
std::shared_ptr<InverterAbstract> getInverterByFragment(const fragment_t& fragment);
|
||||||
void removeInverterBySerial(const uint64_t serial);
|
void removeInverterBySerial(const uint64_t serial);
|
||||||
size_t getNumInverters() const;
|
size_t getNumInverters() const;
|
||||||
|
|
||||||
|
|||||||
@ -28,10 +28,10 @@ serial_u HoymilesRadio::convertSerialToRadioId(const serial_u serial)
|
|||||||
return radioId;
|
return radioId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HoymilesRadio::checkFragmentCrc(const fragment_t* fragment) const
|
bool HoymilesRadio::checkFragmentCrc(const fragment_t& fragment) const
|
||||||
{
|
{
|
||||||
const uint8_t crc = crc8(fragment->fragment, fragment->len - 1);
|
const uint8_t crc = crc8(fragment.fragment, fragment.len - 1);
|
||||||
return (crc == fragment->fragment[fragment->len - 1]);
|
return (crc == fragment.fragment[fragment.len - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::sendRetransmitPacket(const uint8_t fragment_id)
|
void HoymilesRadio::sendRetransmitPacket(const uint8_t fragment_id)
|
||||||
@ -41,14 +41,14 @@ void HoymilesRadio::sendRetransmitPacket(const uint8_t fragment_id)
|
|||||||
CommandAbstract* requestCmd = cmd->getRequestFrameCommand(fragment_id);
|
CommandAbstract* requestCmd = cmd->getRequestFrameCommand(fragment_id);
|
||||||
|
|
||||||
if (requestCmd != nullptr) {
|
if (requestCmd != nullptr) {
|
||||||
sendEsbPacket(requestCmd);
|
sendEsbPacket(*requestCmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::sendLastPacketAgain()
|
void HoymilesRadio::sendLastPacketAgain()
|
||||||
{
|
{
|
||||||
CommandAbstract* cmd = _commandQueue.front().get();
|
CommandAbstract* cmd = _commandQueue.front().get();
|
||||||
sendEsbPacket(cmd);
|
sendEsbPacket(*cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::handleReceivedPackage()
|
void HoymilesRadio::handleReceivedPackage()
|
||||||
@ -59,7 +59,7 @@ void HoymilesRadio::handleReceivedPackage()
|
|||||||
|
|
||||||
if (nullptr != inv) {
|
if (nullptr != inv) {
|
||||||
CommandAbstract* cmd = _commandQueue.front().get();
|
CommandAbstract* cmd = _commandQueue.front().get();
|
||||||
uint8_t verifyResult = inv->verifyAllFragments(cmd);
|
uint8_t verifyResult = inv->verifyAllFragments(*cmd);
|
||||||
if (verifyResult == FRAGMENT_ALL_MISSING_RESEND) {
|
if (verifyResult == FRAGMENT_ALL_MISSING_RESEND) {
|
||||||
Hoymiles.getMessageOutput()->println("Nothing received, resend whole request");
|
Hoymiles.getMessageOutput()->println("Nothing received, resend whole request");
|
||||||
sendLastPacketAgain();
|
sendLastPacketAgain();
|
||||||
@ -105,7 +105,7 @@ void HoymilesRadio::handleReceivedPackage()
|
|||||||
auto inv = Hoymiles.getInverterBySerial(cmd->getTargetAddress());
|
auto inv = Hoymiles.getInverterBySerial(cmd->getTargetAddress());
|
||||||
if (nullptr != inv) {
|
if (nullptr != inv) {
|
||||||
inv->clearRxFragmentBuffer();
|
inv->clearRxFragmentBuffer();
|
||||||
sendEsbPacket(cmd);
|
sendEsbPacket(*cmd);
|
||||||
} else {
|
} else {
|
||||||
Hoymiles.getMessageOutput()->println("TX: Invalid inverter found");
|
Hoymiles.getMessageOutput()->println("TX: Invalid inverter found");
|
||||||
_commandQueue.pop();
|
_commandQueue.pop();
|
||||||
|
|||||||
@ -31,8 +31,8 @@ protected:
|
|||||||
static serial_u convertSerialToRadioId(const serial_u serial);
|
static serial_u convertSerialToRadioId(const serial_u serial);
|
||||||
static void dumpBuf(const uint8_t buf[], const uint8_t len, const bool appendNewline = true);
|
static void dumpBuf(const uint8_t buf[], const uint8_t len, const bool appendNewline = true);
|
||||||
|
|
||||||
bool checkFragmentCrc(const fragment_t* fragment) const;
|
bool checkFragmentCrc(const fragment_t& fragment) const;
|
||||||
virtual void sendEsbPacket(CommandAbstract* cmd) = 0;
|
virtual void sendEsbPacket(CommandAbstract& cmd) = 0;
|
||||||
void sendRetransmitPacket(const uint8_t fragment_id);
|
void sendRetransmitPacket(const uint8_t fragment_id);
|
||||||
void sendLastPacketAgain();
|
void sendLastPacketAgain();
|
||||||
void handleReceivedPackage();
|
void handleReceivedPackage();
|
||||||
|
|||||||
@ -122,7 +122,7 @@ void HoymilesRadio_CMT::loop()
|
|||||||
// Perform package parsing only if no packages are received
|
// Perform package parsing only if no packages are received
|
||||||
if (!_rxBuffer.empty()) {
|
if (!_rxBuffer.empty()) {
|
||||||
fragment_t f = _rxBuffer.back();
|
fragment_t f = _rxBuffer.back();
|
||||||
if (checkFragmentCrc(&f)) {
|
if (checkFragmentCrc(f)) {
|
||||||
|
|
||||||
const serial_u dtuId = convertSerialToRadioId(_dtuSerial);
|
const serial_u dtuId = convertSerialToRadioId(_dtuSerial);
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ void HoymilesRadio_CMT::loop()
|
|||||||
// Has to be done manually here.
|
// Has to be done manually here.
|
||||||
if (memcmp(&f.fragment[5], &dtuId.b[1], 4) == 0) {
|
if (memcmp(&f.fragment[5], &dtuId.b[1], 4) == 0) {
|
||||||
|
|
||||||
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(&f);
|
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(f);
|
||||||
|
|
||||||
if (nullptr != inv) {
|
if (nullptr != inv) {
|
||||||
// Save packet in inverter rx buffer
|
// Save packet in inverter rx buffer
|
||||||
@ -211,27 +211,27 @@ void ARDUINO_ISR_ATTR HoymilesRadio_CMT::handleInt2()
|
|||||||
_packetReceived = true;
|
_packetReceived = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_CMT::sendEsbPacket(CommandAbstract* cmd)
|
void HoymilesRadio_CMT::sendEsbPacket(CommandAbstract& cmd)
|
||||||
{
|
{
|
||||||
cmd->incrementSendCount();
|
cmd.incrementSendCount();
|
||||||
|
|
||||||
cmd->setRouterAddress(DtuSerial().u64);
|
cmd.setRouterAddress(DtuSerial().u64);
|
||||||
|
|
||||||
_radio->stopListening();
|
_radio->stopListening();
|
||||||
|
|
||||||
if (cmd->getDataPayload()[0] == 0x56) { // @todo(tbnobody) Bad hack to identify ChannelChange Command
|
if (cmd.getDataPayload()[0] == 0x56) { // @todo(tbnobody) Bad hack to identify ChannelChange Command
|
||||||
cmtSwitchDtuFreq(HOY_BOOT_FREQ / 1000);
|
cmtSwitchDtuFreq(HOY_BOOT_FREQ / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
Hoymiles.getMessageOutput()->printf("TX %s %.2f MHz --> ",
|
Hoymiles.getMessageOutput()->printf("TX %s %.2f MHz --> ",
|
||||||
cmd->getCommandName().c_str(), getFrequencyFromChannel(_radio->getChannel()));
|
cmd.getCommandName().c_str(), getFrequencyFromChannel(_radio->getChannel()));
|
||||||
cmd->dumpDataPayload(Hoymiles.getMessageOutput());
|
cmd.dumpDataPayload(Hoymiles.getMessageOutput());
|
||||||
|
|
||||||
if (!_radio->write(cmd->getDataPayload(), cmd->getDataSize())) {
|
if (!_radio->write(cmd.getDataPayload(), cmd.getDataSize())) {
|
||||||
Hoymiles.getMessageOutput()->println("TX SPI Timeout");
|
Hoymiles.getMessageOutput()->println("TX SPI Timeout");
|
||||||
}
|
}
|
||||||
cmtSwitchDtuFreq(_inverterTargetFrequency);
|
cmtSwitchDtuFreq(_inverterTargetFrequency);
|
||||||
_radio->startListening();
|
_radio->startListening();
|
||||||
_busyFlag = true;
|
_busyFlag = true;
|
||||||
_rxTimeout.set(cmd->getTimeout());
|
_rxTimeout.set(cmd.getTimeout());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ private:
|
|||||||
void ARDUINO_ISR_ATTR handleInt1();
|
void ARDUINO_ISR_ATTR handleInt1();
|
||||||
void ARDUINO_ISR_ATTR handleInt2();
|
void ARDUINO_ISR_ATTR handleInt2();
|
||||||
|
|
||||||
void sendEsbPacket(CommandAbstract* cmd);
|
void sendEsbPacket(CommandAbstract& cmd);
|
||||||
|
|
||||||
std::unique_ptr<CMT2300A> _radio;
|
std::unique_ptr<CMT2300A> _radio;
|
||||||
|
|
||||||
|
|||||||
@ -71,8 +71,8 @@ void HoymilesRadio_NRF::loop()
|
|||||||
// Perform package parsing only if no packages are received
|
// Perform package parsing only if no packages are received
|
||||||
if (!_rxBuffer.empty()) {
|
if (!_rxBuffer.empty()) {
|
||||||
fragment_t f = _rxBuffer.back();
|
fragment_t f = _rxBuffer.back();
|
||||||
if (checkFragmentCrc(&f)) {
|
if (checkFragmentCrc(f)) {
|
||||||
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(&f);
|
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(f);
|
||||||
|
|
||||||
if (nullptr != inv) {
|
if (nullptr != inv) {
|
||||||
// Save packet in inverter rx buffer
|
// Save packet in inverter rx buffer
|
||||||
@ -169,29 +169,29 @@ void HoymilesRadio_NRF::switchRxCh()
|
|||||||
_radio->startListening();
|
_radio->startListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_NRF::sendEsbPacket(CommandAbstract* cmd)
|
void HoymilesRadio_NRF::sendEsbPacket(CommandAbstract& cmd)
|
||||||
{
|
{
|
||||||
cmd->incrementSendCount();
|
cmd.incrementSendCount();
|
||||||
|
|
||||||
cmd->setRouterAddress(DtuSerial().u64);
|
cmd.setRouterAddress(DtuSerial().u64);
|
||||||
|
|
||||||
_radio->stopListening();
|
_radio->stopListening();
|
||||||
_radio->setChannel(getTxNxtChannel());
|
_radio->setChannel(getTxNxtChannel());
|
||||||
|
|
||||||
serial_u s;
|
serial_u s;
|
||||||
s.u64 = cmd->getTargetAddress();
|
s.u64 = cmd.getTargetAddress();
|
||||||
openWritingPipe(s);
|
openWritingPipe(s);
|
||||||
_radio->setRetries(3, 15);
|
_radio->setRetries(3, 15);
|
||||||
|
|
||||||
Hoymiles.getMessageOutput()->printf("TX %s Channel: %d --> ",
|
Hoymiles.getMessageOutput()->printf("TX %s Channel: %d --> ",
|
||||||
cmd->getCommandName().c_str(), _radio->getChannel());
|
cmd.getCommandName().c_str(), _radio->getChannel());
|
||||||
cmd->dumpDataPayload(Hoymiles.getMessageOutput());
|
cmd.dumpDataPayload(Hoymiles.getMessageOutput());
|
||||||
_radio->write(cmd->getDataPayload(), cmd->getDataSize());
|
_radio->write(cmd.getDataPayload(), cmd.getDataSize());
|
||||||
|
|
||||||
_radio->setRetries(0, 0);
|
_radio->setRetries(0, 0);
|
||||||
openReadingPipe();
|
openReadingPipe();
|
||||||
_radio->setChannel(getRxNxtChannel());
|
_radio->setChannel(getRxNxtChannel());
|
||||||
_radio->startListening();
|
_radio->startListening();
|
||||||
_busyFlag = true;
|
_busyFlag = true;
|
||||||
_rxTimeout.set(cmd->getTimeout());
|
_rxTimeout.set(cmd.getTimeout());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ private:
|
|||||||
void openReadingPipe();
|
void openReadingPipe();
|
||||||
void openWritingPipe(const serial_u serial);
|
void openWritingPipe(const serial_u serial);
|
||||||
|
|
||||||
void sendEsbPacket(CommandAbstract* cmd);
|
void sendEsbPacket(CommandAbstract& cmd);
|
||||||
|
|
||||||
std::unique_ptr<SPIClass> _spiPtr;
|
std::unique_ptr<SPIClass> _spiPtr;
|
||||||
std::unique_ptr<RF24> _radio;
|
std::unique_ptr<RF24> _radio;
|
||||||
|
|||||||
@ -62,24 +62,24 @@ void ActivePowerControlCommand::setActivePowerLimit(const float limit, const Pow
|
|||||||
udpateCRC(CRC_SIZE);
|
udpateCRC(CRC_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActivePowerControlCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool ActivePowerControlCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((getType() == PowerLimitControlType::RelativNonPersistent) || (getType() == PowerLimitControlType::RelativPersistent)) {
|
if ((getType() == PowerLimitControlType::RelativNonPersistent) || (getType() == PowerLimitControlType::RelativPersistent)) {
|
||||||
inverter->SystemConfigPara()->setLimitPercent(getLimit());
|
inverter.SystemConfigPara()->setLimitPercent(getLimit());
|
||||||
} else {
|
} else {
|
||||||
const uint16_t max_power = inverter->DevInfo()->getMaxPower();
|
const uint16_t max_power = inverter.DevInfo()->getMaxPower();
|
||||||
if (max_power > 0) {
|
if (max_power > 0) {
|
||||||
inverter->SystemConfigPara()->setLimitPercent(static_cast<float>(getLimit()) / max_power * 100);
|
inverter.SystemConfigPara()->setLimitPercent(static_cast<float>(getLimit()) / max_power * 100);
|
||||||
} else {
|
} else {
|
||||||
// TODO(tbnobody): Not implemented yet because we only can publish the percentage value
|
// TODO(tbnobody): Not implemented yet because we only can publish the percentage value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inverter->SystemConfigPara()->setLastUpdateCommand(millis());
|
inverter.SystemConfigPara()->setLastUpdateCommand(millis());
|
||||||
inverter->SystemConfigPara()->setLastLimitCommandSuccess(CMD_OK);
|
inverter.SystemConfigPara()->setLastLimitCommandSuccess(CMD_OK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ PowerLimitControlType ActivePowerControlCommand::getType()
|
|||||||
return (PowerLimitControlType)(((uint16_t)_payload[14] << 8) | _payload[15]);
|
return (PowerLimitControlType)(((uint16_t)_payload[14] << 8) | _payload[15]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivePowerControlCommand::gotTimeout(InverterAbstract* inverter)
|
void ActivePowerControlCommand::gotTimeout(InverterAbstract& inverter)
|
||||||
{
|
{
|
||||||
inverter->SystemConfigPara()->setLastLimitCommandSuccess(CMD_NOK);
|
inverter.SystemConfigPara()->setLastLimitCommandSuccess(CMD_NOK);
|
||||||
}
|
}
|
||||||
@ -16,8 +16,8 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract& inverter);
|
||||||
|
|
||||||
void setActivePowerLimit(const float limit, const PowerLimitControlType type = RelativNonPersistent);
|
void setActivePowerLimit(const float limit, const PowerLimitControlType type = RelativNonPersistent);
|
||||||
float getLimit() const;
|
float getLimit() const;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ String AlarmDataCommand::getCommandName() const
|
|||||||
return "AlarmData";
|
return "AlarmData";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlarmDataCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool AlarmDataCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
// Check CRC of whole payload
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
@ -45,19 +45,19 @@ bool AlarmDataCommand::handleResponse(InverterAbstract* inverter, const fragment
|
|||||||
|
|
||||||
// Move all fragments into target buffer
|
// Move all fragments into target buffer
|
||||||
uint8_t offs = 0;
|
uint8_t offs = 0;
|
||||||
inverter->EventLog()->beginAppendFragment();
|
inverter.EventLog()->beginAppendFragment();
|
||||||
inverter->EventLog()->clearBuffer();
|
inverter.EventLog()->clearBuffer();
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
inverter->EventLog()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
inverter.EventLog()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||||
offs += (fragment[i].len);
|
offs += (fragment[i].len);
|
||||||
}
|
}
|
||||||
inverter->EventLog()->endAppendFragment();
|
inverter.EventLog()->endAppendFragment();
|
||||||
inverter->EventLog()->setLastAlarmRequestSuccess(CMD_OK);
|
inverter.EventLog()->setLastAlarmRequestSuccess(CMD_OK);
|
||||||
inverter->EventLog()->setLastUpdate(millis());
|
inverter.EventLog()->setLastUpdate(millis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmDataCommand::gotTimeout(InverterAbstract* inverter)
|
void AlarmDataCommand::gotTimeout(InverterAbstract& inverter)
|
||||||
{
|
{
|
||||||
inverter->EventLog()->setLastAlarmRequestSuccess(CMD_NOK);
|
inverter.EventLog()->setLastAlarmRequestSuccess(CMD_NOK);
|
||||||
}
|
}
|
||||||
@ -9,6 +9,6 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract& inverter);
|
||||||
};
|
};
|
||||||
@ -47,7 +47,7 @@ uint8_t ChannelChangeCommand::getChannel() const
|
|||||||
return _payload[12];
|
return _payload[12];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelChangeCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool ChannelChangeCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ public:
|
|||||||
void setChannel(const uint8_t channel);
|
void setChannel(const uint8_t channel);
|
||||||
uint8_t getChannel() const;
|
uint8_t getChannel() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
|
|
||||||
virtual uint8_t getMaxResendCount();
|
virtual uint8_t getMaxResendCount();
|
||||||
};
|
};
|
||||||
@ -122,7 +122,7 @@ void CommandAbstract::convertSerialToPacketId(uint8_t buffer[], const uint64_t s
|
|||||||
buffer[0] = s.b[3];
|
buffer[0] = s.b[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandAbstract::gotTimeout(InverterAbstract* inverter)
|
void CommandAbstract::gotTimeout(InverterAbstract& inverter)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,8 +38,8 @@ public:
|
|||||||
|
|
||||||
virtual CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
virtual CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id) = 0;
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id) = 0;
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract& inverter);
|
||||||
|
|
||||||
// Sets the amount how often the specific command is resent if all fragments where missing
|
// Sets the amount how often the specific command is resent if all fragments where missing
|
||||||
virtual uint8_t getMaxResendCount() const;
|
virtual uint8_t getMaxResendCount() const;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ void DevControlCommand::udpateCRC(const uint8_t len)
|
|||||||
_payload[10 + len + 1] = (uint8_t)(crc);
|
_payload[10 + len + 1] = (uint8_t)(crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DevControlCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool DevControlCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
if (fragment[i].mainCmd != (_payload[0] | 0x80)) {
|
if (fragment[i].mainCmd != (_payload[0] | 0x80)) {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class DevControlCommand : public CommandAbstract {
|
|||||||
public:
|
public:
|
||||||
explicit DevControlCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
explicit DevControlCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void udpateCRC(const uint8_t len);
|
void udpateCRC(const uint8_t len);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ String DevInfoAllCommand::getCommandName() const
|
|||||||
return "DevInfoAll";
|
return "DevInfoAll";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DevInfoAllCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool DevInfoAllCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
// Check CRC of whole payload
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
@ -43,13 +43,13 @@ bool DevInfoAllCommand::handleResponse(InverterAbstract* inverter, const fragmen
|
|||||||
|
|
||||||
// Move all fragments into target buffer
|
// Move all fragments into target buffer
|
||||||
uint8_t offs = 0;
|
uint8_t offs = 0;
|
||||||
inverter->DevInfo()->beginAppendFragment();
|
inverter.DevInfo()->beginAppendFragment();
|
||||||
inverter->DevInfo()->clearBufferAll();
|
inverter.DevInfo()->clearBufferAll();
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
inverter->DevInfo()->appendFragmentAll(offs, fragment[i].fragment, fragment[i].len);
|
inverter.DevInfo()->appendFragmentAll(offs, fragment[i].fragment, fragment[i].len);
|
||||||
offs += (fragment[i].len);
|
offs += (fragment[i].len);
|
||||||
}
|
}
|
||||||
inverter->DevInfo()->endAppendFragment();
|
inverter.DevInfo()->endAppendFragment();
|
||||||
inverter->DevInfo()->setLastUpdateAll(millis());
|
inverter.DevInfo()->setLastUpdateAll(millis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -9,5 +9,5 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -34,7 +34,7 @@ String DevInfoSimpleCommand::getCommandName() const
|
|||||||
return "DevInfoSimple";
|
return "DevInfoSimple";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool DevInfoSimpleCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
// Check CRC of whole payload
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
@ -43,13 +43,13 @@ bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, const frag
|
|||||||
|
|
||||||
// Move all fragments into target buffer
|
// Move all fragments into target buffer
|
||||||
uint8_t offs = 0;
|
uint8_t offs = 0;
|
||||||
inverter->DevInfo()->beginAppendFragment();
|
inverter.DevInfo()->beginAppendFragment();
|
||||||
inverter->DevInfo()->clearBufferSimple();
|
inverter.DevInfo()->clearBufferSimple();
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
inverter->DevInfo()->appendFragmentSimple(offs, fragment[i].fragment, fragment[i].len);
|
inverter.DevInfo()->appendFragmentSimple(offs, fragment[i].fragment, fragment[i].len);
|
||||||
offs += (fragment[i].len);
|
offs += (fragment[i].len);
|
||||||
}
|
}
|
||||||
inverter->DevInfo()->endAppendFragment();
|
inverter.DevInfo()->endAppendFragment();
|
||||||
inverter->DevInfo()->setLastUpdateSimple(millis());
|
inverter.DevInfo()->setLastUpdateSimple(millis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -9,5 +9,5 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -35,7 +35,7 @@ String GridOnProFilePara::getCommandName() const
|
|||||||
return "GridOnProFilePara";
|
return "GridOnProFilePara";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GridOnProFilePara::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool GridOnProFilePara::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
// Check CRC of whole payload
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
@ -44,13 +44,13 @@ bool GridOnProFilePara::handleResponse(InverterAbstract* inverter, const fragmen
|
|||||||
|
|
||||||
// Move all fragments into target buffer
|
// Move all fragments into target buffer
|
||||||
uint8_t offs = 0;
|
uint8_t offs = 0;
|
||||||
inverter->GridProfile()->beginAppendFragment();
|
inverter.GridProfile()->beginAppendFragment();
|
||||||
inverter->GridProfile()->clearBuffer();
|
inverter.GridProfile()->clearBuffer();
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
inverter->GridProfile()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
inverter.GridProfile()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||||
offs += (fragment[i].len);
|
offs += (fragment[i].len);
|
||||||
}
|
}
|
||||||
inverter->GridProfile()->endAppendFragment();
|
inverter.GridProfile()->endAppendFragment();
|
||||||
inverter->GridProfile()->setLastUpdate(millis());
|
inverter.GridProfile()->setLastUpdate(millis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -9,5 +9,5 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -85,7 +85,7 @@ CommandAbstract* MultiDataCommand::getRequestFrameCommand(const uint8_t frame_no
|
|||||||
return &_cmdRequestFrame;
|
return &_cmdRequestFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiDataCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool MultiDataCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
// All fragments are available --> Check CRC
|
// All fragments are available --> Check CRC
|
||||||
uint16_t crc = 0xffff, crcRcv = 0;
|
uint16_t crc = 0xffff, crcRcv = 0;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public:
|
|||||||
|
|
||||||
CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDataType(const uint8_t data_type);
|
void setDataType(const uint8_t data_type);
|
||||||
|
|||||||
@ -44,20 +44,20 @@ String PowerControlCommand::getCommandName() const
|
|||||||
return "PowerControl";
|
return "PowerControl";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PowerControlCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool PowerControlCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inverter->PowerCommand()->setLastUpdateCommand(millis());
|
inverter.PowerCommand()->setLastUpdateCommand(millis());
|
||||||
inverter->PowerCommand()->setLastPowerCommandSuccess(CMD_OK);
|
inverter.PowerCommand()->setLastPowerCommandSuccess(CMD_OK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerControlCommand::gotTimeout(InverterAbstract* inverter)
|
void PowerControlCommand::gotTimeout(InverterAbstract& inverter)
|
||||||
{
|
{
|
||||||
inverter->PowerCommand()->setLastPowerCommandSuccess(CMD_NOK);
|
inverter.PowerCommand()->setLastPowerCommandSuccess(CMD_NOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerControlCommand::setPowerOn(const bool state)
|
void PowerControlCommand::setPowerOn(const bool state)
|
||||||
|
|||||||
@ -9,8 +9,8 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract& inverter);
|
||||||
|
|
||||||
void setPowerOn(const bool state);
|
void setPowerOn(const bool state);
|
||||||
void setRestart();
|
void setRestart();
|
||||||
|
|||||||
@ -35,7 +35,7 @@ String RealTimeRunDataCommand::getCommandName() const
|
|||||||
return "RealTimeRunData";
|
return "RealTimeRunData";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool RealTimeRunDataCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
// Check CRC of whole payload
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
@ -46,7 +46,7 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, const fr
|
|||||||
// In case of low power in the inverter it occours that some incomplete fragments
|
// In case of low power in the inverter it occours that some incomplete fragments
|
||||||
// with a valid CRC are received.
|
// with a valid CRC are received.
|
||||||
const uint8_t fragmentsSize = getTotalFragmentSize(fragment, max_fragment_id);
|
const uint8_t fragmentsSize = getTotalFragmentSize(fragment, max_fragment_id);
|
||||||
const uint8_t expectedSize = inverter->Statistics()->getExpectedByteCount();
|
const uint8_t expectedSize = inverter.Statistics()->getExpectedByteCount();
|
||||||
if (fragmentsSize < expectedSize) {
|
if (fragmentsSize < expectedSize) {
|
||||||
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d, min expected size: %d\r\n",
|
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d, min expected size: %d\r\n",
|
||||||
getCommandName().c_str(), fragmentsSize, expectedSize);
|
getCommandName().c_str(), fragmentsSize, expectedSize);
|
||||||
@ -56,19 +56,19 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, const fr
|
|||||||
|
|
||||||
// Move all fragments into target buffer
|
// Move all fragments into target buffer
|
||||||
uint8_t offs = 0;
|
uint8_t offs = 0;
|
||||||
inverter->Statistics()->beginAppendFragment();
|
inverter.Statistics()->beginAppendFragment();
|
||||||
inverter->Statistics()->clearBuffer();
|
inverter.Statistics()->clearBuffer();
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
inverter->Statistics()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
inverter.Statistics()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||||
offs += (fragment[i].len);
|
offs += (fragment[i].len);
|
||||||
}
|
}
|
||||||
inverter->Statistics()->endAppendFragment();
|
inverter.Statistics()->endAppendFragment();
|
||||||
inverter->Statistics()->resetRxFailureCount();
|
inverter.Statistics()->resetRxFailureCount();
|
||||||
inverter->Statistics()->setLastUpdate(millis());
|
inverter.Statistics()->setLastUpdate(millis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RealTimeRunDataCommand::gotTimeout(InverterAbstract* inverter)
|
void RealTimeRunDataCommand::gotTimeout(InverterAbstract& inverter)
|
||||||
{
|
{
|
||||||
inverter->Statistics()->incrementRxFailureCount();
|
inverter.Statistics()->incrementRxFailureCount();
|
||||||
}
|
}
|
||||||
@ -9,6 +9,6 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract& inverter);
|
||||||
};
|
};
|
||||||
@ -47,7 +47,7 @@ uint8_t RequestFrameCommand::getFrameNo() const
|
|||||||
return _payload[9] & (~0x80);
|
return _payload[9] & (~0x80);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RequestFrameCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool RequestFrameCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -12,5 +12,5 @@ public:
|
|||||||
void setFrameNo(const uint8_t frame_no);
|
void setFrameNo(const uint8_t frame_no);
|
||||||
uint8_t getFrameNo() const;
|
uint8_t getFrameNo() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -35,7 +35,7 @@ String SystemConfigParaCommand::getCommandName() const
|
|||||||
return "SystemConfigPara";
|
return "SystemConfigPara";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
bool SystemConfigParaCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
// Check CRC of whole payload
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
@ -46,7 +46,7 @@ bool SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, const f
|
|||||||
// In case of low power in the inverter it occours that some incomplete fragments
|
// In case of low power in the inverter it occours that some incomplete fragments
|
||||||
// with a valid CRC are received.
|
// with a valid CRC are received.
|
||||||
const uint8_t fragmentsSize = getTotalFragmentSize(fragment, max_fragment_id);
|
const uint8_t fragmentsSize = getTotalFragmentSize(fragment, max_fragment_id);
|
||||||
const uint8_t expectedSize = inverter->SystemConfigPara()->getExpectedByteCount();
|
const uint8_t expectedSize = inverter.SystemConfigPara()->getExpectedByteCount();
|
||||||
if (fragmentsSize < expectedSize) {
|
if (fragmentsSize < expectedSize) {
|
||||||
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d, min expected size: %d\r\n",
|
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d, min expected size: %d\r\n",
|
||||||
getCommandName().c_str(), fragmentsSize, expectedSize);
|
getCommandName().c_str(), fragmentsSize, expectedSize);
|
||||||
@ -56,19 +56,19 @@ bool SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, const f
|
|||||||
|
|
||||||
// Move all fragments into target buffer
|
// Move all fragments into target buffer
|
||||||
uint8_t offs = 0;
|
uint8_t offs = 0;
|
||||||
inverter->SystemConfigPara()->beginAppendFragment();
|
inverter.SystemConfigPara()->beginAppendFragment();
|
||||||
inverter->SystemConfigPara()->clearBuffer();
|
inverter.SystemConfigPara()->clearBuffer();
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
inverter->SystemConfigPara()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
inverter.SystemConfigPara()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||||
offs += (fragment[i].len);
|
offs += (fragment[i].len);
|
||||||
}
|
}
|
||||||
inverter->SystemConfigPara()->endAppendFragment();
|
inverter.SystemConfigPara()->endAppendFragment();
|
||||||
inverter->SystemConfigPara()->setLastUpdateRequest(millis());
|
inverter.SystemConfigPara()->setLastUpdateRequest(millis());
|
||||||
inverter->SystemConfigPara()->setLastLimitRequestSuccess(CMD_OK);
|
inverter.SystemConfigPara()->setLastLimitRequestSuccess(CMD_OK);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaCommand::gotTimeout(InverterAbstract* inverter)
|
void SystemConfigParaCommand::gotTimeout(InverterAbstract& inverter)
|
||||||
{
|
{
|
||||||
inverter->SystemConfigPara()->setLastLimitRequestSuccess(CMD_NOK);
|
inverter.SystemConfigPara()->setLastLimitRequestSuccess(CMD_NOK);
|
||||||
}
|
}
|
||||||
@ -9,6 +9,6 @@ public:
|
|||||||
|
|
||||||
virtual String getCommandName() const;
|
virtual String getCommandName() const;
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract& inverter);
|
||||||
};
|
};
|
||||||
@ -218,15 +218,15 @@ void InverterAbstract::addRxFragment(const uint8_t fragment[], const uint8_t len
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns Zero on Success or the Fragment ID for retransmit or error code
|
// Returns Zero on Success or the Fragment ID for retransmit or error code
|
||||||
uint8_t InverterAbstract::verifyAllFragments(CommandAbstract* cmd)
|
uint8_t InverterAbstract::verifyAllFragments(CommandAbstract& cmd)
|
||||||
{
|
{
|
||||||
// All missing
|
// All missing
|
||||||
if (_rxFragmentLastPacketId == 0) {
|
if (_rxFragmentLastPacketId == 0) {
|
||||||
Hoymiles.getMessageOutput()->println("All missing");
|
Hoymiles.getMessageOutput()->println("All missing");
|
||||||
if (cmd->getSendCount() <= cmd->getMaxResendCount()) {
|
if (cmd.getSendCount() <= cmd.getMaxResendCount()) {
|
||||||
return FRAGMENT_ALL_MISSING_RESEND;
|
return FRAGMENT_ALL_MISSING_RESEND;
|
||||||
} else {
|
} else {
|
||||||
cmd->gotTimeout(this);
|
cmd.gotTimeout(*this);
|
||||||
return FRAGMENT_ALL_MISSING_TIMEOUT;
|
return FRAGMENT_ALL_MISSING_TIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,10 +234,10 @@ uint8_t InverterAbstract::verifyAllFragments(CommandAbstract* cmd)
|
|||||||
// Last fragment is missing (the one with 0x80)
|
// Last fragment is missing (the one with 0x80)
|
||||||
if (_rxFragmentMaxPacketId == 0) {
|
if (_rxFragmentMaxPacketId == 0) {
|
||||||
Hoymiles.getMessageOutput()->println("Last missing");
|
Hoymiles.getMessageOutput()->println("Last missing");
|
||||||
if (_rxFragmentRetransmitCnt++ < cmd->getMaxRetransmitCount()) {
|
if (_rxFragmentRetransmitCnt++ < cmd.getMaxRetransmitCount()) {
|
||||||
return _rxFragmentLastPacketId + 1;
|
return _rxFragmentLastPacketId + 1;
|
||||||
} else {
|
} else {
|
||||||
cmd->gotTimeout(this);
|
cmd.gotTimeout(*this);
|
||||||
return FRAGMENT_RETRANSMIT_TIMEOUT;
|
return FRAGMENT_RETRANSMIT_TIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,17 +246,17 @@ uint8_t InverterAbstract::verifyAllFragments(CommandAbstract* cmd)
|
|||||||
for (uint8_t i = 0; i < _rxFragmentMaxPacketId - 1; i++) {
|
for (uint8_t i = 0; i < _rxFragmentMaxPacketId - 1; i++) {
|
||||||
if (!_rxFragmentBuffer[i].wasReceived) {
|
if (!_rxFragmentBuffer[i].wasReceived) {
|
||||||
Hoymiles.getMessageOutput()->println("Middle missing");
|
Hoymiles.getMessageOutput()->println("Middle missing");
|
||||||
if (_rxFragmentRetransmitCnt++ < cmd->getMaxRetransmitCount()) {
|
if (_rxFragmentRetransmitCnt++ < cmd.getMaxRetransmitCount()) {
|
||||||
return i + 1;
|
return i + 1;
|
||||||
} else {
|
} else {
|
||||||
cmd->gotTimeout(this);
|
cmd.gotTimeout(*this);
|
||||||
return FRAGMENT_RETRANSMIT_TIMEOUT;
|
return FRAGMENT_RETRANSMIT_TIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmd->handleResponse(this, _rxFragmentBuffer, _rxFragmentMaxPacketId)) {
|
if (!cmd.handleResponse(*this, _rxFragmentBuffer, _rxFragmentMaxPacketId)) {
|
||||||
cmd->gotTimeout(this);
|
cmd.gotTimeout(*this);
|
||||||
return FRAGMENT_HANDLE_ERROR;
|
return FRAGMENT_HANDLE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
void clearRxFragmentBuffer();
|
void clearRxFragmentBuffer();
|
||||||
void addRxFragment(const uint8_t fragment[], const uint8_t len);
|
void addRxFragment(const uint8_t fragment[], const uint8_t len);
|
||||||
uint8_t verifyAllFragments(CommandAbstract* cmd);
|
uint8_t verifyAllFragments(CommandAbstract& cmd);
|
||||||
|
|
||||||
virtual bool sendStatsRequest() = 0;
|
virtual bool sendStatsRequest() = 0;
|
||||||
virtual bool sendAlarmLogRequest(const bool force = false) = 0;
|
virtual bool sendAlarmLogRequest(const bool force = false) = 0;
|
||||||
|
|||||||
@ -214,7 +214,7 @@ void AlarmLogParser::setMessageType(const AlarmMessageType_t type)
|
|||||||
_messageType = type;
|
_messageType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmLogParser::getLogEntry(const uint8_t entryId, AlarmLogEntry_t* entry, const AlarmMessageLocale_t locale)
|
void AlarmLogParser::getLogEntry(const uint8_t entryId, AlarmLogEntry_t& entry, const AlarmMessageLocale_t locale)
|
||||||
{
|
{
|
||||||
const uint8_t entryStartOffset = 2 + entryId * ALARM_LOG_ENTRY_SIZE;
|
const uint8_t entryStartOffset = 2 + entryId * ALARM_LOG_ENTRY_SIZE;
|
||||||
|
|
||||||
@ -233,34 +233,34 @@ void AlarmLogParser::getLogEntry(const uint8_t entryId, AlarmLogEntry_t* entry,
|
|||||||
endTimeOffset = 12 * 60 * 60;
|
endTimeOffset = 12 * 60 * 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->MessageId = _payloadAlarmLog[entryStartOffset + 1];
|
entry.MessageId = _payloadAlarmLog[entryStartOffset + 1];
|
||||||
entry->StartTime = (((uint16_t)_payloadAlarmLog[entryStartOffset + 4] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 5])) + startTimeOffset + timezoneOffset;
|
entry.StartTime = (((uint16_t)_payloadAlarmLog[entryStartOffset + 4] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 5])) + startTimeOffset + timezoneOffset;
|
||||||
entry->EndTime = ((uint16_t)_payloadAlarmLog[entryStartOffset + 6] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 7]);
|
entry.EndTime = ((uint16_t)_payloadAlarmLog[entryStartOffset + 6] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 7]);
|
||||||
|
|
||||||
HOY_SEMAPHORE_GIVE();
|
HOY_SEMAPHORE_GIVE();
|
||||||
|
|
||||||
if (entry->EndTime > 0) {
|
if (entry.EndTime > 0) {
|
||||||
entry->EndTime += (endTimeOffset + timezoneOffset);
|
entry.EndTime += (endTimeOffset + timezoneOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (locale) {
|
switch (locale) {
|
||||||
case AlarmMessageLocale_t::DE:
|
case AlarmMessageLocale_t::DE:
|
||||||
entry->Message = "Unbekannt";
|
entry.Message = "Unbekannt";
|
||||||
break;
|
break;
|
||||||
case AlarmMessageLocale_t::FR:
|
case AlarmMessageLocale_t::FR:
|
||||||
entry->Message = "Inconnu";
|
entry.Message = "Inconnu";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
entry->Message = "Unknown";
|
entry.Message = "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& msg : _alarmMessages) {
|
for (auto& msg : _alarmMessages) {
|
||||||
if (msg.MessageId == entry->MessageId) {
|
if (msg.MessageId == entry.MessageId) {
|
||||||
if (msg.InverterType == _messageType) {
|
if (msg.InverterType == _messageType) {
|
||||||
entry->Message = getLocaleMessage(&msg, locale);
|
entry.Message = getLocaleMessage(&msg, locale);
|
||||||
break;
|
break;
|
||||||
} else if (msg.InverterType == AlarmMessageType_t::ALL) {
|
} else if (msg.InverterType == AlarmMessageType_t::ALL) {
|
||||||
entry->Message = getLocaleMessage(&msg, locale);
|
entry.Message = getLocaleMessage(&msg, locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public:
|
|||||||
void appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
void appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||||
|
|
||||||
uint8_t getEntryCount() const;
|
uint8_t getEntryCount() const;
|
||||||
void getLogEntry(const uint8_t entryId, AlarmLogEntry_t* entry, const AlarmMessageLocale_t locale = AlarmMessageLocale_t::EN);
|
void getLogEntry(const uint8_t entryId, AlarmLogEntry_t& entry, const AlarmMessageLocale_t locale = AlarmMessageLocale_t::EN);
|
||||||
|
|
||||||
void setLastAlarmRequestSuccess(const LastCommandSuccess status);
|
void setLastAlarmRequestSuccess(const LastCommandSuccess status);
|
||||||
LastCommandSuccess getLastAlarmRequestSuccess() const;
|
LastCommandSuccess getLastAlarmRequestSuccess() const;
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
DatastoreClass Datastore;
|
DatastoreClass Datastore;
|
||||||
|
|
||||||
void DatastoreClass::init(Scheduler* scheduler)
|
void DatastoreClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&DatastoreClass::loop, this));
|
_loopTask.setCallback(std::bind(&DatastoreClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.setInterval(1 * TASK_SECOND);
|
_loopTask.setInterval(1 * TASK_SECOND);
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Thomas Basler and others
|
||||||
|
*/
|
||||||
#include "Display_Graphic.h"
|
#include "Display_Graphic.h"
|
||||||
#include "Datastore.h"
|
#include "Datastore.h"
|
||||||
#include <NetworkSettings.h>
|
#include <NetworkSettings.h>
|
||||||
@ -39,7 +42,7 @@ DisplayGraphicClass::~DisplayGraphicClass()
|
|||||||
delete _display;
|
delete _display;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::init(Scheduler* scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset)
|
void DisplayGraphicClass::init(Scheduler& scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset)
|
||||||
{
|
{
|
||||||
_display_type = type;
|
_display_type = type;
|
||||||
if (_display_type > DisplayType_t::None) {
|
if (_display_type > DisplayType_t::None) {
|
||||||
@ -50,7 +53,7 @@ void DisplayGraphicClass::init(Scheduler* scheduler, const DisplayType_t type, c
|
|||||||
setStatus(true);
|
setStatus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&DisplayGraphicClass::loop, this));
|
_loopTask.setCallback(std::bind(&DisplayGraphicClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.setInterval(_period);
|
_loopTask.setInterval(_period);
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
InverterSettingsClass InverterSettings;
|
InverterSettingsClass InverterSettings;
|
||||||
|
|
||||||
void InverterSettingsClass::init(Scheduler* scheduler)
|
void InverterSettingsClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
const CONFIG_T& config = Configuration.get();
|
const CONFIG_T& config = Configuration.get();
|
||||||
const PinMapping_t& pin = PinMapping.get();
|
const PinMapping_t& pin = PinMapping.get();
|
||||||
@ -88,12 +88,12 @@ void InverterSettingsClass::init(Scheduler* scheduler)
|
|||||||
MessageOutput.println("Invalid pin config");
|
MessageOutput.println("Invalid pin config");
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler->addTask(_hoyTask);
|
scheduler.addTask(_hoyTask);
|
||||||
_hoyTask.setCallback(std::bind(&InverterSettingsClass::hoyLoop, this));
|
_hoyTask.setCallback(std::bind(&InverterSettingsClass::hoyLoop, this));
|
||||||
_hoyTask.setIterations(TASK_FOREVER);
|
_hoyTask.setIterations(TASK_FOREVER);
|
||||||
_hoyTask.enable();
|
_hoyTask.enable();
|
||||||
|
|
||||||
scheduler->addTask(_settingsTask);
|
scheduler.addTask(_settingsTask);
|
||||||
_settingsTask.setCallback(std::bind(&InverterSettingsClass::settingsLoop, this));
|
_settingsTask.setCallback(std::bind(&InverterSettingsClass::settingsLoop, this));
|
||||||
_settingsTask.setIterations(TASK_FOREVER);
|
_settingsTask.setIterations(TASK_FOREVER);
|
||||||
_settingsTask.setInterval(INVERTER_UPDATE_SETTINGS_INTERVAL);
|
_settingsTask.setInterval(INVERTER_UPDATE_SETTINGS_INTERVAL);
|
||||||
|
|||||||
@ -41,7 +41,7 @@ LedSingleClass::LedSingleClass()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedSingleClass::init(Scheduler* scheduler)
|
void LedSingleClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
bool ledActive = false;
|
bool ledActive = false;
|
||||||
|
|
||||||
@ -61,12 +61,12 @@ void LedSingleClass::init(Scheduler* scheduler)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ledActive) {
|
if (ledActive) {
|
||||||
scheduler->addTask(_outputTask);
|
scheduler.addTask(_outputTask);
|
||||||
_outputTask.setCallback(std::bind(&LedSingleClass::outputLoop, this));
|
_outputTask.setCallback(std::bind(&LedSingleClass::outputLoop, this));
|
||||||
_outputTask.setIterations(TASK_FOREVER);
|
_outputTask.setIterations(TASK_FOREVER);
|
||||||
_outputTask.enable();
|
_outputTask.enable();
|
||||||
|
|
||||||
scheduler->addTask(_setTask);
|
scheduler.addTask(_setTask);
|
||||||
_setTask.setCallback(std::bind(&LedSingleClass::setLoop, this));
|
_setTask.setCallback(std::bind(&LedSingleClass::setLoop, this));
|
||||||
_setTask.setInterval(LEDSINGLE_UPDATE_INTERVAL * TASK_MILLISECOND);
|
_setTask.setInterval(LEDSINGLE_UPDATE_INTERVAL * TASK_MILLISECOND);
|
||||||
_setTask.setIterations(TASK_FOREVER);
|
_setTask.setIterations(TASK_FOREVER);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "MessageOutput.h"
|
#include "MessageOutput.h"
|
||||||
|
|
||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
MessageOutputClass MessageOutput;
|
MessageOutputClass MessageOutput;
|
||||||
|
|
||||||
void MessageOutputClass::init(Scheduler* scheduler)
|
void MessageOutputClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&MessageOutputClass::loop, this));
|
_loopTask.setCallback(std::bind(&MessageOutputClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.enable();
|
_loopTask.enable();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "MqttHandleDtu.h"
|
#include "MqttHandleDtu.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
MqttHandleDtuClass MqttHandleDtu;
|
MqttHandleDtuClass MqttHandleDtu;
|
||||||
|
|
||||||
void MqttHandleDtuClass::init(Scheduler* scheduler)
|
void MqttHandleDtuClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&MqttHandleDtuClass::loop, this));
|
_loopTask.setCallback(std::bind(&MqttHandleDtuClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "MqttHandleHass.h"
|
#include "MqttHandleHass.h"
|
||||||
#include "MqttHandleInverter.h"
|
#include "MqttHandleInverter.h"
|
||||||
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
MqttHandleHassClass MqttHandleHass;
|
MqttHandleHassClass MqttHandleHass;
|
||||||
|
|
||||||
void MqttHandleHassClass::init(Scheduler* scheduler)
|
void MqttHandleHassClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&MqttHandleHassClass::loop, this));
|
_loopTask.setCallback(std::bind(&MqttHandleHassClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.enable();
|
_loopTask.enable();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "MqttHandleInverter.h"
|
#include "MqttHandleInverter.h"
|
||||||
#include "MessageOutput.h"
|
#include "MessageOutput.h"
|
||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
MqttHandleInverterClass MqttHandleInverter;
|
MqttHandleInverterClass MqttHandleInverter;
|
||||||
|
|
||||||
void MqttHandleInverterClass::init(Scheduler* scheduler)
|
void MqttHandleInverterClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
using std::placeholders::_2;
|
using std::placeholders::_2;
|
||||||
@ -35,7 +35,7 @@ void MqttHandleInverterClass::init(Scheduler* scheduler)
|
|||||||
MqttSettings.subscribe(String(topic + "+/cmd/" + TOPIC_SUB_POWER).c_str(), 0, std::bind(&MqttHandleInverterClass::onMqttMessage, this, _1, _2, _3, _4, _5, _6));
|
MqttSettings.subscribe(String(topic + "+/cmd/" + TOPIC_SUB_POWER).c_str(), 0, std::bind(&MqttHandleInverterClass::onMqttMessage, this, _1, _2, _3, _4, _5, _6));
|
||||||
MqttSettings.subscribe(String(topic + "+/cmd/" + TOPIC_SUB_RESTART).c_str(), 0, std::bind(&MqttHandleInverterClass::onMqttMessage, this, _1, _2, _3, _4, _5, _6));
|
MqttSettings.subscribe(String(topic + "+/cmd/" + TOPIC_SUB_RESTART).c_str(), 0, std::bind(&MqttHandleInverterClass::onMqttMessage, this, _1, _2, _3, _4, _5, _6));
|
||||||
|
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&MqttHandleInverterClass::loop, this));
|
_loopTask.setCallback(std::bind(&MqttHandleInverterClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
||||||
|
|||||||
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
MqttHandleInverterTotalClass MqttHandleInverterTotal;
|
MqttHandleInverterTotalClass MqttHandleInverterTotal;
|
||||||
|
|
||||||
void MqttHandleInverterTotalClass::init(Scheduler* scheduler)
|
void MqttHandleInverterTotalClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&MqttHandleInverterTotalClass::loop, this));
|
_loopTask.setCallback(std::bind(&MqttHandleInverterTotalClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "NetworkSettings.h"
|
#include "NetworkSettings.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -18,7 +18,7 @@ NetworkSettingsClass::NetworkSettingsClass()
|
|||||||
dnsServer.reset(new DNSServer());
|
dnsServer.reset(new DNSServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSettingsClass::init(Scheduler* scheduler)
|
void NetworkSettingsClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ void NetworkSettingsClass::init(Scheduler* scheduler)
|
|||||||
WiFi.onEvent(std::bind(&NetworkSettingsClass::NetworkEvent, this, _1));
|
WiFi.onEvent(std::bind(&NetworkSettingsClass::NetworkEvent, this, _1));
|
||||||
setupMode();
|
setupMode();
|
||||||
|
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&NetworkSettingsClass::loop, this));
|
_loopTask.setCallback(std::bind(&NetworkSettingsClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.enable();
|
_loopTask.enable();
|
||||||
|
|||||||
@ -13,9 +13,9 @@ SunPositionClass::SunPositionClass()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SunPositionClass::init(Scheduler* scheduler)
|
void SunPositionClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&SunPositionClass::loop, this));
|
_loopTask.setCallback(std::bind(&SunPositionClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.setInterval(5 * TASK_SECOND);
|
_loopTask.setInterval(5 * TASK_SECOND);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -12,32 +12,32 @@ WebApiClass::WebApiClass()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebApiClass::init(Scheduler* scheduler)
|
void WebApiClass::init(Scheduler& scheduler)
|
||||||
{
|
{
|
||||||
_webApiConfig.init(&_server);
|
_webApiConfig.init(_server);
|
||||||
_webApiDevice.init(&_server);
|
_webApiDevice.init(_server);
|
||||||
_webApiDevInfo.init(&_server);
|
_webApiDevInfo.init(_server);
|
||||||
_webApiDtu.init(&_server);
|
_webApiDtu.init(_server);
|
||||||
_webApiEventlog.init(&_server);
|
_webApiEventlog.init(_server);
|
||||||
_webApiFirmware.init(&_server);
|
_webApiFirmware.init(_server);
|
||||||
_webApiGridprofile.init(&_server);
|
_webApiGridprofile.init(_server);
|
||||||
_webApiInverter.init(&_server);
|
_webApiInverter.init(_server);
|
||||||
_webApiLimit.init(&_server);
|
_webApiLimit.init(_server);
|
||||||
_webApiMaintenance.init(&_server);
|
_webApiMaintenance.init(_server);
|
||||||
_webApiMqtt.init(&_server);
|
_webApiMqtt.init(_server);
|
||||||
_webApiNetwork.init(&_server);
|
_webApiNetwork.init(_server);
|
||||||
_webApiNtp.init(&_server);
|
_webApiNtp.init(_server);
|
||||||
_webApiPower.init(&_server);
|
_webApiPower.init(_server);
|
||||||
_webApiPrometheus.init(&_server);
|
_webApiPrometheus.init(_server);
|
||||||
_webApiSecurity.init(&_server);
|
_webApiSecurity.init(_server);
|
||||||
_webApiSysstatus.init(&_server);
|
_webApiSysstatus.init(_server);
|
||||||
_webApiWebapp.init(&_server);
|
_webApiWebapp.init(_server);
|
||||||
_webApiWsConsole.init(&_server);
|
_webApiWsConsole.init(_server);
|
||||||
_webApiWsLive.init(&_server);
|
_webApiWsLive.init(_server);
|
||||||
|
|
||||||
_server.begin();
|
_server.begin();
|
||||||
|
|
||||||
scheduler->addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.setCallback(std::bind(&WebApiClass::loop, this));
|
_loopTask.setCallback(std::bind(&WebApiClass::loop, this));
|
||||||
_loopTask.setIterations(TASK_FOREVER);
|
_loopTask.setIterations(TASK_FOREVER);
|
||||||
_loopTask.enable();
|
_loopTask.enable();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_config.h"
|
#include "WebApi_config.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
|
|
||||||
void WebApiConfigClass::init(AsyncWebServer* server)
|
void WebApiConfigClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
using std::placeholders::_2;
|
using std::placeholders::_2;
|
||||||
@ -19,7 +19,7 @@ void WebApiConfigClass::init(AsyncWebServer* server)
|
|||||||
using std::placeholders::_5;
|
using std::placeholders::_5;
|
||||||
using std::placeholders::_6;
|
using std::placeholders::_6;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/config/get", HTTP_GET, std::bind(&WebApiConfigClass::onConfigGet, this, _1));
|
_server->on("/api/config/get", HTTP_GET, std::bind(&WebApiConfigClass::onConfigGet, this, _1));
|
||||||
_server->on("/api/config/delete", HTTP_POST, std::bind(&WebApiConfigClass::onConfigDelete, this, _1));
|
_server->on("/api/config/delete", HTTP_POST, std::bind(&WebApiConfigClass::onConfigDelete, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_device.h"
|
#include "WebApi_device.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -12,11 +12,11 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
void WebApiDeviceClass::init(AsyncWebServer* server)
|
void WebApiDeviceClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/device/config", HTTP_GET, std::bind(&WebApiDeviceClass::onDeviceAdminGet, this, _1));
|
_server->on("/api/device/config", HTTP_GET, std::bind(&WebApiDeviceClass::onDeviceAdminGet, this, _1));
|
||||||
_server->on("/api/device/config", HTTP_POST, std::bind(&WebApiDeviceClass::onDeviceAdminPost, this, _1));
|
_server->on("/api/device/config", HTTP_POST, std::bind(&WebApiDeviceClass::onDeviceAdminPost, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_devinfo.h"
|
#include "WebApi_devinfo.h"
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
@ -8,11 +8,11 @@
|
|||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
void WebApiDevInfoClass::init(AsyncWebServer* server)
|
void WebApiDevInfoClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/devinfo/status", HTTP_GET, std::bind(&WebApiDevInfoClass::onDevInfoStatus, this, _1));
|
_server->on("/api/devinfo/status", HTTP_GET, std::bind(&WebApiDevInfoClass::onDevInfoStatus, this, _1));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_dtu.h"
|
#include "WebApi_dtu.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -9,11 +9,11 @@
|
|||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
void WebApiDtuClass::init(AsyncWebServer* server)
|
void WebApiDtuClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/dtu/config", HTTP_GET, std::bind(&WebApiDtuClass::onDtuAdminGet, this, _1));
|
_server->on("/api/dtu/config", HTTP_GET, std::bind(&WebApiDtuClass::onDtuAdminGet, this, _1));
|
||||||
_server->on("/api/dtu/config", HTTP_POST, std::bind(&WebApiDtuClass::onDtuAdminPost, this, _1));
|
_server->on("/api/dtu/config", HTTP_POST, std::bind(&WebApiDtuClass::onDtuAdminPost, this, _1));
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_eventlog.h"
|
#include "WebApi_eventlog.h"
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
void WebApiEventlogClass::init(AsyncWebServer* server)
|
void WebApiEventlogClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/eventlog/status", HTTP_GET, std::bind(&WebApiEventlogClass::onEventlogStatus, this, _1));
|
_server->on("/api/eventlog/status", HTTP_GET, std::bind(&WebApiEventlogClass::onEventlogStatus, this, _1));
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ void WebApiEventlogClass::onEventlogStatus(AsyncWebServerRequest* request)
|
|||||||
JsonObject eventsObject = eventsArray.createNestedObject();
|
JsonObject eventsObject = eventsArray.createNestedObject();
|
||||||
|
|
||||||
AlarmLogEntry_t entry;
|
AlarmLogEntry_t entry;
|
||||||
inv->EventLog()->getLogEntry(logEntry, &entry, locale);
|
inv->EventLog()->getLogEntry(logEntry, entry, locale);
|
||||||
|
|
||||||
eventsObject["message_id"] = entry.MessageId;
|
eventsObject["message_id"] = entry.MessageId;
|
||||||
eventsObject["message"] = entry.Message;
|
eventsObject["message"] = entry.Message;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_firmware.h"
|
#include "WebApi_firmware.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
void WebApiFirmwareClass::init(AsyncWebServer* server)
|
void WebApiFirmwareClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
using std::placeholders::_2;
|
using std::placeholders::_2;
|
||||||
@ -19,7 +19,7 @@ void WebApiFirmwareClass::init(AsyncWebServer* server)
|
|||||||
using std::placeholders::_5;
|
using std::placeholders::_5;
|
||||||
using std::placeholders::_6;
|
using std::placeholders::_6;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/firmware/update", HTTP_POST,
|
_server->on("/api/firmware/update", HTTP_POST,
|
||||||
std::bind(&WebApiFirmwareClass::onFirmwareUpdateFinish, this, _1),
|
std::bind(&WebApiFirmwareClass::onFirmwareUpdateFinish, this, _1),
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_gridprofile.h"
|
#include "WebApi_gridprofile.h"
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
void WebApiGridProfileClass::init(AsyncWebServer* server)
|
void WebApiGridProfileClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/gridprofile/status", HTTP_GET, std::bind(&WebApiGridProfileClass::onGridProfileStatus, this, _1));
|
_server->on("/api/gridprofile/status", HTTP_GET, std::bind(&WebApiGridProfileClass::onGridProfileStatus, this, _1));
|
||||||
_server->on("/api/gridprofile/rawdata", HTTP_GET, std::bind(&WebApiGridProfileClass::onGridProfileRawdata, this, _1));
|
_server->on("/api/gridprofile/rawdata", HTTP_GET, std::bind(&WebApiGridProfileClass::onGridProfileRawdata, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_inverter.h"
|
#include "WebApi_inverter.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -12,11 +12,11 @@
|
|||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
void WebApiInverterClass::init(AsyncWebServer* server)
|
void WebApiInverterClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/inverter/list", HTTP_GET, std::bind(&WebApiInverterClass::onInverterList, this, _1));
|
_server->on("/api/inverter/list", HTTP_GET, std::bind(&WebApiInverterClass::onInverterList, this, _1));
|
||||||
_server->on("/api/inverter/add", HTTP_POST, std::bind(&WebApiInverterClass::onInverterAdd, this, _1));
|
_server->on("/api/inverter/add", HTTP_POST, std::bind(&WebApiInverterClass::onInverterAdd, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_limit.h"
|
#include "WebApi_limit.h"
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
@ -8,11 +8,11 @@
|
|||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
void WebApiLimitClass::init(AsyncWebServer* server)
|
void WebApiLimitClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/limit/status", HTTP_GET, std::bind(&WebApiLimitClass::onLimitStatus, this, _1));
|
_server->on("/api/limit/status", HTTP_GET, std::bind(&WebApiLimitClass::onLimitStatus, this, _1));
|
||||||
_server->on("/api/limit/config", HTTP_POST, std::bind(&WebApiLimitClass::onLimitPost, this, _1));
|
_server->on("/api/limit/config", HTTP_POST, std::bind(&WebApiLimitClass::onLimitPost, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WebApi_maintenance.h"
|
#include "WebApi_maintenance.h"
|
||||||
@ -9,11 +9,11 @@
|
|||||||
#include "WebApi_errors.h"
|
#include "WebApi_errors.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
void WebApiMaintenanceClass::init(AsyncWebServer* server)
|
void WebApiMaintenanceClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/maintenance/reboot", HTTP_POST, std::bind(&WebApiMaintenanceClass::onRebootPost, this, _1));
|
_server->on("/api/maintenance/reboot", HTTP_POST, std::bind(&WebApiMaintenanceClass::onRebootPost, this, _1));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_mqtt.h"
|
#include "WebApi_mqtt.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -11,11 +11,11 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
void WebApiMqttClass::init(AsyncWebServer* server)
|
void WebApiMqttClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/mqtt/status", HTTP_GET, std::bind(&WebApiMqttClass::onMqttStatus, this, _1));
|
_server->on("/api/mqtt/status", HTTP_GET, std::bind(&WebApiMqttClass::onMqttStatus, this, _1));
|
||||||
_server->on("/api/mqtt/config", HTTP_GET, std::bind(&WebApiMqttClass::onMqttAdminGet, this, _1));
|
_server->on("/api/mqtt/config", HTTP_GET, std::bind(&WebApiMqttClass::onMqttAdminGet, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_network.h"
|
#include "WebApi_network.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -10,11 +10,11 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
void WebApiNetworkClass::init(AsyncWebServer* server)
|
void WebApiNetworkClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/network/status", HTTP_GET, std::bind(&WebApiNetworkClass::onNetworkStatus, this, _1));
|
_server->on("/api/network/status", HTTP_GET, std::bind(&WebApiNetworkClass::onNetworkStatus, this, _1));
|
||||||
_server->on("/api/network/config", HTTP_GET, std::bind(&WebApiNetworkClass::onNetworkAdminGet, this, _1));
|
_server->on("/api/network/config", HTTP_GET, std::bind(&WebApiNetworkClass::onNetworkAdminGet, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_ntp.h"
|
#include "WebApi_ntp.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -11,11 +11,11 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
void WebApiNtpClass::init(AsyncWebServer* server)
|
void WebApiNtpClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/ntp/status", HTTP_GET, std::bind(&WebApiNtpClass::onNtpStatus, this, _1));
|
_server->on("/api/ntp/status", HTTP_GET, std::bind(&WebApiNtpClass::onNtpStatus, this, _1));
|
||||||
_server->on("/api/ntp/config", HTTP_GET, std::bind(&WebApiNtpClass::onNtpAdminGet, this, _1));
|
_server->on("/api/ntp/config", HTTP_GET, std::bind(&WebApiNtpClass::onNtpAdminGet, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_power.h"
|
#include "WebApi_power.h"
|
||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
@ -8,11 +8,11 @@
|
|||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
void WebApiPowerClass::init(AsyncWebServer* server)
|
void WebApiPowerClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/power/status", HTTP_GET, std::bind(&WebApiPowerClass::onPowerStatus, this, _1));
|
_server->on("/api/power/status", HTTP_GET, std::bind(&WebApiPowerClass::onPowerStatus, this, _1));
|
||||||
_server->on("/api/power/config", HTTP_POST, std::bind(&WebApiPowerClass::onPowerPost, this, _1));
|
_server->on("/api/power/config", HTTP_POST, std::bind(&WebApiPowerClass::onPowerPost, this, _1));
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_prometheus.h"
|
#include "WebApi_prometheus.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -10,11 +10,11 @@
|
|||||||
#include "WebApi.h"
|
#include "WebApi.h"
|
||||||
#include <Hoymiles.h>
|
#include <Hoymiles.h>
|
||||||
|
|
||||||
void WebApiPrometheusClass::init(AsyncWebServer* server)
|
void WebApiPrometheusClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/prometheus/metrics", HTTP_GET, std::bind(&WebApiPrometheusClass::onPrometheusMetricsGet, this, _1));
|
_server->on("/api/prometheus/metrics", HTTP_GET, std::bind(&WebApiPrometheusClass::onPrometheusMetricsGet, this, _1));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_security.h"
|
#include "WebApi_security.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -9,11 +9,11 @@
|
|||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include <AsyncJson.h>
|
#include <AsyncJson.h>
|
||||||
|
|
||||||
void WebApiSecurityClass::init(AsyncWebServer* server)
|
void WebApiSecurityClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/security/config", HTTP_GET, std::bind(&WebApiSecurityClass::onSecurityGet, this, _1));
|
_server->on("/api/security/config", HTTP_GET, std::bind(&WebApiSecurityClass::onSecurityGet, this, _1));
|
||||||
_server->on("/api/security/config", HTTP_POST, std::bind(&WebApiSecurityClass::onSecurityPost, this, _1));
|
_server->on("/api/security/config", HTTP_POST, std::bind(&WebApiSecurityClass::onSecurityPost, this, _1));
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Thomas Basler and others
|
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||||
*/
|
*/
|
||||||
#include "WebApi_sysstatus.h"
|
#include "WebApi_sysstatus.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
@ -16,11 +16,11 @@
|
|||||||
#define AUTO_GIT_HASH ""
|
#define AUTO_GIT_HASH ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void WebApiSysstatusClass::init(AsyncWebServer* server)
|
void WebApiSysstatusClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/api/system/status", HTTP_GET, std::bind(&WebApiSysstatusClass::onSystemStatus, this, _1));
|
_server->on("/api/system/status", HTTP_GET, std::bind(&WebApiSysstatusClass::onSystemStatus, this, _1));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,9 @@ extern const uint8_t file_zones_json_end[] asm("_binary_webapp_dist_zones_json_g
|
|||||||
extern const uint8_t file_app_js_end[] asm("_binary_webapp_dist_js_app_js_gz_end");
|
extern const uint8_t file_app_js_end[] asm("_binary_webapp_dist_js_app_js_gz_end");
|
||||||
extern const uint8_t file_site_webmanifest_end[] asm("_binary_webapp_dist_site_webmanifest_end");
|
extern const uint8_t file_site_webmanifest_end[] asm("_binary_webapp_dist_site_webmanifest_end");
|
||||||
|
|
||||||
void WebApiWebappClass::init(AsyncWebServer* server)
|
void WebApiWebappClass::init(AsyncWebServer& server)
|
||||||
{
|
{
|
||||||
_server = server;
|
_server = &server;
|
||||||
|
|
||||||
_server->on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
|
_server->on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
AsyncWebServerResponse* response = request->beginResponse_P(200, "text/html", file_index_html_start, file_index_html_end - file_index_html_start);
|
AsyncWebServerResponse* response = request->beginResponse_P(200, "text/html", file_index_html_start, file_index_html_end - file_index_html_start);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user