General
- The GetVersion Function is useful for an easy check if the OAS Service is started and reachable.
 
- Returns – 1 if service is not reachable.
 
- Returns positive number of current version if successful.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string networkNode = "";
            Int32 versionNumber = 0;
            versionNumber = oasc.GetVersion(networkNode);
            if (versionNumber == -1)
            { 
                Console.WriteLine("OAS Service not reached");
            }
            else
            {
                Console.WriteLine("OAS Service version number " + versionNumber.ToString("0"));
            }               
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim networkNode As String = ""
            Dim versionNumber As Int32 = 0
            versionNumber = oasc.GetVersion(networkNode)
            If versionNumber = -1 Then
                Console.WriteLine("OAS Service not reached")
            Else
                Console.WriteLine("OAS Service version number " & versionNumber.ToString("0"))
            End If
        End Sub
    End Class
End Namespace
- The GetLicenseString Function returns a string of the OAS Service license.
 
- Returns “OAS Service Not Reachable” if service is not reachable.
 
- Returns the license string if successful.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string LicenseString = "";
            string networkNode = "";
            LicenseString = oasc.GetLicenseString(networkNode);
            Console.WriteLine(LicenseString);
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim LicenseString As String = ""
            Dim networkNode As String = ""
            LicenseString = oasc.GetLicenseString(networkNode)
            Console.WriteLine(LicenseString)
        End Sub
    End Class
End Namespace
- The GetFullyLicensed Function returns the license status of an OAS Service.
 
- Returns -1 if service is not reachable.
 
- Returns 0 if the service is not yet fully licensed, running in demo mode or disabled.
 
- Returns 1 if the service has been licensed.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string networkNode = "";
            Int32 FullyLicensedNumber;
            FullyLicensedNumber = oasc.GetFullyLicensed(networkNode);
            if (FullyLicensedNumber == -1)
                Console.WriteLine("OAS Service not reached");
            else if (FullyLicensedNumber == 1)
                Console.WriteLine("OAS Service Fully Licensed");
            else
                Console.WriteLine("OAS Service Not Fully Licensed");
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim networkNode As String = ""
            Dim FullyLicensedNumber As Int32
            FullyLicensedNumber = oasc.GetFullyLicensed(networkNode)
            If FullyLicensedNumber = -1 Then
                Console.WriteLine("OAS Service not reached")
            ElseIf FullyLicensedNumber = 1 Then
                Console.WriteLine("OAS Service Fully Licensed")
            Else
                Console.WriteLine("OAS Service Not Fully Licensed")
            End If
        End Sub
    End Class
End Namespace
- Returns a string array of system status messages.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        private static OASConfig.Config oasc = new OASConfig.Config();
        public static void Main(string[] args)
        {
            string NetworkNode = "";
            string[] statuses = null;
            statuses = oasc.GetSystemStatus(NetworkNode);
            foreach (string status in statuses)
            {
                Console.WriteLine(status);
            }
            if (statuses.Length == 0)
            {
                Console.WriteLine("There are no parameters to list");
            }
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Public Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim NetworkNode As String = ""
            Dim statuses As String() = Nothing
            statuses = oasc.GetSystemStatus(NetworkNode)
            For Each status As String In statuses
                Console.WriteLine(status)
            Next
            If statuses.Length = 0 Then
                Console.WriteLine("There are no parameters to list")
            End If
        End Sub
    End Class
End Namespace
- The InRuntime Function returns the Runtime Status of an OAS Service.
 
- Returns -1 if service is not reachable.
 
- Returns 0 if service is not in Runtime.
 
- Returns 1 if service is in Runtime.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string networkNode = "";
            Int32 InRuntimeNumber;
            InRuntimeNumber = oasc.InRuntime(networkNode);
            if (InRuntimeNumber == -1)
                Console.WriteLine("OAS Service not reached");
            else if (InRuntimeNumber == 1)
                Console.WriteLine("OAS Service Is In Runtime Mode");
            else
                Console.WriteLine("OAS Service Is Stopped");
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim networkNode As String = ""
            Dim InRuntimeNumber As Int32
            InRuntimeNumber = oasc.InRuntime(networkNode)
            If InRuntimeNumber = -1 Then
                Console.WriteLine("OAS Service not reached")
            ElseIf InRuntimeNumber = 1 Then
                Console.WriteLine("OAS Service Is In Runtime Mode")
            Else
                Console.WriteLine("OAS Service Is Stopped")
            End If
        End Sub
    End Class
End Namespace
- The StartRuntime Subroutine Starts the OAS Service Runtime Mode.
 
- If the Service is already in Runtime Mode no method occurs.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
 
- Optional ErrorString will be set to Success when function is successful and an error message when in error.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string networkNode = "";
            string ErrorString = "";
            oasc.StartRuntime(networkNode, ref ErrorString);
            if (ErrorString != "Success")
               Console.WriteLine(ErrorString); 
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim networkNode As String = ""
            Dim ErrorString As String = ""
            oasc.StartRuntime(networkNode, ErrorString)
            If ErrorString <> "Success" Then Console.WriteLine(ErrorString)
        End Sub
    End Class
End Namespace
- The StopRuntime Subroutine Stops the OAS Service Runtime Mode.
 
- If the Service is not in Runtime Mode no method occurs.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
 
- Optional ErrorString will be set to Success when function is successful and an error message when in error.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string networkNode = "";
            string ErrorString = "";
            oasc.StopRuntime(networkNode, ref ErrorString);
            if (ErrorString != "Success")
                Console.WriteLine(ErrorString);
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim networkNode As String = ""
            Dim ErrorString As String = ""
            oasc.StopRuntime(networkNode, ErrorString)
            If ErrorString <> "Success" Then Console.WriteLine(ErrorString)
        End Sub
    End Class
End Namespace
- The GetMaintenanceExpiration Function returns the maintenance expiration date within the service.
 
- Please note that the actual maintenance expiration is retained by the company records of Open Automation Software and the value returned may be out of date.
 
- Returns string Month / Day / Year in the format of 00/00/0000.
 
- Returns blank if a failure occurs.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
 
- ErrorString will be set to Success when function is successful and an error message when in error.
 
- RemoteSCADAHostingName is the name of the Live Data Cloud OAS Service to connect to.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string networkNode = "";
            string LicenseString;
            string ErrorString = "";
            LicenseString = oasc.GetMaintenanceExpiration(networkNode, ref ErrorString);
            if (ErrorString != "Success")
                Console.WriteLine(ErrorString);
            Console.WriteLine(LicenseString);            
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim networkNode As String = ""
            Dim LicenseString As String
            Dim ErrorString As String = ""
            LicenseString = oasc.GetMaintenanceExpiration(networkNode, ErrorString)
            If ErrorString <> "Success" Then Console.WriteLine(ErrorString)
            Console.WriteLine(LicenseString)
        End Sub
    End Class
End Namespace
- The GetClientUsers Function returns a list of users that are currently connected to the service.
 
- If there was no username specified in the client connection the string is blank for the client connection.
 
- The same user may be logged in to multiple clients.
 
- Returns Empty String Array if service is not reachable.
 
- NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
 
- ErrorString will be set to Success when function is successful and an error message when in error.
 
- RemoteSCADAHostingName is the name of the Live Data Cloud OAS Service to connect to.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            string networkNode = "";
            string[] clients;
            string ErrorString = "";
            bool[] inError = new bool[] { };
            clients = oasc.GetClientUsers(networkNode, ref ErrorString);
            if (ErrorString != "Success")
                Console.WriteLine(ErrorString);
            foreach (string client in clients)
            {
                Console.WriteLine(client);
            }
            if (clients.Length == 0)
            {
                Console.WriteLine("There are no clients to show.");
            }
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            Dim networkNode As String = ""
            Dim clients As String()
            Dim ErrorString As String = ""
            Dim inError As Boolean() = New Boolean() {}
            clients = oasc.GetClientUsers(networkNode, ErrorString)
            If ErrorString <> "Success" Then
                Console.WriteLine(ErrorString)
            End If
            For Each client As String In clients
                Console.WriteLine(client)
            Next
            If clients.Length = 0 Then
                Console.WriteLine("There are no clients to show.")
            End If
        End Sub
    End Class
End Namespace
- Based on options, returns either a string array of drives on the operating system or a string array of folders on a drive.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            {
                string errorString = "";
                string networknode = "localhost";
                string directoryPath = @"C:\"; //set as blank to return all drives of the OS. directoryPath = @"C:\Temp\";
                bool returnFullPath = true; // set to false to return just the sub directory name or file name without the full path.
                string[] directories = oasc.GetListOfDirectories(directoryPath, returnFullPath, networknode, ref errorString);
                                
                if (errorString == "Success")
                {
                    foreach (string dir in directories)
                    {
                        Console.WriteLine(dir);
                    }
                }
                else
                {
                    Console.WriteLine(errorString);
                }
            }
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            If True Then
                Dim errorString As String = ""
                Dim networknode As String = "localhost"                
                Dim directoryPath As String = "C:\"
                Dim returnFullPath As Boolean = True
                Dim directories As String() = oasc.GetListOfDirectories(directoryPath, returnFullPath, networknode, errorString)
                If errorString = "Success" Then
                    For Each dir As String In directories
                        Console.WriteLine(dir)
                    Next
                Else
                    Console.WriteLine(errorString)
                End If
            End If
        End Sub
    End Class
End Namespace
- Returns a string array of files in a directory.
 
C#
using System;
namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {
            {
                string errorString = "";
                string networknode = "localhost";
                string directoryPath = @"C:\"; //set as blank to return all drives of the OS. directoryPath = @"C:\Temp\";
                bool returnFullPath = true; // set to false to return just the sub directory name or file name without the full path.
                string[] files = oasc.GetListOfFiles(directoryPath, "*", returnFullPath, networknode, ref errorString);
                                
                if (errorString == "Success")
                {
                    foreach (string file in files)
                    {
                        Console.WriteLine(file);
                    }
                }
                else
                {
                    Console.WriteLine(errorString);
                }
            }
        }
    }
}
VB
Imports System
Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()
        Public Shared Sub Main(ByVal args As String())
            If True Then
                Dim errorString As String = ""
                Dim networknode As String = "localhost"
                Dim directoryPath As String = "C:\"
                Dim returnFullPath As Boolean = True
                Dim files As String() = oasc.GetListOfFiles(directoryPath, "*", returnFullPath, networknode, errorString)
                If errorString = "Success" Then
                    For Each file As String In files
                        Console.WriteLine(file)
                    Next
                Else
                    Console.WriteLine(errorString)
                End If
            End If
        End Sub
    End Class
End Namespace