You must have a newer version of the code wizard. The wizard I have only works with COM. I see PostMessage in the SDK I have, but the session object in the version 1.7 of the API doesn't have PostMessage, but a newer version 2.5 does. The sample that I am looking at in the SDK looks to be using SendMessage. Can you send me the version of the code wizard you have so I can take a look at that one?
The sample I am looking at is and has SendMessage.
Imports System.Threading
Imports Nimsoft.NimBUS
Imports Nimsoft.NimBUS.Messaging
Module APITest
Sub Main()
'Create a QoS
Dim qos As QoS = New QoS("QOS_TEST", false)
'Create definition
Dim definition As QoSDefinition = New QoSDefinition(qos.Name, "My Application Response", _
"QOS_APPLICATION", "milliseconds", "ms", qos.Async, false, true)
'Create a session for sending data
Dim session As NimbusSession = New NimbusSession()
'Keep session open
session.Connect(10)
'Send definition
Dim ret As PDS = session.SendMessage(definition)
If ret.CheckKey("nimid") = PdsType.PDS_PCH Then
Console.WriteLine("QoS definition sent, NimBUS ID = " + ret.GetString("nimid"))
End If
'MaxValue must be set when QoS is defined with hasMax == true
qos.MaxValue = 100
'Set source and target
qos.Source = "MySource"
qos.Target = "MyTarget"
'Set sample time and sample rate
qos.SampleTime = DateTime.UtcNow
qos.SampleRate = 1
'Set and send value
ret = session.SendMessage(qos.SetValue(3.14))
If ret.CheckKey("nimid") = PdsType.PDS_PCH Then
Console.WriteLine("QoS value sent, NimBUS ID = " + ret.GetString("nimid"))
End If
'Wait...
Thread.Sleep(1000)
'Set sample time
qos.SampleTime = DateTime.UtcNow
'Send value again
ret = session.SendMessage(qos)
If ret.CheckKey("nimid") = PdsType.PDS_PCH Then
Console.WriteLine("QoS value sent, NimBUS ID = " + ret.GetString("nimid"))
End If
'Wait...
Thread.Sleep(1000)
'Set sample time
qos.SampleTime = DateTime.UtcNow
'Send null value
ret = session.SendMessage(qos.SetNull())
If ret.CheckKey("nimid") = PdsType.PDS_PCH Then
Console.WriteLine("Null value sent, NimBUS ID = " + ret.GetString("nimid"))
End If
'Close session
session.Close()
End Sub
End Module