Siteplayer Telnet
ryanww
Posts: 196
Hello all,
I saw a few people have some of these boxes so I decided to get a couple. I have been trying in two different locations with two different NI boxes, and have been unable to get them to successfully pass data from the serial port to the netlinx controller. I have been able to open a telnet session on port 23 with both of them and pass data back and forth just using windows prompt and the serial device. But when I open the connection using an NI, no data makes it in or out. My NI says after I connect the device that it goes online without error. I have also included some html archives of the config pages of the box. Hopefully that workes.. The box is set to DHCP but I did make sure it was properly connected.
Here is my code just to confirm that it is set up right:
define device
dvnetbox = 0:2:0
dvserial1 = 5001:1:0
define start
IP_CLIENT_OPEN(dvNetBox.PORT,'192.168.0.195',23,IP_TCP)
button_event
DATA_EVENT [dvNetBox]
{
OFFLINE:
{
IP_CLIENT_OPEN(dvNetBox.PORT,'192.168.0.195',23,IP_TCP)
OFF [dvRelays,1]
}
ONLINE:
{
ON [dvRelays,1]
}
STRING:
{
IF (FIND_STRING(DATA.TEXT,'hello',1))
{
SEND_STRING dvNetBox,"'hi'"
}
IF (FIND_STRING(DATA.TEXT,'yo',1))
{
pulse [dvRelays,2]
pulse [dvRelays,3]
pulse [dvRelays,4]
}
}
}
I saw a few people have some of these boxes so I decided to get a couple. I have been trying in two different locations with two different NI boxes, and have been unable to get them to successfully pass data from the serial port to the netlinx controller. I have been able to open a telnet session on port 23 with both of them and pass data back and forth just using windows prompt and the serial device. But when I open the connection using an NI, no data makes it in or out. My NI says after I connect the device that it goes online without error. I have also included some html archives of the config pages of the box. Hopefully that workes.. The box is set to DHCP but I did make sure it was properly connected.
Here is my code just to confirm that it is set up right:
define device
dvnetbox = 0:2:0
dvserial1 = 5001:1:0
define start
IP_CLIENT_OPEN(dvNetBox.PORT,'192.168.0.195',23,IP_TCP)
button_event
DATA_EVENT [dvNetBox]
{
OFFLINE:
{
IP_CLIENT_OPEN(dvNetBox.PORT,'192.168.0.195',23,IP_TCP)
OFF [dvRelays,1]
}
ONLINE:
{
ON [dvRelays,1]
}
STRING:
{
IF (FIND_STRING(DATA.TEXT,'hello',1))
{
SEND_STRING dvNetBox,"'hi'"
}
IF (FIND_STRING(DATA.TEXT,'yo',1))
{
pulse [dvRelays,2]
pulse [dvRelays,3]
pulse [dvRelays,4]
}
}
}
0
Comments
I have one of these set up right now and it appears to be working fine. I am using a serial port on my laptop as the remote rs232 device and successfully passing strings from the rs232 terminal program on the laptop to the NI700 IP connection and back.
A couple things.
You can access the site player web server and look at the telnet configuration page. If you are connected, it will show the IP address of the IP device that has made the connection. When I do this, I see the IP address of my NI700. Also see that the site player is in server mode.
The site player is only capable of handling one IP client at a time, so make sure that you don't have a computer logged in. Probably you don't, because I believe you would then get a connection refused message.
You don't say what you are using for a RS232 device. Perhaps you are using an RS232 port on the same NI, I don't know. If so, don't forget about the famous 'RXON' trap.
Depending on what you are using as an RS232 device, your string may or may not be getting to your NI in one piece. In your string handler you are looking for a string in data.device, but data.device refreshes and if you are using a terminal program for rs232, your 'hello' may be getting sent one letter at a time.
Try something like:
You can flush the buffer when you get your 'hello' string.
I haven't examined your code carefully, but it looks ok except for the stray button event which, I am guessing, is a typo and that your actual code has "define_event". If you play a little more with the device and still can't get it to work, I'll be happy to work up a brief little test jig program for you to try. If that doesn't work, the netmedia folks run a siteplayer telnet help forum. It doesn't get much traffic, but, amazingly, they seem to address issues pretty quickly and the guys who answer seem to have a very detailed understanding of the workings of the gizmo. Not a position staffed by a new hire. You can see the "forum" button on the netmedia site player website.
Also, You have a reconnect message running as soon as your device is detected as offline. If this reconnect fails, there doesn't seem to be any method to try to reconnect again
the code posted is a little of my typing and a couple lines copy and pasted.. its not the whole thing.. just mainly to make sure my IP_CLIENT_OPEN was correct. I have a line to re open the box if it disconnects, but since I have been taking it on and off line via a virtual device for testing I took that out. I will check the RXON again, but I am pretty sure I tried that already.
Now if I control the serial port and type in like 'test' and send it to the telnet box using a serial cable, I see it in a windows terminal window. But if I send it when the master is connected, nothing is received. I never see it in the notifications window. Even if that deice is set to show notifications. I just made a PDF instead so you can check the settings just to make sure something isn't wrong on the box itself.
Thanks,
Ryan
Site Player set up with permanent IP address, proper mask etc. Serial port on SP set up 38400,N,8,1.
serial port on NI700 set up as 38400,N,8,1 in data_event online section.
NI700 serial port connected with null cable (2,3,& 5 only) to the Site Player.
with device notifications, you don't see traffic to and from the IP connection (0:2:0), only the RS232 port. Also, I can't get 0:2:0 to send a string from a telnet session. That is, if I telnet from my laptop to the NI700, send_string 0:2:0,'whatever' doesn't seem to do anything. So, I can't see strings to 0:2:0 in Netlinx Studio device notifications so I set up a buffer as discussed before and look at that buffer with NS debug. -- I then see what comes through the Site Player to the NI700 via IP in debug.
As I said, everything works. From the Telnet session between the Laptop and the NI700 I type:
send_string dvSerialPort, "'xyzzy',13,10"
and in NS notifications window, I see that the string goes 'to' the serial port. Then I see the sent string appear in the buffer that gets the strings recieved by 0:2:0. The code for 0:2:0 is set to clear the buffer and respond to 'xyzzy' with 'plugh', and it does this and I see the string 'plugh' come back to the serial port in notifications and the string handler for the serial port receives the string and properly populates a buffer that I can see in debug.
I'm attaching a file that works for me. Just rename from .txt to .axs
I forgot about the buffering.. that makes sense..
Thanks for the help.. I just wanted to make sure I had the box all set up properly and such.
Ryan