Forum

Decoding Strings

Im trying to decode a string of information by chopping it up into its component parts and converting the hex values back into their original numbers.

This is an example of what i have:

VIDNET01ffee6eb1fffffff1b02…etc

and i want to break it down so i strip out the vidnet code, use the first hex number (01) to direct the following values to the specific node. and then i am trying to decode the HEX RGB information, I’ve searched arround but could only find the Tokenizer which wont let me do what i want. Is there anyother nodes which will help me acheive my goal?

Cheers
D

hope this patch helps

david

splitstring.v4p (8.5 kB)

Excellent, thanks for that David, looks like a good starting point, what is the (.*?)$ in the regular expression box?

Cheers

D

you can read it like this. (.*?)

. any character
*? zero ore more occurrences
() please return those values

and all that between “VIDNET” and the End of line (= $)

press F1 while RegExpr is selected to see the help patch.

I think im nearly there with my patch although substitue seems to be doing strange thins and the UDP (server) isnt outputting as expected.

And last of all how do i convert formatted string values back into its numerical component?

Basically what i am trying to acheive is what the hardware should be doing so we can send the values across a network and see how they translate on another simulation pc. Should have some hardware to test tomoro fingeres crossed!

GoingRoundInCircles.v4p (42.5 kB)

have a look to the Ord (String) node. set it to HexUnsigned8Bit.

My Word, thats just too easy! Thanks Tonfilm

Maybe I spoke too soon when i said this was too easy!

Ive got the patch doing what i wanted but its very glitchy, would this be the UDP send?

VIDNET Send-Receive.v4p (64.5 kB)

Anyone know why this is so jumpy?

*Anyone know why this is so jumpy?
yes. that was the discard mode on the udp-receiver. but simply setting it to concatenate would not have helped. see attached.

i made several modifications. not sure if they suit your application:

  • see the AsString (Color Hex) and AsColor (String Hex) for easier dealing with hexcolor as strings.

  • i removed the dashes between the individual values. they only increase bandwidth for nothing. now the strings are shorter than 1472bytes again each. so this could be optimiced

  • the patch is sending the 5 strings on 5 ports. i’d recommend this for simpler handling if it is possible with your final application. will you stick to 5 packets, or will you need much more?

this patch can still be further optimized if you know more about the final needs for your application.

VIDNET Send-Receive.v4p (36.7 kB)

Hi Joreg, thanks for that, im not sure how may packets we will need but it could be between 2 and 27. Looking with wireshark the data seems to flowing beatifuly ;-). (Wire shark has made this much easier!).

Thanks for showing me a streamlined patch, really appreciated.

D