by John Thatcher (Link America Corperation) (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 8th October 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Send and receive messages using Qualcomm API and RIWeb Client
Dim iErr As Long
Dim csGMH As String
Dim csReasonCode As String
Dim csStatus As String
Dim csTimeStamp As String
Dim iRecipientCount As Integer
Dim oCreateMessage As CreateMessage
Dim sDestination As String
sDestination = "aabbcc" ' The Unit ID as setup on the website
Set oCreateMessage = New CreateMessage
' ------------- Set message options -------------
oCreateMessage.IsStandardAPI = False
oCreateMessage.EntitySenderID = "INTGQT" ' Must Always be INTGQT as per documentation
oCreateMessage.AddDestEntityID (sDestination) ' Unit ID
oCreateMessage.EntitySenderType = "A" ' A = Application; V = Vehicle
oCreateMessage.MacroNumber = 0
oCreateMessage.MacroVersion = 0
oCreateMessage.Priority = 0
oCreateMessage.ReplyToDesignator = "*PERSONAL"
oCreateMessage.ReturnReceipt = False
oCreateMessage.SourceAppName = "INTGQT"
oCreateMessage.TimesToTransmit = 0
oCreateMessage.WordWrapEnabled = False
oCreateMessage.MessageType = "T"
oCreateMessage.MessageBody = "Unit aabbccFrom VB" ' Any message
oCreateMessage.CompanyID = sQualcommCompany ' NMC Account number
' ------------------------------------------------
' ------- Send Message and get return data -------
iErr = oCreateMessage.Execute()
csGMH = oCreateMessage.GlobalMessageHandle
csStatus = oCreateMessage.Status
csReasonCode = oCreateMessage.ReasonCode
iRecipientCount = oCreateMessage.RecipientCount
csTimeStamp = oCreateMessage.TimeStamp
' ------------------------------------------------
End Sub
Public Sub CheckMessages()
Dim oTxnMgr As RiTxnMgr
Dim eTxnType As RiTxnTypeEnum
Dim oTxnAck702 As RiTxnAck702
Dim oTxnAck703 As RiTxnAck703
Dim oTxnBin705 As RiTxnBin705
Dim oTxnMsg600 As RiTxnMsg600
Dim oTxnPos614 As RiTxnPos614
Dim oTxnAck602 As RiTxnAck602
Dim oTxnAck603 As RiTxnAck603
Dim oTxnMsg700 As RiTxnMsg700
Dim oTxnPos714 As RiTxnPos714
Dim oTxnMacAck710 As RiTxnMacAck710
Dim iCount As Long
Set oTxnMgr = CreateObject("RiClientTxn.RiTxnMgr")
oTxnMgr.Initialize ("INTGQT")
iCount = 0
Do Until iCount = 1000
eTxnType = oTxnMgr.GetNextTxnType()
If eTxnType = 1000 Then
Exit Sub
End If
Select Case eTxnType
Case RI_TXN_700
' This is the reply/New message from the truck
Set oTxnMsg700 = oTxnMgr.Next()
debug.print Trim(oTxnMsg700.Company)
debug.print Trim(oTxnMsg700.EnabledMctFeatures)
debug.print Trim(oTxnMsg700.EntityId)
debug.print Trim(oTxnMsg700.EntityType)
debug.print Trim(oTxnMsg700.ForwardGmh)
debug.print Trim(oTxnMsg700.GMH)
debug.print Trim(oTxnMsg700.MacroNumber)
debug.print Trim(oTxnMsg700.MacroVersion)
debug.print Trim(oTxnMsg700.MctFirmwareVersion)
debug.print Trim(oTxnMsg700.MsgBody)
debug.print Trim(oTxnMsg700.MsgLength)
debug.print Trim(oTxnMsg700.MsgPriority)
debug.print Trim(oTxnMsg700.MsgTime)))
debug.print Trim(oTxnMsg700.QmassCopy)
debug.print Trim(oTxnMsg700.QmassOwnerAuxId)
debug.print Trim(oTxnMsg700.QmassReturnAuxId)
debug.print Trim(oTxnMsg700.TripStatus)
debug.print Trim(oTxnMsg700.EntityId)
Set oTxnMsg700 = Nothing
Case RI_TXN_702
' Confirmation of messages
Set oTxnAck702 = oTxnMgr.Next()
Set oTxnAck702 = Nothing
Case RI_TXN_703
Set oTxnAck703 = oTxnMgr.Next()
Set oTxnAck703 = Nothing
Case RI_TXN_705
Set oTxnBin705 = oTxnMgr.Next()
Set oTxnBin705 = Nothing
Case RI_TXN_710
Set oTxnMacAck710 = oTxnMgr.Next()
Set oTxnMacAck710 = Nothing
Case RI_TXN_714
' This is truck status information sent automatically when truck replies to or sends a new message
' It is a vehicle position transaction
Set oTxnPos714 = oTxnMgr.Next()
debug.print Trim(oTxnPos714.Company)
debug.print (oTxnPos714.cQmsQwn)
debug.print Trim(oTxnPos714.direction)
debug.print Trim(oTxnPos714.DirectionToPlace)
debug.print Trim(oTxnPos714.DistanceToPlace)
debug.print Trim(oTxnPos714.DistanceUnits)
debug.print Trim(oTxnPos714.EntityId)
debug.print Trim(oTxnPos714.EntityType)
debug.print Trim(oTxnPos714.GMH)
debug.print Trim(oTxnPos714.HMN)
debug.print Trim(oTxnPos714.Ignition)
debug.print Trim(oTxnPos714.MacroNumber)
debug.print Trim(oTxnPos714.MacroVersion)
debug.print Trim(oTxnPos714.Mct)
debug.print Trim(oTxnPos714.MsgType)
debug.print Trim(oTxnPos714.PlaceAlias)
debug.print Trim(oTxnPos714.PlaceCity)
debug.print Trim(oTxnPos714.PlaceID)
debug.print Trim(oTxnPos714.PlaceName)
debug.print Trim(oTxnPos714.PlacePostalCode)
debug.print Trim(oTxnPos714.PlaceState)
debug.print Trim(oTxnPos714.PlaceType)
debug.print Trim(oTxnPos714.PositionArrivalTime)
debug.print Trim(oTxnPos714.PositionHardwareSource)
debug.print Trim(oTxnPos714.PositionLatitude)
debug.print Trim(oTxnPos714.PositionLongitude)
debug.print Trim(oTxnPos714.PositionTime)
debug.print Trim(oTxnPos714.PositionType)
debug.print Trim(oTxnPos714.QmassOwnerAuxId)
debug.print Trim(oTxnPos714.QmassReturnAuxId)
rsPOS("TripStatus") = Trim(oTxnPos714.TripStatus)
Set oTxnPos714 = Nothing
Case RI_TXN_600
Set oTxnMsg600 = oTxnMgr.Next()
Set oTxnMsg600 = Nothing
Case RI_TXN_614
Set oTxnPos614 = oTxnMgr.Next()
Set oTxnPos614 = Nothing
Case RI_TXN_602
Set oTxnAck602 = oTxnMgr.Next()
Set oTxnAck602 = Nothing
Case RI_TXN_603
Set oTxnAck603 = oTxnMgr.Next()
Set oTxnAck603 = Nothing
Case Else
iCount = 1000
End Select
Loop
Set oTxnMgr = Nothing
End Sub