Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with the [ ] and { } pattern-matching on RPI pico W #135

Open
nordseele opened this issue Sep 27, 2022 · 1 comment
Open

Issue with the [ ] and { } pattern-matching on RPI pico W #135

nordseele opened this issue Sep 27, 2022 · 1 comment

Comments

@nordseele
Copy link

nordseele commented Sep 27, 2022

Hi,

I'm trying to figure out why I can't get the pattern matching and especially the "wildcards" to work properly.
FWIW, I'm on a RPI Pico W w/ Earle Philower Arduino Pico, Arduino core for RP2040.

I've tried with .match, .route and .dispatch I can only traverse hardcoded addresses like the following ones:

msg.match("/er301/*);

Note that the * does work. Something like the pattern below will work:

    if (msg.match("/*/hello/*/world")) {
        OSC_debug(msg);
      }

But absolutely no chance with { } and [ ] and that's my issue here.

I can't traverse the following pattern for example:

msg.route("/{er301,txo}/[1-4]/fct/*", OscDebug);

This full simplified example won't work either ; when sending /er301/42 or /txo/42 from Max, I can't match any message and reach my OscDebug callback function :

void loop() {
  OSCMessage msg;
  int size = Udp.parsePacket();

  if (size > 0) {
    while (size--) {
      msg.fill(Udp.read());
    }
    if (!msg.hasError()) {
      if (msg.match("/{er301,txo}/*")) {
        OSC_debug(msg);
      }

    } else {
      error = msg.getError();
      Serial.print("error: ");
      Serial.println(error);
    }
  }
}

Am I missing something ? I used quite complex pattern-matching with another OSC library, unfortunately it's not flexible enough and I'd rather use the CNMAT library. If I can't get the pattern matching function working, I guess I could always match "step by step" each element of the address...

Any help appreciated, thanks! :-)

@nordseele nordseele changed the title Issues with the wildcards and pattern-matching on RPI pico W Issues with the [ ] and { } pattern-matching on RPI pico W Sep 27, 2022
@nordseele nordseele changed the title Issues with the [ ] and { } pattern-matching on RPI pico W Issue with the [ ] and { } pattern-matching on RPI pico W Sep 27, 2022
@nordseele nordseele reopened this Sep 29, 2022
@adrianfreed
Copy link
Member

you can't match on wild cards.
You send wild cards that are matched with the match string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants