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

Section 5. Developing an Application Using the CsiCoraScript Control
Private Sub cmdConnect_Click()
'Connect using the default logon settings.
CsiCoraScript.serverName = txtServerAddress
CsiCoraScript.serverPort = txtServerPort
CsiCoraScript.serverLogonName = txtUsername
CsiCoraScript.serverLogonPassword = txtPassword
'The following attempts to connect to the LoggerNet server
'and calls the event onServerConnectStarted()if the connection
'starts or the event onServerConnectFailure()if it fails.
CsiCoraScript.serverConnect
End Sub
If the connection succeeds, the onServerConnectStarted() event gets triggered.
Otherwise, the onServerConnectFailure() event gets called if the connection
fails.
In order to execute CoraScript commands on the LoggerNet server, use the
method executeScript(). A basic example of code using this method to execute
CoraScript commands and displaying the results in the interface follows:
Private Sub cmdCoraScript_Click()
Dim corascript As String
'Send CoraScript commands to the LoggerNet Server
'Sample CoraScript commands include:
'list-devices;
'add-device com-port Com1 before "";
'add-device CR10x CR10X_Test as-child Com1;
corascript = CsiCoraScript.executeScript(txtCoraScript.Text, 0)
txtCoraResult.Text = corascript
End Sub
Add additional functionality, error handling, and objects as necessary beyond
the example interface and code listed above to meet the specific requirements
of your application. Complete examples using the CsiCoraScript control are
included in the LoggerNet SDK installation.
5-3