Home AMX User Forum AMX Control Products

Sending a "|" not a "pipe = CRLF" to a touchpanel

Anyone know how to send the "|" character as the "|" character and not the new line trigger?

Found its needed for updating the path of some dynamic image stuff I'm working with on Google Charts and I'm getting some funky results

"||" doesn't seem to cut it.

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    The pipe character to CRLF conversion only happens when sending text to a button (I don’t think it can be escaped) and has nothing to do with a path for a dynamic image.

    A pipe is one of the characters (like a space or a quotation mark) that should never be used in a URL and it needs to be encoded. If you want to URL encode a character you need to use a percent sign (%) followed by the 2 digit hex value.

    For example you’ll sometimes see %20 in a URL which is an URL encoded space character.

    A | = 0x7C so if you want the pipe try:

    %7C

    I think someone posted a function someplace on the forum that will URL encode a string but if you only need to worry about the pipe then %7C should do the trick.

    HTH

    Here's the link:

    http://amxforums.com/showthread.php?t=5345&highlight=url+encoding
    icraigie wrote: »
    Anyone know how to send the "|" character as the "|" character and not the new line trigger?

    Found its needed for updating the path of some dynamic image stuff I'm working with on Google Charts and I'm getting some funky results

    "||" doesn't seem to cut it.
  • Tried %7C too and same deal.

    Issues isn't in the URL encoding, the panel is seeing the "|" as a new line escape character even though its not embedded in a text change command string.
  • Joe HebertJoe Hebert Posts: 2,159
    icraigie wrote: »
    Tried %7C too and same deal.

    Issues isn't in the URL encoding, the panel is seeing the "|" as a new line escape character even though its not embedded in a text change command string.
    So any send_command converts a pipe into crlf? That doesn?t sound good.

    I?m curious, how do you know it?s doing that?

    It seems strange that the filename requires an illegal character. Or am I just misunderstanding your problem?
  • Joe Hebert wrote: »
    So any send_command converts a pipe into crlf? That doesn’t sound good.

    I’m curious, how do you know it’s doing that?

    It seems strange that the filename requires an illegal character. Or am I just misunderstanding your problem?

    Here's the url:

    http://chart.apis.google.com/chart?&cht=bvs&chs=530x200&chco=b4ecb4&chbh=20,0,0&chf=bg,s,EEF3FAFF&chlr=1.5kWh|0.75|0.0&chd=s:0gbdeYebZYe341pfnekckwuy&/Chart.png

    If that data is entered as is into the static dynamic image properties (or a browser), it works fine, but send it to a touchpanel with an ^RMF command and it fails, specifically the axis labels that are delimited with the "|" character.

    Guess I could sniff what the panel is sending out after getting the ^RMF string, maybe later.
  • Joe HebertJoe Hebert Posts: 2,159
    icraigie wrote: »
    Here's the url:

    http://chart.apis.google.com/chart?&cht=bvs&chs=530x200&chco=b4ecb4&chbh=20,0,0&chf=bg,s,EEF3FAFF&chlr=1.5kWh|0.75|0.0&chd=s:0gbdeYebZYe341pfnekckwuy&/Chart.png

    If that data is entered as is into the static dynamic image properties (or a browser), it works fine, but send it to a touchpanel with an ^RMF command and it fails, specifically the axis labels that are delimited with the "|" character.

    Guess I could sniff what the panel is sending out after getting the ^RMF string, maybe later.
    I really don?t think the pipe to crlf is the issue here because:

    1) It should only happen with text send_commands.

    2) If you?re using %7C it won?t be interpreted as a pipe so the conversion won?t happen. That can be verified by doing a text send_command with %7C. You just get %7C as the text, not a crlf.

    I?m guessing you must have some sort of other problem setting up the dynamic image (or a dynamic image undocumented feature) or possibly a URL encoding issue. Since you posted a link I will try it out myself and see what I get if I get a chance later tonight. If you happen to get it working before then let us know.

    You said you get funky results. So that means you get some sort of image but not the correct one?

    Can you post the actual dynamic image commands that your using? Do the commands look right going out to the panel if you monitor with notifications?

    If the send_command is greater than 200 or so characters it will get lopped off. Just throwing that out as an idea.
  • Got it working by loading the file onto the master and serving it up to the touch panels locally. Used the same unencoded file path string I was sending with the RMF command to the touch panels - with the local file renamed chart.png.

    Probably was going to end up here anyways because of that 200 byte limit - which I was aware of.

    Few more tweaks should see a fairly respectful implimentation of Google powermeter on the touch panel.



    Joe Hebert wrote: »
    I really don?t think the pipe to crlf is the issue here because:

    1) It should only happen with text send_commands.

    2) If you?re using %7C it won?t be interpreted as a pipe so the conversion won?t happen. That can be verified by doing a text send_command with %7C. You just get %7C as the text, not a crlf.

    I?m guessing you must have some sort of other problem setting up the dynamic image (or a dynamic image undocumented feature) or possibly a URL encoding issue. Since you posted a link I will try it out myself and see what I get if I get a chance later tonight. If you happen to get it working before then let us know.

    You said you get funky results. So that means you get some sort of image but not the correct one?

    Can you post the actual dynamic image commands that your using? Do the commands look right going out to the panel if you monitor with notifications?

    If the send_command is greater than 200 or so characters it will get lopped off. Just throwing that out as an idea.
  • Joe HebertJoe Hebert Posts: 2,159
    Cool, glad to hear you got it working.
  • DHawthorneDHawthorne Posts: 4,584
    The pipe as a CRLF was a TPDesign3 convention that got carried over, and it was mainly intended for use in send_commands. It's the panel that is creating the line break in the button itself. I'm pretty sure (though I don't really remember, and am not at liberty to try right now ... jumping back and forth here between compiles and loads at a client site), that even entering a pipe character in the button text created a new line in the panel itself, though that much was not carried to TPD4.
Sign In or Register to comment.