[BF] for Linux mosquitto_sub
This commit is contained in:
parent
5ef7d21865
commit
e3bafaf014
@ -13,7 +13,7 @@ namespace Dashboard.Connector {
|
||||
|
||||
public Mosquitto(Dictionary<String, String> mqtt_settings) {
|
||||
this.settings = mqtt_settings;
|
||||
//mosquitto_sub --cafile ca.pem --cert cert.pem --key cert.key -h swb.broker.flex4grid.eu -p 8883 -t /# -v
|
||||
//mosquitto_sub --cafile ca.pem --cert cert.pem --key cert.key -h swb.broker.flex4grid.eu -p 8883 -t "#" -v -d
|
||||
this.message = "";
|
||||
this.p = new Process();
|
||||
this.p.StartInfo.FileName = "mosquitto_sub";
|
||||
@ -76,7 +76,7 @@ namespace Dashboard.Connector {
|
||||
if (e.Data != null) {
|
||||
if (e.Data.StartsWith("Client mosqsub")) {
|
||||
if (this.message != "" && this.message.IndexOf(" received PUBLISH ") > 0) {
|
||||
MatchCollection matches = (new Regex("^Client mosqsub\\|.*received PUBLISH \\(.*,.*,.*,.*, '(.*)'.*\\)\\)\n[^ ]* (.*)$", RegexOptions.IgnoreCase | RegexOptions.Singleline)).Matches(this.message);
|
||||
MatchCollection matches = (new Regex("^Client mosqsub[\\|/].*received PUBLISH \\(.*,.*,.*,.*, '(.*)'.*\\)\\)\n[^ ]* (.*)$", RegexOptions.IgnoreCase | RegexOptions.Singleline)).Matches(this.message);
|
||||
String topic = matches[0].Groups[1].Value;
|
||||
String message = matches[0].Groups[2].Value.Trim();
|
||||
this.MessageIncomming?.Invoke(this, new MqttEventArgs(message, topic));
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user