PDA

View Full Version : QTcpSocket help



Pvr
2nd November 2018, 18:32
hai all,

I have a Pan Tilt unit which is connected to a Laptop using ethernet port. Iam using QTcpSocket to connect to this device and it is getting connected. But when I am passing commands to Pan or Tilt the camera unit it is not responding. What will be the reason for this? Anyone has done this type of socket programming. Here server is this device.
thanks in advance.

PVR

ChrisW67
4th November 2018, 05:54
What will be the reason for this?
Commands are not reaching the other end, commands are invalid, you are not receiving the response correctly, the remote device does not send a response... I am not sure what you expect us to do here. We have no idea what your code is doing. Perhaps if you showed what you had tried it would be obvious.

Oh yes. Please stop opening new threads on the same topic. You already have this one and this and this.

Pvr
5th November 2018, 07:27
hai..

My aim is to move the camera (azhimuth and elevation) which is mounted over the pan tilt unit. If I have to move the unit 20 degree azhimuth, the command should be AP2000.
When connecting with QTcpSocket it shows connected, but after that no response. No idea about the device is receiving command.

QTcpSocket *qtcp=new QTcpSocket(this);
qtcp.connectToHost("192.168.1.41",80)// device ip
if(qtcp.waitforConnected())
{
qDebug()<<"connected");
qtcp.write("AP2000\n");
}

PVR

d_stranz
5th November 2018, 17:30
the command should be AP2000.

The device requires no setup? No commands sent for configuration, no handshaking, no nothing else before it gets a command to move?

Since no one here has a clue about your hardware or how to use it, it might be better for you to consult the maufacturer's documentation or web site for information about how to program for this device and maybe see an example program for it.

Your question really has nothing to do with Qt other than the fact that you are using Qt sockets.

Pvr
5th November 2018, 19:35
Thank u very much for the reply. The manufacturer used labview to operate this unit. But we want to control this unit from the GUI of qt.

d_stranz
5th November 2018, 21:25
The manufacturer used labview to operate this unit.

You should be able to read the commands issued via TCP in the LabView program and follow the same sequence using TCP in a Qt program.

The problem is not Qt, it is the commands you send to the device and the syntax they use. Surely the manufacturer has a manual for this device that explains how to control it.

But you have all of us guessing in the dark. You haven't told us anything about this device except that it is a "Pan Tilt unit". Who makes it? What model is it? What is the link to the manufacturer's web site?