Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Oct 23, 2009

Simple Messaging Reference Library (STM) MSVC++ Client Reference Example

0 ratings | 0.00 out of 5
Print

Overview

The attached file contains a client implementation of STM in Microsoft Visual Studio 2005 and an example of its use. This example does not implement a server for STM connections, although much of the code can be re-used for a server implementation.

Table of Contents

  1. Requirements
  2. Contents
  3. Feedback

Downloads

Filename: stm_client_for_msvc_1_1.zip
Requirements: View

Requirements

This code requires the Simple Messaging Reference Library (STM).

The included LabVIEW server example requires LabVIEW 8.6 or higher.

The Visual C++ code was written in Microsoft Visual Studio 2005.  Much of the code can be converted to other MSVC++ versions with minimal effort.

Contents

The zip file contains the following:

VC++ STM Client Folder

This folder contains the VC++ STM implementation as well as an example of its use.  The following files are significant:

STMSession.h and STMSession.cpp

These files implement the STMSession Class, which implements the main STM communication.  This class is directly used to connect to the server, disconnect from the server, and send messages.  The class also provides messages via a STMDispatch object.

STMDispatch.h and STMDispatch.cpp

These files implement the STMDispatch Class, which provides notifications to the application when STM communication events occur.  To define handlers for these messages, inherit from this class and overload the associated functions.  This class allows you to receive notification of a successful connection, the loss of a connection, the receipt of meta data, the receipt of any data on the STM socket, the receipt of an STM message, a successfully transmitted message and/or a connection error.  To register for notifications, you should call the STMSession::SetDispatch function and pass an object of a class that inherits from STMDispatch.

STMConvert.h and STMConvert.cpp

These files provide a number of functions which help you to encode and decode data into a format acceptable by LabVIEW.  This is called flattening and unflattening.  Note that not all possible data types are implemented. If you need a data type that isn't available, use the provided functions as a guide and the refer to Flattened Data for the data format.

STMExample.h, STMExample.cpp, STMExampleDlg.h, and STMExampleDlg.cpp

These files implement an example of using STMSession and STMDispatch to communicate with an STM server.

LV Server Folder

This folder contains a LabVIEW server designed to communicate with the C++ example client.  The example is a CompactRIO system that acts as a server for multiple STM clients.  The cRIO streams analog waveforms from a cRIO module, scans digital inputs, updates digital outputs, and transfers a cluster of system status information.  This example is a good test for the C++ implementation as it uses multiple data types, arrays, and clusters in its STM messages.

Feedback

This reference application was created by the NI Systems Engineering group. 

We do not regularly monitor Reader Comments posted on this page.

Please submit your feedback in the Reference Design discussion forum so that we can improve this component for future applications. 

Please direct support questions to NI Technical Support.

Requirements


Filename: stm_client_for_msvc_1_1.zip

Software Requirements


Application Software: LabVIEW Professional Development System 8.6
Toolkits and Add-Ons: LabVIEW Real-Time Module 8.6
Language(s): Visual C++
Additional Software: Visual C++

Hardware Requirements


Hardware Group: CompactRIO
Driver: NI-RIO 3.1

 
0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).