code style, documentation
This commit is contained in:
@@ -1166,18 +1166,19 @@ void BusHandler::messageCompleted() {
|
||||
} else {
|
||||
string data = output.str();
|
||||
if (m_answer && dstAddress == (master ? m_ownMasterAddress : m_ownSlaveAddress)) {
|
||||
logNotice(lf_update, "%s %s self-update %s %s QQ=%2.2x: %s", prefix, mode, circuit.c_str(), name.c_str(), srcAddress,
|
||||
data.c_str()); // TODO store in database of internal variables
|
||||
logNotice(lf_update, "%s %s self-update %s %s QQ=%2.2x: %s", prefix, mode, circuit.c_str(), name.c_str(),
|
||||
srcAddress, data.c_str()); // TODO store in database of internal variables
|
||||
} else if (message->getDstAddress() == SYN) { // any destination
|
||||
if (message->getSrcAddress() == SYN) { // any destination and any source
|
||||
logNotice(lf_update, "%s %s %s %s QQ=%2.2x ZZ=%2.2x: %s", prefix, mode, circuit.c_str(), name.c_str(), srcAddress,
|
||||
dstAddress, data.c_str());
|
||||
logNotice(lf_update, "%s %s %s %s QQ=%2.2x ZZ=%2.2x: %s", prefix, mode, circuit.c_str(), name.c_str(),
|
||||
srcAddress, dstAddress, data.c_str());
|
||||
} else {
|
||||
logNotice(lf_update, "%s %s %s %s ZZ=%2.2x: %s", prefix, mode, circuit.c_str(), name.c_str(), dstAddress,
|
||||
data.c_str());
|
||||
data.c_str());
|
||||
}
|
||||
} else if (message->getSrcAddress() == SYN) { // any source
|
||||
logNotice(lf_update, "%s %s %s %s QQ=%2.2x: %s", prefix, mode, circuit.c_str(), name.c_str(), srcAddress, data.c_str());
|
||||
logNotice(lf_update, "%s %s %s %s QQ=%2.2x: %s", prefix, mode, circuit.c_str(), name.c_str(), srcAddress,
|
||||
data.c_str());
|
||||
} else {
|
||||
logNotice(lf_update, "%s %s %s %s: %s", prefix, mode, circuit.c_str(), name.c_str(), data.c_str());
|
||||
}
|
||||
|
||||
+2
-1
@@ -722,7 +722,7 @@ class LoadableDataFieldSet : public DataFieldSet, public MappedFileReader {
|
||||
/**
|
||||
* Constructs a new instance.
|
||||
* @param name the field name.
|
||||
* @param fields the @a vector of @a SingleDataField instances part of this set.
|
||||
* @param templates the @a DataFieldTemplates instance to use.
|
||||
*/
|
||||
LoadableDataFieldSet(const string& name, DataFieldTemplates* templates)
|
||||
: DataFieldSet(name, vector<const SingleDataField*>()), MappedFileReader(false), m_templates(templates) {
|
||||
@@ -736,6 +736,7 @@ class LoadableDataFieldSet : public DataFieldSet, public MappedFileReader {
|
||||
vector< map<string, string> >* subRows, string* errorDescription, bool replace) override;
|
||||
|
||||
private:
|
||||
/** the @a DataFieldTemplates instance to use. */
|
||||
DataFieldTemplates* m_templates;
|
||||
};
|
||||
|
||||
|
||||
@@ -195,6 +195,7 @@ class Message : public AttributedItem {
|
||||
/**
|
||||
* Create a new scan @a Message instance.
|
||||
* @param broadcast true for broadcast scan message, false for scan message to be sent to a slave address.
|
||||
* @param deleteData whether to delete the @a DataField during @a Message destruction.
|
||||
* @return the new scan @a Message instance.
|
||||
*/
|
||||
static Message* createScanMessage(bool broadcast = false, bool deleteData = true);
|
||||
@@ -1217,6 +1218,7 @@ class MessageMap : public MappedFileReader {
|
||||
* Construct a new instance.
|
||||
* @param addAll whether to add all messages, even if duplicate.
|
||||
* @param preferLanguage the preferred language to use, or empty.
|
||||
* @param deleteData whether to delete the scan message @a DataField during @a Message destruction.
|
||||
*/
|
||||
explicit MessageMap(bool addAll = false, const string& preferLanguage = "", bool deleteData = true)
|
||||
: MappedFileReader::MappedFileReader(true),
|
||||
|
||||
@@ -183,30 +183,30 @@ bool HttpClient::request(const string& method, const string& uri, const string&
|
||||
struct tm t;
|
||||
pos += strlen("\r\nLast-Modified: ") + 5;
|
||||
char* strEnd = nullptr;
|
||||
t.tm_mday = (int)strtol(hdrs + pos, &strEnd, 10);
|
||||
t.tm_mday = static_cast<int>(strtol(hdrs + pos, &strEnd, 10));
|
||||
if (strEnd != hdrs + pos + 2 || t.tm_mday < 1 || t.tm_mday > 31) {
|
||||
t.tm_mday = -1;
|
||||
}
|
||||
t.tm_mon = indexToMonth[((hdrs[pos+4]&0x10)>>1) | (hdrs[pos+5]&0x17)] - 1;
|
||||
strEnd = nullptr;
|
||||
t.tm_year = (int)strtol(hdrs + pos + 7, &strEnd, 10);
|
||||
t.tm_year = static_cast<int>(strtol(hdrs + pos + 7, &strEnd, 10));
|
||||
if (strEnd != hdrs + pos + 11 || t.tm_year < 1970 || t.tm_year >= 3000) {
|
||||
t.tm_year = -1;
|
||||
} else {
|
||||
t.tm_year -= 1900;
|
||||
}
|
||||
strEnd = nullptr;
|
||||
t.tm_hour = (int)strtol(hdrs + pos + 12, &strEnd, 10);
|
||||
t.tm_hour = static_cast<int>(strtol(hdrs + pos + 12, &strEnd, 10));
|
||||
if (strEnd != hdrs + pos + 14 || t.tm_hour > 23) {
|
||||
t.tm_hour = -1;
|
||||
}
|
||||
strEnd = nullptr;
|
||||
t.tm_min = (int)strtol(hdrs + pos + 15, &strEnd, 10);
|
||||
t.tm_min = static_cast<int>(strtol(hdrs + pos + 15, &strEnd, 10));
|
||||
if (strEnd != hdrs + pos + 17 || t.tm_min > 59) {
|
||||
t.tm_min = -1;
|
||||
}
|
||||
strEnd = nullptr;
|
||||
t.tm_sec = (int)strtol(hdrs + pos + 18, &strEnd, 10);
|
||||
t.tm_sec = static_cast<int>(strtol(hdrs + pos + 18, &strEnd, 10));
|
||||
if (strEnd != hdrs + pos + 20 || t.tm_sec > 59) {
|
||||
t.tm_sec = -1;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ bool HttpClient::request(const string& method, const string& uri, const string&
|
||||
|
||||
size_t HttpClient::readUntil(const string& delim, const size_t length, string* result) {
|
||||
if (!m_buffer) {
|
||||
m_buffer = (char*)malloc(1024);
|
||||
m_buffer = reinterpret_cast<char*>(malloc(1024));
|
||||
if (!m_buffer) {
|
||||
return string::npos;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef struct sockaddr_in socketaddress;
|
||||
|
||||
namespace ebusd {
|
||||
|
||||
/** \file lib/utils/http.h */
|
||||
/** \file lib/utils/httpclient.h */
|
||||
|
||||
using std::string;
|
||||
using std::ifstream;
|
||||
@@ -115,6 +115,7 @@ class HttpClient {
|
||||
|
||||
/**
|
||||
* Execute an arbitrary request.
|
||||
* @param method the method string.
|
||||
* @param uri the URI string.
|
||||
* @param body the optional body to send.
|
||||
* @param response the response body from the server (or the HTTP header on error).
|
||||
|
||||
Reference in New Issue
Block a user