@@ -14,7 +14,9 @@ ClassFlowMQTT::ClassFlowMQTT()
1414 topic = " " ;
1515 clientname = " watermeter" ;
1616 OldValue = " " ;
17- flowpostprocessing = NULL ;
17+ flowpostprocessing = NULL ;
18+ user = " " ;
19+ password = " " ;
1820}
1921
2022ClassFlowMQTT::ClassFlowMQTT (std::vector<ClassFlow*>* lfc)
@@ -24,6 +26,8 @@ ClassFlowMQTT::ClassFlowMQTT(std::vector<ClassFlow*>* lfc)
2426 clientname = " watermeter" ;
2527 OldValue = " " ;
2628 flowpostprocessing = NULL ;
29+ user = " " ;
30+ password = " " ;
2731
2832 ListFlowControll = lfc;
2933
@@ -53,6 +57,14 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
5357 while (this ->getNextLine (pfile, &aktparamgraph) && !this ->isNewParagraph (aktparamgraph))
5458 {
5559 zerlegt = this ->ZerlegeZeile (aktparamgraph);
60+ if ((toUpper (zerlegt[0 ]) == " USER" ) && (zerlegt.size () > 1 ))
61+ {
62+ this ->user = zerlegt[1 ];
63+ }
64+ if ((toUpper (zerlegt[0 ]) == " PASSWORD" ) && (zerlegt.size () > 1 ))
65+ {
66+ this ->password = zerlegt[1 ];
67+ }
5668 if ((toUpper (zerlegt[0 ]) == " URI" ) && (zerlegt.size () > 1 ))
5769 {
5870 this ->uri = zerlegt[1 ];
@@ -70,7 +82,7 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
7082
7183 if ((uri.length () > 0 ) && (topic.length () > 0 ))
7284 {
73- MQTTInit (uri, clientname);
85+ MQTTInit (uri, clientname, user, password );
7486 }
7587
7688 return true ;
0 commit comments