NI-3100 + TCP/IP Client
astahov.telesen
Posts: 8
Hello everyone,
I have some troubles with connection to TCP/IP Client by NI-3100.
The aim is to control IP-Camera (Pansonic AW-HE50SE) by sending telenet-string through NI-3100.
NI-3100's IP : 192.168.0.81
Panasonic's IP: 192.168.0.247
1. First of all I established connection with NI-3100 by Ethernet.
2. Secondly, I added this code into standart NetLinx Source File:
But when I send command
the telnet responce is:
The data-indicator on controller shows only INPUT data, but not OUTPUT.
Hope you can help me to find the solution of this problem.
I have some troubles with connection to TCP/IP Client by NI-3100.
The aim is to control IP-Camera (Pansonic AW-HE50SE) by sending telenet-string through NI-3100.
NI-3100's IP : 192.168.0.81
Panasonic's IP: 192.168.0.247
1. First of all I established connection with NI-3100 by Ethernet.
2. Secondly, I added this code into standart NetLinx Source File:
DEFINE_DEVICE dvPAN = 0:3:0 ~~~~~ DEFINE_START IP_CLIENT_OPEN(3,'192.168.0.247',80,IP_TCP)3. Thirdly, I compiled workspace, built Project and System, and transfered two files (*.tkn and *.src) to NI-3100.
But when I send command
send_string dvPAN, "'%command%'"
the telnet responce is:
Device Name dvPAN is invalid
The data-indicator on controller shows only INPUT data, but not OUTPUT.
Hope you can help me to find the solution of this problem.
0
Comments
Are you s?re your connection is open?
Use data-event online/offline to confirm it.
DATA_EVENT[dvIPDevice]
{
ONLINE:
{
SEND_STRING 0, 'IP Device ON-LINE'
WAIT 100
{
<things to do when device comes on line>
}
}
OFFLINE:
{
SEND_STRING 0, 'IP Device OFF-LINE'
}
ONERROR:
{
SEND_STRING 0, 'IP Device ERROR'
SEND_STRING 0, "ITOA(DATA.NUMBER)"
<IP_CLIENT_OPEN can run here to reestablish comm>
}
}
Then you can get an idea what is happening.
IP_CLIENT_OPEN(3,'192.168.0.247',80,IP_TCP)
I've never used a wait before sending once getting the online notification, with http you usually have 30 seconds before the server will drop the connection so a 10 second wait should be alright just not nescassary. I'd get rid of it since the quicker you send the sooner you can send your next command and 10 seconds is a long time to hold things up.
That wait was to "do other things" after the device comes online. This was a device specific thing I just left in my generic example.
I will check it in 5 mins.
It would be great! Can you send me link or archive/file in PM?
Also, you can share it here, but I don't know is it allowed or not.
I tried that:
But after master reboot there is nothing in Diagnostic and Notifications dialogs.
Where should this messages (SEND_STRING) be showed?
That's all. So there is nothing about the message we send.
Should IP-Device be showed in tree-list?
So in your diagnostic print out you should have seen your send_string 0 if you have one in your onerror handler and if your did you would see the error number and that would help to know what the problem is. Verify the camera port, IP and it's protocol, TCP or UDP. Also you should move the IP_CLIENT_OPEN out of define start and and put it under a button push or something so you can fire it when you're ready to observe the diagnostics.
No, your IP devices won't show up in the tree, only AMX devices.
First I will create a CALL:
DEFINE_START
DEFINE_CALL 'dvPan_Start'
{
SEND_STRING 0,'dvPan_Start CALLED'
{
IP_CLIENT_OPEN(dvPan.port,'192.168.0.247',80,IP_TCP)
}
}
Then you can use this when master comes online to start communications and in an error event or button event to restart communications
DEFINE_EVENT
DATA_EVENT [dvMASTER]
{
ONLINE:
{
WAIT 100
CALL 'dvPan_Start'
}
}
Plus this will give you time to get through lots of the master booting messages.
In this instance I think the OP should make some global variable for all his values and in a button push or even after a flag variable in define_program call his IP_CLIEN_OPEN so he can change the parameters on the fly. Port number, IP address, UPD/TCP and then in the debug window change the variables and then set his flag making sure that he immediately 0's that flag. In diagnostics watch what happens. Posting a link to the camera's api might help too so we can take a gander for ourselves.
Yeap, it would be great!
Also, I connected all the devices to another NI-3100. And that's it. Everything is working. Thank you!
There are some problems with first NI-3100, maybe.
In TP4 I noticed that there is a function called "Recieve from Panel". What does it mean? So can I recieve the compiled project and recover it?
Also, I have an old compiled project in NetLinx. Can I recover old project from NI-3100 without source code?
Thank you
Well, you can recover them in the sense that you can save the file and reinstall it if need be. But, without source, you cannot open/modify it in Netlinx Studio.
That's 2...
1. Yes. As the onboard HELP in TPDesign will explain. You connect to the panel, click that button, and pick the filename and location. And the result is completely editable.
2. As Eric says, all you can get is what's in it... if there is no source code loaded in the NI, you can only get the TKN for reuse, not editable.
To get the TKN, you can't use typical FTP clients, as the stored program "prog.tkn' is in a hidden folder.
Open a command (DOS) window... here's a session: YOUR INPUT IS BOLD and explanation is in green italic (don't type the explanation into the session!)
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\John.Junior>ftp 192.168.1.201 [you type ftp and the IP of the NetLinx]
Connected to 192.168.1.201.
220 VxWorks (VxWorks 6.3) FTP server ready
User (192.168.1.201 : (none)): administrator [user and password of the NI. Default is "administrator" and "password"]
331 Password required
Password: [password does not echo]
230 User logged in
ftp> binary [set mode by typing "binary"]
200 Type set to I, binary mode
ftp> get ../prog.tkn d:/extractedcode.tkn [this is the meat. Choose the location to write the file, here, on the root of D]
200 Port set okay
150 Opening BINARY mode data connection [it can take a minute here... be patient]
226 Transfer complete
ftp: 13874097 bytes received in 6.83Seconds 2032.54Kbytes/sec.
ftp> quit [and.... we're out.]
221 Bye...see you later
C:\Users\John.Junior>
As mentioned earlier, HTTP (port 80) should only be opened and closed with each command.
But if you are after TELNET, you can open and maintain the port (in theory).
Anyway, just my two cents. I keep seeing TELNET discussed, but port 80 is not TELNET.
Lastly, this - ///
'the telnet responce is:
Code:
Device Name dvPAN is invalid
///
Does not make much sense. The receiving device should never see the text 'dvPAN' (and it certainly can't if you're trying the wrong port).
The text 'dvPAN' is local to the program in Netlinx only. It never gets transmitted (unless it's part of you %command% variable).
Therefore, it has to be Netlinx reporting that error, which would mean the reference (dvPAN) is incorrect.
Bottomline, get on the right port first.. change 80 to 23 if TELNET is what you really want. But if it's HTTP on port 80 that you need, you have a bigger fish to fry.