Sanav GC-101 Installationshandbuch Seite 35

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 60
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 34
9.2) Raw Socket Based Device Communication Server
[Skills required: Java, TCP/UDP socket communication, multi-threading, bitwise manipulation, general client/server
protocols]
If your remote tracking device sends messages to the server using a socket-based communication protocol, then the
example 'template' server can be modified to parse received data and insert it into the SQL database. The sources for
the 'template' server can be found in the OpenGTS source directory "src/org/opengts/servers/template".
This server type runs as a separate process listening on a selected socket port for incoming TCP/UDP connections.
You will likely need to make some significant changes to the source code to support your particular device. It is
recommended that you copy the source files to an new directory (remember to change the Java package name), then
modify the copied sources with the specific changes required by your tracking device.
Here are some of the main attributes of the protocol that need to be determined before starting to implement a TCP/UDP
socket based device communication server:
Are the protocol packets transmitted in ASCII, Binary, or both?
How is the actual length of a client packet determined (this is extremely important)?
What are the various types and content of packets received from the client?
For binary packets, are integer fields encoded in Big-Endian or Little-Endian format?
What response packets, if any, is the client expecting to receive from the server?
The example 'template' server contains the following source modules:
Constants.java – This module constains most of the customized configurable options used to support your
specific remote device protocol. Such as timeouts, minimum/maximum packet lengths, ASCII/Binary encoding,
etc. The basic information regarding the type of protocol should be set in this module.
Main.java – This is the main entry point for the server and will not likely need to be modified.
TrackClientPacketHandler.java – The purpose of this module is to understands the specific characteristics
of the communication protocol for the remote device, and will require most of the significant customization
required to support your remote device. This is where incoming client packets are identified, data is parsed and
inserted into the tables, and any required responses are returned to the client device.
TrackServer.java – This is a wrapper/handler for a TCP/UDP session and delegates most control to the
TrackClientPacketHandler class.
This server environment/framework handles listening for incoming connections and multi-threading for you (this server
can handle multiple simultaneous incoming connections), as well as most error handling.
When using the example 'template' server as the basis for your own device communication server, it is recommended
that you copy the 'template' files into a new folder (and thus a new Java package) named after your chosen
tracking/telematic device (ie. such as "acme1000"). The "build.xml" file should also be modified to include a 'target'
for your chosen server name. To build the example 'template' server, the Ant target 'template' can be used as
follows:
> ant template
This 'template' target in 'build.xml' can be copied to create your own specific ant build target for your chosen device
communication server name.
Consult the 'template' server source code directly for additional customization information.
The server "icare" is also available (in the source directory "src/org/opengts/servers/icare/"), which supports
the ICare G3300 device. This device communication server module can also be examined for help in creating your own
customized device communication server.
OpenGTS Configuration and Installation Manual Page 35 of 60
Seitenansicht 34
1 2 ... 30 31 32 33 34 35 36 37 38 39 40 ... 59 60

Kommentare zu diesen Handbüchern

Keine Kommentare