stephb9959
2022-11-03 09:33:53 -07:00
parent 3cf7d2f8d6
commit fa85884d97
4 changed files with 4 additions and 6 deletions

2
build
View File

@@ -1 +1 @@
3
5

View File

@@ -10,6 +10,7 @@
#include "Poco/Net/NetException.h"
#include "Poco/Net/SSLException.h"
#include "Poco/JSON/Template.h"
#include "Poco/JSON/JSONException.h"
#include "Poco/Thread.h"
namespace OpenWifi {

View File

@@ -14,7 +14,6 @@ namespace OpenWifi {
struct WebSocketNotification {
inline static uint64_t xid = 1;
uint64_t notification_id = ++xid;
// std::string type;
std::uint64_t type_id=0;
ContentStruct content;
@@ -26,7 +25,6 @@ namespace OpenWifi {
template<typename ContentStruct>
void WebSocketNotification<ContentStruct>::to_json(Poco::JSON::Object &Obj) const {
RESTAPI_utils::field_to_json(Obj, "notification_id", notification_id);
// RESTAPI_utils::field_to_json(Obj, "type", type);
RESTAPI_utils::field_to_json(Obj, "type_id", type_id);
RESTAPI_utils::field_to_json(Obj, "content", content);
}
@@ -35,7 +33,6 @@ namespace OpenWifi {
bool WebSocketNotification<ContentStruct>::from_json(const Poco::JSON::Object::Ptr &Obj) {
try {
RESTAPI_utils::field_from_json(Obj, "notification_id", notification_id);
// RESTAPI_utils::field_from_json(Obj, "type", type);
RESTAPI_utils::field_from_json(Obj, "type_id", type_id);
RESTAPI_utils::field_from_json(Obj, "content", content);
return true;

View File

@@ -48,7 +48,7 @@ namespace OpenWifi {
struct NotificationLogMessage {
std::string msg;
std::string level;
std::string timestamp;
std::uint64_t timestamp;
std::string source;
std::string thread_name;
std::uint64_t thread_id=0;
@@ -85,7 +85,7 @@ namespace OpenWifi {
WebSocketClientNotificationLogMessage_t Msg;
Msg.content.msg = m.getText();
Msg.content.level = WebSocketLogger::to_string(m.getPriority());
Msg.content.timestamp = Poco::DateTimeFormatter::format(m.getTime(), Poco::DateTimeFormat::ISO8601_FORMAT);
Msg.content.timestamp = m.getTime().epochTime();
Msg.content.source = m.getSource();
Msg.content.thread_name = m.getThread();
Msg.content.thread_id = m.getTid();