Home AMX User Forum AMX Technical Discussion

Telnet send_string Formatting

I'm trying to use one master to telnet into a bunch of other masters and send what in a telnet terminal would be:
send_string dvSwitcher,"'#y 0,120,15',$0D"
Sending that ^ from within telnet on my PC does exactly what I expect it to do. This would include hitting enter on my keyboard for an extra $0D,$0A

Using one master to communicate via telnet to other masters is not a problem at all, the issue I'm having is properly formatting the above telnet string in the .axs file on the master master.

Sneak the $0D past the telnet connection - solved by putting it inside the ASCII string
Escape or modify ' " , so they don't break the string in Studio - solved by using $22(") $27(') $2C(,)

Is there some sort of escape within AMX that I'm unaware of? If there was it would make this a lot more readable.

Variations of what I've tried:
send_string dvTelnet,"'send_string dvSwitcher,',$22,$27,'#y 0,120,15',$27,',',$0D,$22,$0D,$0A";
^ That's no good because I think(?) the hex needs to be directly in the ASCII, so that's what I did with the next attempt:

send_string dvTelnet,"'send_string dvSwitcher$2C$22$27#y 0,120,15$27$2C$0D',$0D,$0A";
This is making it to the device but it's coming in as:
Line 1 2020-08-27 (08:40:31):: String To [5001:2:183]-["'x',$0F,'',',$0D"]
Line 2 2020-08-27 (08:40:31):: String From [5001:2:183]-["'x',$0F,'',',$0D"]
x is decimal 120, and $0F is decimal 15, so it looks like it might be getting broken in Telnet.

Thanks in advance for any help on this. Plan B is to just loop through the IP list with Python and send the telnet commands through there, but It'll drive me nuts not figuring this out.


  • richardhermanrichardherman not-so-junior member Posts: 339
    edited August 2020

    When you say: "I'm trying to use one master to telnet into a bunch of other masters", I assume you are trying to control a device attached to some remote masters via M2M?
    If so "'#y',$00,$78,$0F,$0D,$0A" should work, just a composite string. No idea what the protocol asks for.
    As far as: "Escape or modify ' " , so they don't break the string in Studio", you mean that the string will break in 'diagnostics' at the $00? If so, that is expected, it's just the display, the string will be correct. See: https://proforums.harman.com/amx/discussion/137059/interpreting-serial-data#latest

    Maybe I just don't understand what you are trying to do, though.

  • logantvlogantv Programmer Posts: 26

    Sorry I should do a better job clarifying. I'm not doing M2M, I'm literally opening port 23 on an NX-1200 sitting on my desk and connecting via telnet to independent systems on a FOR loop. Usually I have it sweep through and populate this:
    structure _amxMaster
    char systemNumber[6];
    char model[16];
    char masterFirmware[12];
    char controllerFirmware[12];
    char IPaddress[16]; //extra char for comma during parsing
    char hostName[24];
    char MAC[17];
    char telnetSecured[3];
    char userName[16];
    char password[16];
    char loginFailed[36];
    char programName[24];
    using 'show device 5001', 'get ip', and 'program info'.

    We switched document cameras in 300+ rooms and then found out their flakiness might be related to HDCP being turned on, so what I'm actually doing is switching to HDMI4 with the string in my first post, then sending the HDCP off string. The only other way is to physically go to every room and do it with the buttons on the front of the switcher, or telnet into each master manually and send the two strings. This is a one-off thing.

    With AMX on telnet you can 'send_string dvWhatever,"string expression" and it'll send the string to the device. I just can't get around making a mess of the apostrophes and commas

  • logantvlogantv Programmer Posts: 26

    Since you mention M2M I looked in Studio and found url_struct and add_url_entry. Since it looks like I can just add all the IPs from a .csv that wouldn't be bad at all. I always assumed you had to manually add them in the web GUI

Sign In or Register to comment.