Ethernet State Server

From DDUtil

Jump to: navigation, search

Using the RIOX application library[1], a serialized data object of radio state information is provided via a TCP/IP State Server in DDUtil so programmers can build their own applications if desired.

This is a special version of the State Server available for programmers who would like to use the Radio State Values in their own program without their program having to poll the radio. This is MUCH more efficient than than using the traditional polling method. Look Ma no serial ports.

Contents

Features

  • Subscribe to only the radio states you want without having to continually poll the radio for values.
  • State values are updated to your program as they happen with a pushed backup of all values every nn ms.
  • Ability to send CAT Commands to PSDR or Macro commands to DDUtil from your program.

Server Commands

The following Server Commands are recognized By DDUtil when sent from the client. These commands must be properly formed as follows:

_client.SendCommand(new RIOXCommand("command", "data"));

Note: - See example program for Server Commands implementation code.

ClientCmd

Sends properly formed PSDR CAT and DDUtil Macro commands from the client program to the server.

PSDR CAT Commands

Form: Server Command + (Cat Command + Value + Terminator (;) [no spaces])
Example: _client.SendCommand(new RIOXCommand("ClientCmd", "ZZFA00014123456;"));
(Sets VFO A to 14,123.456 mHz.)

DDUtil Macro Commands

Form: Server Command + (DDUtil Command + Value + Terminator (;) [no spaces])
Example: _client.SendCommand(new RIOXCommand("ClientCmd", "DDSP123;"));
(Turns the rotor to heading 123 degrees)

Sub

Subscribe to get state values from the server (DDUtil).

  • Commands may be entered individually or strung together as shown in the example below.
  • Commands may be entered at any time.
  • See the UpDateType command below for how the state values are updated.
Example: _client.SendCommand(new RIOXCommand("Sub", "ZZFA;ZZFB;ZZMD;ZZPC;")); 
(Subscribes to VFO A freq, VFO B freq, VFO A Mode, Drive power)

UnSub

Un-Subscribe from all state variables.

Example: _client.SendCommand(new RIOXCommand("UnSub", "none"));

Up Date Interval

Updates are sent to the client(s) as they happen with a pushed (backup) update of all values every nn ms. This assures all data is refreshed on a regular schedule in case of a system glitch or some other type of oops happens when the value(s) were actually change.

It is up to the programmer to decide what this interval should be. When first started the server defaults to an update period of five (5) seconds so the CAT command values can be entered into DDUtil and get active in the data object. My preference is to change to a 15 second update after that, but you can use any period you want.

Example: _client.SendCommand(new RIOXCommand("UpDateType","PSH:15000"));

Using the Server

Using the Sample program as a guide, these are the basic steps to program your application to use the TCP State Server.

Note: Requires DDUtil v2.0.2.09 or later for full functionality.

RIOXclient20209.jpg

Demo Client Code

The sample application (shown above) is written in VS2008 C# and shows how to use the RIOX library and DDUtil as a TCP/IP Server to receive radio status values. Everything should be pretty well self explanatory I think. Sorry, but I can't furnish information for converting to other languages.

There is no reasonable limit to the number of client apps that can be serviced at one time by the TCP/IP State Server. Ten (10) clients have been tested running at once without any noticeable performance degradation.

Start-up

  • Declare instance variables.
  • Setup Events and Methods to service your app.
    • Connect to the server (DDUtil).
    • Subscribe to only the CAT commands you need.
    • Set the Update interval desired (ms).
    • Send other Client commands to the server as needed.

Notes

  • Allow time for the server to connect (>= 2 seconds) before subscribing to CAT commands or sending any additional Client Server commands.
  • The RIOX Update type is set by the server (DDUtil) and defaults to the Pushed method. This is not selectable by the client, only the interval.
  • All clients share the same RIOXData object. Meaning the data object will have an aggregate of all the commands subscribed to by all the clients. Only use the ones your client app has subscribed to and ignore any others.

References

  1. The RIOX open source (GPL) library was written by David McKenzie (K1FSY).
Personal tools
Developers