From dc8d015acc4625793d6b6b3a727964b9ddc54ee7 Mon Sep 17 00:00:00 2001 From: 1technophile Date: Sat, 25 Nov 2017 17:02:36 +0100 Subject: [PATCH] enable signal sending from raw data on RF Bridge --- ZgatewaySRFB.ino | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ZgatewaySRFB.ino b/ZgatewaySRFB.ino index f8e8ff875a..e80cdb5286 100644 --- a/ZgatewaySRFB.ino +++ b/ZgatewaySRFB.ino @@ -38,10 +38,10 @@ void MQTTtoSRFB(char * topicOri, char * datacallback) { // RF DATA ANALYSIS String topic = topicOri; - + int valueRPT = 0; + if (topic == subjectMQTTtoSRFB){ - int valueRPT = 0; int valueMiniPLSL = 0; int valueMaxiPLSL = 0; int valueSYNC = 0; @@ -78,7 +78,7 @@ void MQTTtoSRFB(char * topicOri, char * datacallback) { trc(String(valueSYNC)); } - trc(F("MQTTtoSRFB default prts")); + trc(F("MQTTtoSRFB prts")); if (valueRPT == 0) valueRPT = 1; if (valueMiniPLSL == 0) valueMiniPLSL = 320; if (valueMaxiPLSL == 0) valueMaxiPLSL = 900; @@ -114,6 +114,24 @@ void MQTTtoSRFB(char * topicOri, char * datacallback) { boolean result = client.publish(subjectGTWSRFBtoMQTT, datacallback);// we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also if (result) trc(F("MQTTtoSRFB ack pub.")); } + if (topic == subjectMQTTtoSRFBRaw){ + + int pos = topic.lastIndexOf(SRFBRptKey); + if (pos != -1){ + pos = pos + +strlen(SRFBRptKey); + valueRPT = (topic.substring(pos,pos + 1)).toInt(); + trc(F("SRFB Repeat:")); + trc(String(valueRPT)); + } + if (valueRPT == 0) valueRPT = 1; + + byte message_b[RF_MESSAGE_SIZE]; + _rfbToArray(datacallback,message_b); + _rfbSend(message_b, valueRPT); + // Acknowledgement to the GTWRF topic + boolean result = client.publish(subjectGTWSRFBtoMQTT, datacallback);// we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also + if (result) trc(F("MQTTtoSRFBRaw ack pub.")); + } } void _rfbSend(byte * message) {