Campbell Scientific LoggerNet-SDK Software Development Kit User Manual
Page 46

Section 9. Developing an Application Using the Datalogger Control
Private Sub cmdDataloggerConnect_Click()
'Create an active connection to the datalogger so that a
'new connection isn't required for every transaction
If DataLogger.serverConnected Then
If DataLogger.loggerConnected Then
WriteMessage "Already connected to datalogger"
CmdDataloggerConnect.Enabled = False
cmdDataloggerDisconnect.Enabled = True
Else
DataLogger.loggerConnectStart lp_priority_normal
WriteMessage "Datalogger Connection Active"
End
If
Else
WriteMessage "Not connected to the LoggerNet server"
End
If
End Sub
The
loggerConnectCancel()
method cancels the managerial connection
between the LoggerNet server and the datalogger. After running this method,
the server will be returned to the default behavior of connecting and
disconnecting from the datalogger for each transaction. The example code in
the table below shows this method:
Private Sub cmdDataloggerDisconnect_Click()
'Stop the active connection to the datalogger.
If DataLogger.serverConnected Then
If DataLogger.loggerConnected Then
DataLogger.loggerConnectCancel
WriteMessage "Active Datalogger Connection Stopped."
Else
WriteMessage "No Active Connection"
End
If
Else
WriteMessage "Not connected to the LoggerNet server"
End
If
End Sub
The
clockCheckStart()
method will check the clock on the datalogger
while the
clockSetStart()
method sets the clock on the datalogger to the
time on the LoggerNet server. Both of these methods call the
onClockComplete()
event that returns the current time of the datalogger
clock. Example code for the clock check, clock set, and clock complete
methods and event can be found in the following tables:
9-4