NetAcquire Corporation Logo Image Image Image Image Image Image Image Image
NetAcquire Corporation Logo Home Search Products News Services Careers Support Contact

NetAcquire Publish/Subscribe Visual Basic Example

Remote temperature data acquisition 

Publisher and Subscriber Hardware Diagram


Private Sub cmbRun_Click()
  Dim NAPSConnection As Long
  Dim NAPSSubscription As Long
  Dim temperature As Double
  NAPSConnection = naps_open("na1")
  NAPSSubscription = naps_subscribe(NAPSConnection, "reactor_temperature")

  Err = naps_as_real64(NAPSSubscription, temperature)
  Debug.Print "Reactor temperature: " + CStr(temperature)

  naps_close (NAPSSubscription)
  naps_close (NAPSConnection)
End Sub

The above cmbRun_Click() Subroutine will be invoked when the Run button on the main form is clicked. First, it declares two variables to represent a data publisher and a specific data subscription, respectively. The third variable is used to store the subscription's value. The first executable line opens a connection to the data publisher named "na1". The next line creates an object that represents a specific data subscription. Subscriptions can be given convenient names on the NetAcquire server; in this case the subscription represents an analog voltage from a reactor temperature sensor. Once a subscription is created, the current value of the subscription can be displayed at any time, as illustrated in the Debug.Print statement. In the example, the value of the subscription is retrieved using an accessor that returns a 64 bit real value in the parameter. Accessors with different return types are also available, integers of width 8, 16, and 32 bits, as well as 32 and 64 bit floating point types are supported. The application can also query the subscription for the most appropriate data type.


Home | Search | Products | News | Services | Careers | Support | Contact | Telemetry | Range/Radar | Avionics
Aerospace Test | Communication | Remote Monitoring | Industrial Automation | Extreme | Protocol Conversion
Simulation | Hardware Overview | Analog I/O | Digital I/O | GPIB/IEEE 488 | SpaceWire | FPGA
Source Selection
| High Availability | Software Overview | WWW | Storage | Publish/Subscribe
Java | Windows | Data Flow | Time | Extensions | Decom | CCSDS | Mux/Demux | Demos



Last modified 12/2/2016
Copyright 1996 - 2016
NetAcquire Corporation
All rights reserved.
webmaster@netacquire.com