Skip to content

Commit

Permalink
Basic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonV-Skyline committed Apr 10, 2024
1 parent e726017 commit eb029e2
Show file tree
Hide file tree
Showing 30 changed files with 597 additions and 504 deletions.
5 changes: 0 additions & 5 deletions Jenkinsfile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Enums
namespace Skyline.DataMiner.PollingManager
{
using Skyline.DataMiner.Scripting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Enums
namespace Skyline.DataMiner.PollingManager
{
using Skyline.DataMiner.Scripting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Enums
namespace Skyline.DataMiner.PollingManager
{
using Skyline.DataMiner.Scripting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Enums
namespace Skyline.DataMiner.PollingManager
{
using Skyline.DataMiner.Scripting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Enums
namespace Skyline.DataMiner.PollingManager
{
using Skyline.DataMiner.Scripting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Enums
namespace Skyline.DataMiner.PollingManager
{
using System;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Pollable
namespace Skyline.DataMiner.PollingManager
{
using System;
using System.Collections.Generic;

using Skyline.DataMiner.Protocol.PollingManager.Enums;
using Skyline.DataMiner.Protocol.PollingManager.Structs;
using Skyline.DataMiner.Scripting;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Pollable
namespace Skyline.DataMiner.PollingManager
{
using System;
using System.Collections.Generic;

using Skyline.DataMiner.Protocol.PollingManager.Enums;
using Skyline.DataMiner.Protocol.PollingManager.Structs;
using Skyline.DataMiner.Scripting;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Pollable
namespace Skyline.DataMiner.PollingManager
{
using System.Collections.Generic;
using System.Linq;

using Skyline.DataMiner.Protocol.PollingManager.Structs;
using Skyline.DataMiner.Scripting;

public abstract class PollingManagerConfigurationBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
namespace Skyline.DataMiner.Protocol.PollingManager
namespace Skyline.DataMiner.PollingManager
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;

using Skyline.DataMiner.Net;
using Skyline.DataMiner.Protocol.PollingManager.Enums;
using Skyline.DataMiner.Protocol.PollingManager.Pollable;
using Skyline.DataMiner.Scripting;

/// <summary>
Expand Down Expand Up @@ -553,15 +550,15 @@ private PollingmanagerQActionRow CreateTableRow(string key, PollableBase value)
{
return new PollingmanagerQActionRow
{
Pollingmanagerindex_1001 = key,
Pollingmanagername_1002 = value.Name,
Pollingmanagerperiod_1003 = value.PeriodType == PeriodType.Custom ? value.Period : value.DefaultPeriod,
Pollingmanagerdefaultperiod_1004 = value.DefaultPeriod,
Pollingmanagerperiodtype_1005 = value.PeriodType,
Pollingmanagerlastpoll_1006 = value.LastPoll == default ? Convert.ToDouble(Status.NotPolled) : value.LastPoll.ToOADate(),
Pollingmanagerstatus_1007 = value.State == State.Disabled ? Status.Disabled : value.Status,
Pollingmanagerreason_1008 = value.Reason,
Pollingmanagerstate_1010 = value.State,
Pollingmanager_id = key,
Pollingmanager_name = value.Name,
Pollingmanager_period = value.PeriodType == PeriodType.Custom ? value.Period : value.DefaultPeriod,
Pollingmanager_defaultperiod = value.DefaultPeriod,
Pollingmanager_periodtype = value.PeriodType,
Pollingmanager_lastpoll = value.LastPoll == default ? Convert.ToDouble(Status.NotPolled) : value.LastPoll.ToOADate(),
Pollingmanager_status = value.State == State.Disabled ? Status.Disabled : value.Status,
Pollingmanager_reason = value.Reason,
Pollingmanager_state = value.State,
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Structs
namespace Skyline.DataMiner.PollingManager
{
using System;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Client
namespace Skyline.Protocol.PollingManager
{
using Skyline.DataMiner.Protocol.PollingManager.Pollable;
using Skyline.DataMiner.PollingManager;
using Skyline.DataMiner.Scripting;

public class Pollable : PollableBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
namespace Skyline.DataMiner.Protocol.PollingManager.Client
namespace Skyline.Protocol.PollingManager
{
using System.Collections.Generic;

using Skyline.DataMiner.Protocol.PollingManager.Pollable;
using Skyline.DataMiner.Protocol.PollingManager.Structs;
using Skyline.DataMiner.PollingManager;
using Skyline.DataMiner.Scripting;

public class PollingManagerConfiguration : PollingManagerConfigurationBase
Expand Down
9 changes: 5 additions & 4 deletions QAction_1/QAction_1.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<TargetFramework>net48</TargetFramework>
<Company>Skyline Communications</Company>
<Copyright>© Skyline Communications</Copyright>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<RootNamespace>Skyline.DataMiner.Protocol</RootNamespace>
<AssemblyVersion>2023.1101.0733.48471</AssemblyVersion>
<RootNamespace>Skyline.Protocol</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\QAction_Helper\QAction_Helper.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Skyline.DataMiner.Dev.Protocol" Version="10.1.0.6" />
<PackageReference Include="Skyline.DataMiner.Dev.Protocol" Version="10.2.0.25" />
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
Expand Down
36 changes: 36 additions & 0 deletions QAction_1050/QAction_1050.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;

using Skyline.DataMiner.PollingManager;
using Skyline.DataMiner.Scripting;

/// <summary>
/// DataMiner QAction Class: Polling Manager - Sets.
/// </summary>
public static class QAction
{
/// <summary>
/// The QAction entry point.
/// </summary>
/// <param name="protocol">Link with SLProtocol process.</param>
public static void Run(SLProtocol protocol)
{
try
{
// Get trigger row key.
Trigger trigger = (Trigger)protocol.GetTriggerParameter();
string rowId = protocol.RowKey();

// Updates row with specific key that was triggered by specific column.
PollingManagerContainer
.GetManager(protocol, initTrigger: 1)
.HandleRowUpdate(rowId, trigger.ToColumn());
}
catch (Exception ex)
{
protocol.Log(
$"QA{protocol.QActionID}|{protocol.GetTriggerParameter()}|Polling Manager - Sets|Exception thrown:{Environment.NewLine}{ex}",
LogType.Error,
LogLevel.NoLogging);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<TargetFramework>net48</TargetFramework>
<Company>Skyline Communications</Company>
<Copyright>© Skyline Communications</Copyright>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<LangVersion>7.3</LangVersion>
<AssemblyVersion>2023.1026.2007.32674</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\QAction_1\QAction_1.csproj" />
<ProjectReference Include="..\QAction_Helper\QAction_Helper.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Skyline.DataMiner.Dev.Protocol" Version="10.1.0.6" />
<PackageReference Include="Skyline.DataMiner.Dev.Protocol" Version="10.2.0.25" />
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties DisLinkedXmlFile="..\protocol.xml" DisProjectType="qactionProject" DisLinkId="3" />
<UserProperties DisLinkedXmlFile="..\protocol.xml" DisProjectType="qactionProject" DisLinkId="1050" />
</VisualStudio>
</ProjectExtensions>
</Project>
40 changes: 14 additions & 26 deletions QAction_2/QAction_2.cs
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
using System;

using Skyline.DataMiner.Protocol.PollingManager;
using Skyline.DataMiner.Protocol.PollingManager.Client;
using Skyline.DataMiner.PollingManager;
using Skyline.DataMiner.Scripting;
using Skyline.Protocol.PollingManager;

/// <summary>
/// DataMiner QAction Class: After Startup.
/// </summary>
public static class QAction
{
/// <summary>
/// Runs after startup in order to add/initialize polling manager.
/// The QAction entry point.
/// </summary>
/// <param name="protocol">Link with SLProtocol process.</param>
public static void PollingManagerInit(SLProtocol protocol)
{
try
{
var configuration = new PollingManagerConfiguration(protocol);

// Creates PollingManager instance and adds it to PollingManagerContainer.
PollingManagerContainer.AddManager(protocol, configuration);
}
catch (Exception ex)
{
protocol.Log($"QA{protocol.QActionID}|{protocol.GetTriggerParameter()}|PollingManagerInit|Exception thrown:{Environment.NewLine}{ex}", LogType.Error, LogLevel.NoLogging);
}
}

/// <summary>
/// Gets called by timer to check for necessary polls.
/// </summary>
/// <param name="protocol">Link with SLProtocol process.</param>
public static void PollingManagerCheck(SLProtocol protocol)
public static void Run(SLProtocol protocol)
{
try
{
// Checks PollingManager table for rows that need to be polled.
PollingManagerContainer.GetManager(protocol, 1).CheckForUpdate();
// Polling Manager Initialization
var configuration = new PollingManagerConfiguration(protocol);
PollingManagerContainer.AddManager(protocol, configuration);
}
catch (Exception ex)
{
protocol.Log($"QA{protocol.QActionID}|{protocol.GetTriggerParameter()}|PollingManagerCheck|Exception thrown:{Environment.NewLine}{ex}", LogType.Error, LogLevel.NoLogging);
protocol.Log(
$"QA{protocol.QActionID}|{protocol.GetTriggerParameter()}|After Startup|Exception thrown:{Environment.NewLine}{ex}",
LogType.Error,
LogLevel.NoLogging);
}
}
}
8 changes: 4 additions & 4 deletions QAction_2/QAction_2.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<TargetFramework>net48</TargetFramework>
<Company>Skyline Communications</Company>
<Copyright>© Skyline Communications</Copyright>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<AssemblyVersion>2023.1101.0733.49300</AssemblyVersion>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\QAction_1\QAction_1.csproj" />
<ProjectReference Include="..\QAction_Helper\QAction_Helper.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Skyline.DataMiner.Dev.Protocol" Version="10.1.0.6" />
<PackageReference Include="Skyline.DataMiner.Dev.Protocol" Version="10.2.0.25" />
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties DisLinkedXmlFile="..\protocol.xml" DisProjectType="qactionProject" DisLinkId="2" />
<UserProperties DisLinkId="2" DisProjectType="qactionProject" DisLinkedXmlFile="..\protocol.xml" />
</VisualStudio>
</ProjectExtensions>
</Project>
27 changes: 0 additions & 27 deletions QAction_3/QAction_3.cs

This file was deleted.

30 changes: 0 additions & 30 deletions QAction_4/QAction_4.cs

This file was deleted.

Loading

0 comments on commit eb029e2

Please sign in to comment.