dersimn / ArduinoPubSubClientTools

10 stars 3 forks source link

MqttWildcard #2

Closed LennartHennigs closed 4 years ago

LennartHennigs commented 4 years ago

Hey Simon, I find your implementation really really helpful. The callbacks for subscribe and publish was exactly I was looking for. So thanks a lot for this.

I have a small question though. Could you provide an example for the MqttWildcard class you also have in here? Thanks

Lennart

dersimn commented 4 years ago

It's used here in the other .cpp File.

Just compare two Strings where one of them contains a wildcard like foo/+/bar and the other one the topic that you want to match like foo/something/bar:

if (MqttWildcard::wildcardMatch(topic_string, wildcard_string)) {
    // topic matches the wildcard
}