mirror of
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git
synced 2026-03-22 09:04:23 +01:00
fix topic comparison
This commit is contained in:
@@ -98,9 +98,9 @@ void MqttPlugin::downstreamHandler(char *topic, uint8_t *payload, unsigned int l
|
|||||||
String topicStr = String(topic);
|
String topicStr = String(topic);
|
||||||
int topicRootLength = topicRoot.length();
|
int topicRootLength = topicRoot.length();
|
||||||
if(topicStr.length() > topicRootLength){
|
if(topicStr.length() > topicRootLength){
|
||||||
int baseTopicLength = topicStr.substring(0, topicRootLength).length();
|
String baseTopic = topicStr.substring(0, topicRootLength);
|
||||||
|
if(baseTopic.compareTo(topicRoot) == 0){
|
||||||
String localTopic = topicStr.substring(topicRootLength);
|
String localTopic = topicStr.substring(topicRootLength);
|
||||||
if(baseTopicLength == topicRootLength){
|
|
||||||
String direction = localTopic.substring(0,4);
|
String direction = localTopic.substring(0,4);
|
||||||
if(direction == "/in/" ){
|
if(direction == "/in/" ){
|
||||||
String localSubTopic = localTopic.substring(direction.length());
|
String localSubTopic = localTopic.substring(direction.length());
|
||||||
|
|||||||
Reference in New Issue
Block a user