43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using log4net;
|
|
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace bsmd.AIS2Service
|
|
{
|
|
internal static class AISManager
|
|
{
|
|
private static readonly List<IAISThread> _tasks = new List<IAISThread>();
|
|
private static readonly ConcurrentQueue<string> _inputLines = new ConcurrentQueue<string>();
|
|
private static readonly ConcurrentQueue<AISClass> _decodedClasses = new ConcurrentQueue<AISClass>();
|
|
private static readonly ILog _log = LogManager.GetLogger(typeof(AISManager));
|
|
private static readonly List<AIS_Target> _sitRepList = new List<AIS_Target>();
|
|
|
|
public static void Start()
|
|
{
|
|
_tasks.Add(new SerialTCPReader(Properties.Settings.Default.DataSourceHost, Properties.Settings.Default.DataSourcePort, _inputLines));
|
|
_tasks.Add(new AISDecoder(_inputLines, _decodedClasses));
|
|
|
|
foreach (var task in _tasks)
|
|
{
|
|
task.Start();
|
|
_log.InfoFormat("{0} started", task.Name);
|
|
}
|
|
}
|
|
|
|
public static void Stop()
|
|
{
|
|
foreach (var task in _tasks)
|
|
{
|
|
task.Stop();
|
|
_log.InfoFormat("{0} stopped", task.Name);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|