Skip to main content
Skip table of contents

Remote Control - TCP Server (Network) - 23

Description

Driver can be used to command the Controller to start or stop logging and to shut down Qinsy.
With the Start logging command also the name of the recording database can be set. In addition, the driver will report an overall status which gives the status of logging and the IO status.
The driver can be used to communicate with an external controller, for instance on an AUV.
In the following description an AUV is used as the external controller.
The external part will act as a client that connects to the driver, which acts as a server.


Driver Information

DriverRemote Control - TCP Server (Network) Interface TypeTCPDriver Class TypeTerminated
UTC Driver (question)NoInput / OutputOutputExecutableDrvRemoteControlTcpServer.exe 
Related Systems
Related Pages

Format Description

Format
Binary format

Format Description

1. General Message Structure

All messages will consist of a uniform message structure comprising a 32 bytes header and a variable size message content.
In general all strings are ASCII/UTF-8 and are all null terminated, all non- used bytes like reserved space and non-use string parts will be "zero-memoried", that is filled with binary zero's.


This header is described below:

Message Header

#
Field
Type
byte count
Description
0QAUVchar[4]4Start Sequence (Always QAUV).
4Message Sizeunsigned integer4Size of the total message including this message header (counting from 'QUAV' to the last byte of the message).
If the content is zero the message size will be 32 bytes.
8Message IDunsigned short2ID of message ( See Message ID table)
10Message Version*unsigned short2Version number of Message (1 = initial version June 2013).
12UTC Time Stamp 1970 (whole sec)unsigned integer4UTC Time tag, whole seconds since1970.
16UTC Time Stamp 1970 (fraction)unsigned integer4UTC Time tag, seconds 1970 fraction in nanoseconds.
20Message Counter**unsigned integer4Message Counter, AUV and QINSy keep unique incrementing counters.
24Reservedchar[8]8Reserved space for future fields etc. (Filled with zero's.)

After this Header the variable size content follows, see below.

*) The version number is on message-level, not for the protocol. In the future if content of a message changes the version number of only that message will be incremented. If QINSy receives a message with a newer version number the message will be ignored.
**) The Message Counter is used to identify a message uniquely, it will increment after every message that is sent. Both sides (AUV and QINSy) keep their own counters. Counter value can be used in (future) reply messages to identify which command is replied upon. It can roll over to zero, that is OK.

Message Content

After the header a variable message content follows, consisting of N Bytes, with N = Message Size (as reported by header) - 32 (size of Header).

32Contentunsigned char[N]NMessage Specific Content (see below)

Note that the content may have a zero length, this can be the case for simple commands without a further message content.

The message contents of the individual messages are described below:

2. Message ID's

A message can be recognized by its ID. Find below an overview of the currently defined messages. In the future more messages will be added. Note that the Command Reply is not implemented for the initial version.

ID
Message Type
Direction
Description
1Start LoggingAUV -> QINSyCommand QINSy to start logging, optionally a name can be provided.
2Stop LoggingAUV -> QINSyCommand QINSy to end the current logging session.
3Overall StatusQINSy -> AUVReports logging status, i/o status etc.
4ShutdownAUV -> QINSy

Close QINSy and optionally shutdown the windows OS.

5Remote Driver CommandQINSy -> AUVSend a command to hardware interfaced to QINSy
1000Command ReplyBoth(FUTURE/Not implemented for initial version) can be used to confirm (or deny) a command.

3. Messages

This chapter describes the messages in detail. Note that each message contains a header as described above.

Start Recording (ID 1)

The AUV control software can order QINSy to start logging. Naming details may optionally be provided. Direction is from AUV to QINSy. If QINSy is already recording the command will be ignored.

#
Field
Type
byte count
Description
0HeaderHeader (see Table 1)32General Header
32Name Modeunsigned char1See Table Below
33Descriptorchar[128] UTF-8/ASCII null terminated128Database name


Name Mode:

Value
Description
0Ignore Descriptor details, start recording with the current naming convention as defined in QINSy.
1Use provided Descriptor as part of the database name and start recording.

Stop Recording (ID 2)

The AUV control software can order Qinsy to stop logging. Direction is from AUV to QINSy. If Qinsy is not recording the command will be ignored.

#
Field
Type
byte count
Description
0HeaderHeader (see Table 1)32General Header

Overall Status (ID 3)

Qinsy sends an overall status to the AUV computer. This is done every regular interval as defined by the user in the Database Setup program.

#
Field
Type
byte count
Description
0HeaderHeader (see Table 1)32General Header
32I/O  Error Statusunsigned integer4

Flags per system Category (0 = no error, 1 = error)
See table below for bit layout.

36Recording Flagchar1Not Recording (0), Recording (1)
37Recording File Counterunsigned integer4Number of Databases written since start-up of Qinsy, starts at zero on startup of Qinsy.
41Free Disk Sizeunsigned integer4Free disk space in Mega Bytes.
45Current Database Namechar[256] UTF-8/ASCII null terminated256The name of the current logging or, if not recording, of the upcoming database name.

I/O Error Status Table

This reports whether data is being properly decoded in Qinsy for a certain system category:

Bit
Description
0I/O status Positioning Systems
1I/O status Gyro Compasses
2

I/O status Pitch,Roll & Heave Sensors

3I/O status Sonars (SBE,MBE,SSS)
4I/O status PPS/Time Sync
5I/O status Other*

*) Other means any other observation that is not part of the specific categories.

Shutdown (ID 4)

The AUV control software can order Qinsy to shut down itself and optionally to shut down the OS. If recording is active then that will be stopped.
It can not be guaranteed that the Windows OS is actually shutting down although Qinsy will issue the correct API call.

#
Field
Type
byte count
Description
0HeaderHeader (see Table 1)32General Header
32unsigned charShutdown Mode1See Table Below

Shutdown Mode

Value
Description
0Shutdown Qinsy only
1Shutdown Qinsy & Windows OS

Command Reply (ID 1000)

Currently not implemented!!! For future reference.

#
Field
Type
byte count
Description
0HeaderHeader (see Table 1)32General Header
32Replyunsigned char10 = Denied, 1 = Confirmed
33Message IDunsigned short2Original message that is replied upon
35Message Counterunsigned integer4Original message counter that is replied upon
39Error Codeunsigned integer4In case an error is returned this value will be NON-ZERO. In the future a table with error codes will be added.

Driver Command (ID 5)

Multiple driver commands can be sent to the Qinsy at once. Therefore, at top level, the driver command is an aggregation of multiple driver commands:

#
Field
Type
byte count
Description
0HeaderHeader (see Table 1)32General Header
32Driver command 1Driver commandX
32 + XDriver command 1Driver commandY
32 + X + Y + ...Driver command N



Each individual driver command consists of a command header (which's layout is equal for all driver command types) and the command's payload

Individual driver command header

#
Field
Type
byte count
Description
0Driver command IDInteger4 The command to send to the driver as described in table
4Size of commandInteger4The total size of the driver command including header. If the payload of the command is one byte, this field will have value 141
8Subsystem IDInteger4

In some cases, a command should be sent to a specific subsystem of a system (for example, to distinguish between the HF and LF parts of a sidescan system when setting range).

In those cases, this field is used to select the proper subsystem for the command. In other cases, this field will be ignored. 

12System ID LengthInteger4The length of the System ID string to follow
16System IDChar[N]NThe ID of the system to send the command to as entered in the database setup utility. Note that this name should only contain ASCII characters
16+NCommand payloadByte[M]MThe payload of the command.


Driver commands
Set range
Command value0
DescriptionSet the system's range in meters.
Payload typeInteger
Payload size (bytes)4
Payload valuesThe range in meters
Set ping mode
Command value1
DescriptionStart or stop the system pinging
Payload typeInteger
Payload size (bytes)4
Payload values0Pinging off
1Pinging on
Set system recording mode
Command value2
Description

Set the system's external recording mode.

Some systems have a built-in mechanism to record data (for instance on an internal disk drive, or on a network drive). This command can be used to start or stop the device recording.

Payload typeInteger
Payload size (bytes)4
Payload values0Recording off
1Recording on


Set trigger mode
Command value3
DescriptionSet the trigger mode of the system
Payload typeInteger
Payload size (bytes)4
Payload values0Free running
1External trigger
2Manual trigger


Python Snippet

1. Python snippet for start and stop logging

# coding: utf-8

import binascii
import socket
import struct
import sys
import time

# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10000)
sock.connect(server_address)


#Start logging
counter = 101
seconds_epoch = int(time.time())
fraction_epoch = int((time.time())*1000 - (int(time.time())*1000))
values = (bytes("QAUV" , 'utf-8'), 161 , 1 , 1 , seconds_epoch, fraction_epoch, counter , 1 , bytes("Hello Testname" , 'utf-8'))
packer = struct.Struct('4s I H H I I I 8x ? 128s')
packed_data = packer.pack(*values)

# Send start logging
print (sys.stderr, 'sending start "%s"' % packed_data , values , len(packed_data))
sock.sendall(packed_data)


#Stop logging
counter = 102
values = (bytes("QAUV" , 'utf-8'), 32 , 2 , 1 , seconds_epoch, fraction_epoch, counter )
packer = struct.Struct('4s I H H I I I 8x')
packed_data = packer.pack(*values)

# Send stop logging
print (sys.stderr, 'sending stop "%s"' % packed_data , values , len(packed_data))
sock.sendall(packed_data)


# closing socket
print (sys.stderr, 'closing socket')
sock.close()


Database Setup

Set up a Miscellaneous system. It is not necessary to define any generic observations for correct operation.
However, for monitoring the sending and receiving of messages it is possible to add observations that indicate the number of messages sent and received.
To do this, add two observations and use the slot numbers RCVD_COUNT and SEND_COUNT.
The update rate for the driver can be set. If left at default (0) then the update rate will be once every 5 seconds.


Online

In the Controller make sure that in the Session Setup for the database File setup the 'Use formatting' is disabled. 
This Session Setup is found under the Settings menu. In the Session Setup the formatting can be found under Storage/ Database.

The IO status will be healthy until a certain age. The default age for Positioning, Heading, Sonar, Timesync and Other is 5 seconds. 
For attitude this is 1 second. The age settings are stored in the registry.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.