Dynamic Images escape sequences
a_riot42
Posts: 1,624
I am trying to get dynamic images working using the RMF command and it seems to be fine except for paths that contain percent encoding. From what I can gather, since the delimiters for the host/path/file contain '%' (ie: %H, %P etc), if '%' shows up in the string then the command gets confused. At least that is what appears to be happening. If I decode the percent encoding, ie: turn %20 to a space, %26 to &, etc the command works. The problem is the device I am getting the images from uses the & character to delimit the URI. So I can't send a '&' character in the URI, but if I percent encode it to %26, the the RMF command seems to get confused. Surprising that they would have chosen the % character to delimit the RMF command since URLs are often filled with them. Any one seen this behavior and know of a work around? Is there a way to send percent encoded strings to the RMF command? I notice they work in TPD4 but not if I use the RMF command.
Thanks,
Paul
Thanks,
Paul
0
Comments
I did a test with a file with an ampersand in the filename and created a directory with an ampersand in it and the RMF command worked fine, at least pulling the image off the controller itself. So it seems that the command isn't the problem but rather the device receiving the URL doesn't like a naked ampersand, but since I can't get it to work with the ampersand percent encoded, I don't have much choice. Since the device responds with a "404 Not Found" when requesting an image using a URL with spaces or ampersands in it from a browser, I have to assume that the RMF command percent encodes reserved characters in the URL in the background prior to sending the request. Is there a way to see the string that is going from the touch panel to the device to see how the request is formatted? Oddly, in TPD if you hard code the percent encoded string it works fine, but the same string in the RMF command fails and has to be decoded to work unless I am doing something wrong.
The URL I am given to fetch the image looks like this:
getaa?u=x-file-cifs%3a%2f%2fComputerName%2fMy%2520Music%2fThomas%2520Dolby%2fAliens%2520Ate%2520My%2520Buick%2f01%2520Key%2520to%2520Her%2520Ferrari.wma&v=1
As you can see the URL is double percent encoded. Hard coding this into TPD works fine as it does when decoded once to:
getaa?u=x-file-cifs://ComputerName/My%20Music/Thomas%20Dolby/Aliens%20Ate%20My%20Buick/01%20Key%20to%20Her%20Ferrari.wma&v=1
However, neither of these will work with the RMF command. To work, the string has to be double percent decoded to this:
getaa?u=x-file-cifs://ComputerName/My Music/Thomas Dolby/Aliens Ate My Buick/01 Key to Her Ferrari.wma&v=1
Since the device won't resolve this string in a browser I have to assume the RMF command must percent encode spaces, and other URL reserved characters before doing a request. I guess the RMF command encodes these characters while TPD does not and sends the string along without modifying it.
So as long as the string is double decoded the RMF command works, unless there is an ampersand in the string like this:
^RMF-Q2,%H192.168.1.100%A%Fgetaa?u=x-file-cifs://ComputerName/My Music/Emerson, Lake & Palmer/Works, Vol. 1 Disc 1/05 C''est la Vie.wma
All other non encoded URLs work except those with an ampersand in them, and the RMF command doesn't seem to like percent encoded strings, at least I haven't been able to get them to work.
Paul
The send_commands for the examples that you posted that don’t work are over 128 characters.
Try sending the ^RMF %H and %A in one send_command and then the ^RMF %F as another send_command (and keep it under 128 characters) and see if that makes a difference.
this is a good question. You might want to telnet into the panel itself and do a msg on all there and see just what the panel is getting itself.
200 character limit. You'll have the same issue using Google Charts technology as it uses '|' as a separator in the URL. Only solution I know of is to retrieve the image file from code and store it on the local master in the file space pointed to by the dynamic image object on the panel(s). Can be a PITA getting it to work, I encapsulated mine in a module and now use it for almost all dynamic images excluding camera feeds.
Couldn't one use unicode to insert all sorts of stuff in your commands to make it usable? I'm thinking things that might get picked up by the master such as pipes, or other stuff ??? (Going out on a limb here.)
path '%A<path>' Set Image file path. Set Directory path.
The path must be a valid HTTP URL minus
the protocol, host, and filename.
The only exception to this is the
inclusion of special escape sequences and
in the case of the FTP protocol,
regular expressions.
file '%F<file>' Set Image name. Full path to the location
of the file or program that will return
the resource. The path must be a valid
HTTP URL minus the protocol and host.
The only exception to this is the
inclusion of special escape sequences
and in the case of the FTP protocol,
regular expressions. '
And in the notes for the RMF command it says this:
08/05/03 v2.12.50 -2250_10D_V2_12_50.kit
-G4 Phase II release.
-Fixed: ^ GRU, ^GRD, %GU, and %GD.
-Fixed: ^RAF and ^RMF special escape sequences
properly handled.
What are the escape sequences they are talking about? It sounds like exactly what I need but I can't find any documentation other than this and TS doesn't know either.
Paul
By the way, the special escape sequences that are mentioned in the documentation are the $xx codes that sub the relevant local value (e.g. $DV is replaced with the device number).
I believe I tried that thinking it might be similar to the apostrophe escape sequence and it didn't work. I will try again to be sure.
Not sure what you mean here.
Paul
I do agree though with needing clarification.
Escape Sequences
The program supports the replacement of any special escape sequences with the corresponding data obtained from the system as outlined in the table below that identifies escape sequences. This occurs for all resources.
For instance, http://www.amx.com/img.asp?device=$DV would become http://www.amx.com/img.asp?device=10001.
Sequence Panel Information
$DV Device Number
$SY System Number
$IP IP Address
$HN Host Name
$MC Mac Address
$ID Neuron ID
$PX X resolution of current panel mode/file
$PY Y resolution of current panel mode/file
$ST Current state
$AC Address code
$AP Address port
$CC Channel code
$CP Channel port
$LC Level code
$LP Level port
$BX X Resolution of Current button
$BY Y Resolution of Current button
$BN Name of Button
Paul
I think neuron's are to do with the way devices refer to each other over ICSP.