Did You Know? How to Set Initial Values in OmniServer

4 min read

Jun 1, 2017 2:00:00 PM


As you likely already know, OmniServer is primarily used to retrieve information from devices that use ‘non-standard’ protocols to communicate such as weight scales, barcode readers, and printers.

But were you aware that OmniServer, as part of that function, is capable of specifying a default initial value for data items on startup?  In this third post in our "OmniServer Did You Know?" blog series, keep reading to find out how to use initial values for your data items in OmniServer and under what situations that will be important.

So data items are arguably the second most important feature in the OmniServer. Sure, without messages we might not be able to communicate with the device at all, but without items any values we do get back from the device would never be able to make it to your client application and there wouldn't be a mechanism for your client application to send values to the device.

If you missed our second post on using character translations in OmniServer, get caught up here!

A significant, and widely underutilized, feature of the OmniServer is the ability to configure tags with initial values, that is – the value of the tag when the OmniServer is first started.

Why Would I Need To Do This?

There are many reasons why an initial value would be useful. The most common we run into are:

  1. Counters that need to be initialized to a specific value (usually 0) when the OmniServer starts.
  2. Devices that need to be initialized before normal communications can start.
  3. Systems where values should never be null or empty when sent to the device.

Realistically these are all conditions that can be scripted on the client side, but why add the extra complexity in your client application when configuring an initial value in the OmniServer is so easy.

How Can I Do This?

For discussion purposes, let’s use the example of a device that must be initialized with a format string before it will communicate normally with the OmniServer – maybe a barcode scanner that supports multiple output formats.

(For new users, if you'd like an introduction to using OmniServer, please click here.)

1.  First step would be to create the item that will hold the output format – in this case we are working with a string, and will call our item “Initial_Format”:

Screenshot - OmniServer Item General Properties

Please note: Although not covered specifically in this tutorial, make sure that the setting "Item should be automatically activated" is checked. Setting this option will tell OmniServer to process this item (and any message associated with it) once the connection is made by the client software. Without it, OmniServer will not automatically send out the Initial Value to the device.

2. Then, on the "Initial Value" tab, we will want to check that the "Item has an initial value" and specify what that value should be:

Screenshot - OmniServer Initial Value Item Settings

5.  Click the OK button to create or save the item. (And don't forget to save the protocol afterwards!)

With the initial value now successfully set, we only need a message to send it at startup. Let’s create a new Host message of Type = Write, that will handle the device initialization using our Initial Value.

The Request of our message should contain the Initial_Format item that was just configured:

Screenshot - OmniServer Example Write Message Format

And that's it.  That's all there is to it; because the item has an initial value and is set to auto-activate the message will automatically send out initial value to the device as soon as a client connects to the OmniServer and the Topic configured for this device.  Now that you can see how easy setting up an initial value is in OmniServer and implementing it, you can understand why it's far easier than scripting something in your client application.

Where can I get more information?

Do you have a protocol that you’re not really sure about?  As always, we're happy to help with a complimentary protocol review of your protocol documentation or to answer questions you may have.

Email us at support@softwaretoolbox.com with your questions and subscribe to our blog for more quick and easy OmniServer tutorials and tips.  Then, make sure to download the OmniServer trial to try it yourself for free.

 

Click to Download OmniServer Free Trial

Kevin Rutherford
Written by Kevin Rutherford

Software Toolbox Technical Blog

We're engineers like you, so this blog focuses on "How to" appnotes, videos, tech team tips, product update announcements, user case studies, and other technical updates.  Subscribe to updates below. Your feedback and questions on posts are always welcomed - just use the area at the bottom of any post.

Subscribe to our Blog

Recent Posts

Posts by Topic

See all