Compare commits
No commits in common. "e5c13e0bb6f4d708d308917336415f9d82cf8d4a" and "eeb4e06e04f740822b1fbde8961f6628cb1a8e4d" have entirely different histories.
e5c13e0bb6
...
eeb4e06e04
1 changed files with 17 additions and 2 deletions
|
@ -46,6 +46,7 @@ size_t MyOvmsServerV3Reader = 0;
|
|||
|
||||
bool OvmsServerV3ReaderCallback(OvmsNotifyType* type, OvmsNotifyEntry* entry)
|
||||
{
|
||||
ESP_LOGD(TAG, "OvmsServerV3ReaderCallback");
|
||||
if (MyOvmsServerV3)
|
||||
return MyOvmsServerV3->IncomingNotification(type, entry);
|
||||
else
|
||||
|
@ -54,6 +55,7 @@ bool OvmsServerV3ReaderCallback(OvmsNotifyType* type, OvmsNotifyEntry* entry)
|
|||
|
||||
bool OvmsServerV3ReaderFilterCallback(OvmsNotifyType* type, const char* subtype)
|
||||
{
|
||||
ESP_LOGD(TAG, "OvmsServerV3ReaderFilterCallback");
|
||||
if (MyOvmsServerV3)
|
||||
return MyOvmsServerV3->NotificationFilter(type, subtype);
|
||||
else
|
||||
|
@ -62,6 +64,7 @@ bool OvmsServerV3ReaderFilterCallback(OvmsNotifyType* type, const char* subtype)
|
|||
|
||||
static void OvmsServerV3MongooseCallback(struct mg_connection *nc, int ev, void *p)
|
||||
{
|
||||
ESP_LOGD(TAG, "OvmsServerV3MongooseCallback");
|
||||
struct mg_mqtt_message *msg = (struct mg_mqtt_message *) p;
|
||||
switch (ev)
|
||||
{
|
||||
|
@ -260,6 +263,7 @@ OvmsServerV3::~OvmsServerV3()
|
|||
|
||||
void OvmsServerV3::TransmitAllMetrics()
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitAllMetrics");
|
||||
OvmsMutexLock mg(&m_mgconn_mutex);
|
||||
if (!m_mgconn)
|
||||
return;
|
||||
|
@ -278,6 +282,7 @@ void OvmsServerV3::TransmitAllMetrics()
|
|||
|
||||
void OvmsServerV3::TransmitModifiedMetrics()
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitModifiedMetrics");
|
||||
OvmsMutexLock mg(&m_mgconn_mutex);
|
||||
if (!m_mgconn)
|
||||
return;
|
||||
|
@ -316,6 +321,7 @@ void OvmsServerV3::TransmitMetric(OvmsMetric* metric)
|
|||
|
||||
int OvmsServerV3::TransmitNotificationInfo(OvmsNotifyEntry* entry)
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitNotificationInfo");
|
||||
std::string topic(m_topic_prefix);
|
||||
topic.append("notify/info/");
|
||||
topic.append(entry->m_subtype);
|
||||
|
@ -331,6 +337,7 @@ int OvmsServerV3::TransmitNotificationInfo(OvmsNotifyEntry* entry)
|
|||
|
||||
int OvmsServerV3::TransmitNotificationError(OvmsNotifyEntry* entry)
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitNotificationError");
|
||||
std::string topic(m_topic_prefix);
|
||||
topic.append("notify/error/");
|
||||
topic.append(entry->m_subtype);
|
||||
|
@ -346,6 +353,7 @@ int OvmsServerV3::TransmitNotificationError(OvmsNotifyEntry* entry)
|
|||
|
||||
int OvmsServerV3::TransmitNotificationAlert(OvmsNotifyEntry* entry)
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitNotificationAlert");
|
||||
std::string topic(m_topic_prefix);
|
||||
topic.append("notify/alert/");
|
||||
topic.append(entry->m_subtype);
|
||||
|
@ -361,6 +369,7 @@ int OvmsServerV3::TransmitNotificationAlert(OvmsNotifyEntry* entry)
|
|||
|
||||
int OvmsServerV3::TransmitNotificationData(OvmsNotifyEntry* entry)
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitNotificationData");
|
||||
char base[32];
|
||||
std::string topic(m_topic_prefix);
|
||||
topic.append("notify/data/");
|
||||
|
@ -388,6 +397,7 @@ int OvmsServerV3::TransmitNotificationData(OvmsNotifyEntry* entry)
|
|||
|
||||
void OvmsServerV3::TransmitPendingNotificationsInfo()
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitPendingNotificationsInfo");
|
||||
// Find the type object
|
||||
OvmsNotifyType* info = MyNotify.GetType("info");
|
||||
if (info == NULL)
|
||||
|
@ -410,6 +420,7 @@ void OvmsServerV3::TransmitPendingNotificationsInfo()
|
|||
|
||||
void OvmsServerV3::TransmitPendingNotificationsError()
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitPendingNotificationsError");
|
||||
// Find the type object
|
||||
OvmsNotifyType* error = MyNotify.GetType("error");
|
||||
if (error == NULL)
|
||||
|
@ -432,6 +443,7 @@ void OvmsServerV3::TransmitPendingNotificationsError()
|
|||
|
||||
void OvmsServerV3::TransmitPendingNotificationsAlert()
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitPendingNotificationsAlert");
|
||||
// Find the type object
|
||||
OvmsNotifyType* alert = MyNotify.GetType("alert");
|
||||
if (alert == NULL)
|
||||
|
@ -454,6 +466,7 @@ void OvmsServerV3::TransmitPendingNotificationsAlert()
|
|||
|
||||
void OvmsServerV3::TransmitPendingNotificationsData()
|
||||
{
|
||||
ESP_LOGD(TAG, "TransmitPendingNotificationsData");
|
||||
if (m_notify_data_waitcomp != 0) return;
|
||||
|
||||
// Find the type object
|
||||
|
@ -526,6 +539,7 @@ void OvmsServerV3::IncomingPubRec(int id)
|
|||
|
||||
void OvmsServerV3::IncomingEvent(std::string event, void* data)
|
||||
{
|
||||
ESP_LOGD(TAG, "IncomingEvent");
|
||||
// Publish the event, if we are connected...
|
||||
if (m_mgconn == NULL) return;
|
||||
if (!StandardMetrics.ms_s_v3_connected->AsBool()) return;
|
||||
|
@ -747,10 +761,10 @@ void OvmsServerV3::SetStatus(const char* status, bool fault /*=false*/, State ne
|
|||
|
||||
void OvmsServerV3::MetricModified(OvmsMetric* metric)
|
||||
{
|
||||
ESP_LOGD(TAG, "MetricModified");
|
||||
if (!StandardMetrics.ms_s_v3_connected->AsBool()) return;
|
||||
|
||||
int now = StandardMetrics.ms_m_monotonic->AsInt();
|
||||
if (m_streaming && now > m_lasttx_stream+m_streaming) //Test counter without caron message
|
||||
if (m_streaming)
|
||||
{
|
||||
OvmsMutexLock mg(&m_mgconn_mutex);
|
||||
if (!m_mgconn)
|
||||
|
@ -762,6 +776,7 @@ void OvmsServerV3::MetricModified(OvmsMetric* metric)
|
|||
|
||||
bool OvmsServerV3::NotificationFilter(OvmsNotifyType* type, const char* subtype)
|
||||
{
|
||||
ESP_LOGD(TAG, "NotificationFilter");
|
||||
if (strcmp(type->m_name, "info") == 0 ||
|
||||
strcmp(type->m_name, "error") == 0 ||
|
||||
strcmp(type->m_name, "alert") == 0 ||
|
||||
|
|
Loading…
Reference in a new issue