forked from matth-x/MicroOcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOcppMessage.cpp
More file actions
53 lines (40 loc) · 1.63 KB
/
Copy pathOcppMessage.cpp
File metadata and controls
53 lines (40 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// matth-x/ArduinoOcpp
// Copyright Matthias Akstaller 2019 - 2022
// MIT License
#include <ArduinoOcpp/Core/OcppMessage.h>
#include <Variants.h>
using ArduinoOcpp::OcppMessage;
OcppMessage::OcppMessage() {}
OcppMessage::~OcppMessage() {}
const char* OcppMessage::getOcppOperationType(){
Serial.print(F("[OcppMessage] Unsupported operation: getOcppOperationType() is not implemented!\n"));
return "CustomOperation";
}
void OcppMessage::setOcppModel(std::shared_ptr<OcppModel> ocppModel) {
if (!ocppModelInitialized) { //prevent the ocppModel from being overwritten
this->ocppModel = ocppModel; //can still be nullptr
ocppModelInitialized = true;
}
}
void OcppMessage::initiate() {
//called after initiateOcppOperation(anyMsg)
}
std::unique_ptr<DynamicJsonDocument> OcppMessage::createReq() {
Serial.print(F("[OcppMessage] Unsupported operation: createReq() is not implemented!\n"));
return nullptr;
}
void OcppMessage::processConf(JsonObject payload) {
Serial.print(F("[OcppMessage] Unsupported operation: processConf() is not implemented!\n"));
}
void OcppMessage::processReq(JsonObject payload) {
Serial.print(F("[OcppMessage] Unsupported operation: processReq() is not implemented!\n"));
}
std::unique_ptr<DynamicJsonDocument> OcppMessage::createConf() {
Serial.print(F("[OcppMessage] Unsupported operation: createConf() is not implemented!\n"));
return nullptr;
}
std::unique_ptr<DynamicJsonDocument> ArduinoOcpp::createEmptyDocument() {
auto emptyDoc = std::unique_ptr<DynamicJsonDocument>(new DynamicJsonDocument(0));
emptyDoc->to<JsonObject>();
return std::move(emptyDoc);
}