AMX MAX v3 TCP Control Passthru
billyung
Posts: 16
I'm working on receiving data from an older MAX unit by bypassing the module and using the commands in the protocol reference guide. It's simple enough to use the module with the passthru command; however, it would seem the correct approach when a response from the MAX is required would be to open a tcp port with the MAX and proceed accordingly. Does anyone have any experience with this? To be specific, my first question is, which tcp port does the MAX command protocol listen to?
0
Comments
HTH
My intention was to build an enhanced touchpanel interface for the older MAX. I wonder if anyone would be interested in a full featured web interface for the older MAX boxes...
I'd love to hear about the interface that you've created too.
That's the route I chose to take. I might not have been clear about that in my last post.
Can you share some sample code from your direct Netlinx communication with the MMS-125? Specifically, I would like to use the DVD Details command to pull over the genre and keywords from the MAX database for display on a touchpanel.
Thanks,
Bill
BUTTON_EVENT[dvTP01_4, 112] // Get DVD Details
{
PUSH :
{
(* Open The Client *)
IP_CLIENT_OPEN(dvIPClient.Port,'192.168.254.30','8000',1)
wait_until(maxiponline) //set to 1 in online max ip event, 0 in offline event
{
SEND_STRING 0,"'Opening tcp port for Max'"
SEND_STRING dvIPClient.PORT, "'DVD Details 1|',SelectedDVDID,'\n'"
SEND_STRING 0,"'Getting DVD Details for DVD #', SelectedDVDID"
}
SEND_COMMAND dvTP01_4,"'PPON-','MMS Details'"
}
}
(* MAX IP Data Handler *)
DATA_EVENT[dvIPClient]
{
ONERROR:
{
SEND_STRING 0,"'Device ',DEV_TO_STRING(DATA.Device),':',GET_IP_ERROR(DATA.Number),13,10"
}
ONLINE:
{
maxiponline=1
}
OFFLINE:
{
maxiponline=0
SEND_STRING 0,"'MAX IP Connection dropped.'"
}
STRING:
{
send_command dvTP01_4, "'TEXT97-', Data.Text"
SEND_STRING 0,"'string: client=',Data.Text"
IP_CLIENT_CLOSE (dvIPClient.port)
}
}
________
buy extreme vaporizer
IP_CLIENT_OPEN requires a LONG and not a literal string for the server port parameter.
Try changing:
IP_CLIENT_OPEN(dvIPClient.Port,'192.168.254.30','8000',1)
To:
IP_CLIENT_OPEN(dvIPClient.Port,'192.168.254.30',8000,1)
Thank you so much for the quick fix! I changed the parameter type to a long from a string literal and it works fine. I felt bad about asking for help ( and wasting so much time ) on such a simple problem so I looked back at the documentation. I found the Netlinx documentation doesn't specify parameter types for the IP_Client_Open command. Curious... Even more curious is the fact that the compiler doesn't puke up a "type mismatch" error or warning.
Anyway, having gotten through that issue, I am now sending commands and receiving responses via IP from the MAX without using the module. This is probably just as basic a problem but it's absolutely killing me! The response the MAX is sending back is always {Error : 1} which means invalid parameter. I've tried command as basic as simply "Status" with the same result. I've tried all forms of carraige returns including $0D, 13 and \r with no luck.
If you could provide me with just a snippet of working code that shows a command being sent to the MAX (bypassing the module) and a response being captured, (doesn't matter which command) it would end my 3 day odyssey of trying to send a simple message back and forth. I accomplished this with Lasso (PHP like web script) in 5 minutes. I have 5 hours (at least) into doing the same thing in Netlinx. I'm quite frustrated with it. I'm glad AMX has put up these forums and I certainly appreciate folks like you that help out guys like me that only do half a dozen Netlinx projects a year while working daily in other languages.
Bill
Are you using the built in help file with Netlinx Studio? In your source code double click IP_CLIENT_OPEN to highlight it, press F1, and you?ll find your way to the syntax which includes the parameter types.
It sounds like you have 2-way comms satisfied which is the first step. You didn?t post your exact code but I think you may be using the wrong command for status. The DVD commands are at the bottom of the document. This is the string I used for status:
SEND_STRING dvMax,"'dvd status 1?,13?
Give that a whirl and see where it takes you.
I really appreciate the time you've taken to help me out so far. Unfortunately, I'm still getting only an {ERROR: 1} as a response. I know sometimes you have to insert a "handle" into some of the commands for the MAX which means adding an extra parameter such as "1|" prior to the first documented parameter. I have tried some commands with and without the extra handle and still the same. The thing that kills me is the commands work fine when coming from other languages. I just can't get it to return valid responses while using Netlinx. I'm sure it's something stupide I'm doing (or not doing ). It's just frustrating at this point.
Here is the event handler which all seems fine as I'm connecting and disconnecting, sending commands and receiving responses just fine. I'm just getting a persistent error message as a response to every command. Odd...
Here's the diagnostic output in which I am manipulating port 16 while port 4 is in use by the COMM module. I have also tried disabling the COMM module with no difference in the result:
Line 1 :: SendString to socket-local port (16) invalid - 22:10:24
Line 2 :: CIpEvent::OnError 0:16:3 - 22:10:24
Line 3 :: Device 0:16:3:IP ERROR (17): Local port not open$0D$0A - 22:10:24
Line 4 :: Connected Successfully - 22:10:26
Line 5 :: Memory Available = 21998776 <14508> - 22:10:26
Line 6 :: CIpEvent::OnLine 0:16:3 - 22:10:26
Line 7 :: Opening tcp port for Max - 22:10:26
Line 8 :: Getting DVD Details for DVD #1 - 22:10:26
Line 9 :: Connected Successfully - 22:10:27
Line 10 :: Memory Available = 21982936 <15840> - 22:10:27
Line 11 :: CIpEvent::OnLine 0:4:3 - 22:10:27
Line 12 :: Exiting TCP Read thread - closing this socket for local port 16 - 22:10:29
Line 13 :: string: client={ERROR: 1} - 22:10:29
Line 14 :: Closing IP port - 22:10:29
Line 15 :: CIpSocketMan::ProcessPLPacket - Socket Already Closed - 22:10:29
Line 16 :: CIpEvent::OffLine 0:16:3 - 22:10:29
Line 17 :: MAX IP Connection dropped. - 22:10:29
Line 18 :: CIpEvent::OnError 0:16:3 - 22:10:29
Line 19 :: Device 0:16:3:$0D$0A - 22:10:29
Line 20 :: Exiting TCP Read thread - closing this socket for local port 4 - 22:10:29
Line 21 :: CIpEvent::OffLine 0:4:3 - 22:10:29
Line 22 :: Connected Successfully - 22:10:31
Line 23 :: CIpEvent::OnLine 0:4:3 - 22:10:31
Line 24 :: Exiting TCP Read thread - closing this socket for local port 4 - 22:10:31
Line 25 :: CIpEvent::OffLine 0:4:3 - 22:10:31
Thanks for any advice you might offer. Thanks also for the tip on the help function. Again, my mistake. I read the help chapter on IP communications and it's within that chapter that no parameter types are given. They are certainly there if you search the help resource as you suggest.
I may want to add that I'm on MMS version 3.3.8 which is the latest version and the commands I'm sending work within the shell using the cmd program.
Thanks,
Bill
SEND_STRING dvIPClient.PORT,"'dvd status 1',13"
Should be:
SEND_STRING dvIPClient,"'dvd status 1',13"
Where is local port 16 coming from? And what Comm module is using port 4, the MAX COMM? As Dave mentioned earlier, you should either dump the AMX MAX COMM module and control it yourself or use the PASSTHRU command with the module ? not both.