diff --git a/AIS/SQL/CreateTables.sql b/AIS/SQL/CreateTables.sql
index 6ba8d1d5..a830c0f8 100644
--- a/AIS/SQL/CreateTables.sql
+++ b/AIS/SQL/CreateTables.sql
@@ -40,6 +40,8 @@ CREATE TABLE [dbo].[aisstation] (
[comPort] NVARCHAR (10) NULL,
[name] NVARCHAR (255) NULL,
[baudrate] INT NULL,
+ [address] NVARCHAR (255) NULL,
+ [active] BIT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
@@ -101,10 +103,10 @@ CREATE TABLE [dbo].[hotposition] (
GO
-PRINT N'Creating unnamed constraint on [dbo].[aisstaticdata]...';
+PRINT N'Creating unnamed constraint on [dbo].[hotposition]...';
GO
-ALTER TABLE [dbo].[aisstaticdata]
+ALTER TABLE [dbo].[hotposition]
ADD DEFAULT newid() FOR [Id];
GO
\ No newline at end of file
diff --git a/AIS/bsmd.AISService/AISService.cs b/AIS/bsmd.AISService/AISService.cs
index 8f8444b9..b7115204 100644
--- a/AIS/bsmd.AISService/AISService.cs
+++ b/AIS/bsmd.AISService/AISService.cs
@@ -53,6 +53,16 @@ namespace bsmd.AISService
}
+ internal void DebugStart()
+ {
+ this.Init(null);
+ string msg = "";
+ if(this.qManager.Start(ref msg))
+ {
+ Console.Read(); // hold it right here
+ }
+ }
+
protected override void OnStop()
{
this.qManager.Stop();
diff --git a/AIS/bsmd.AISService/DB/AISStation.cs b/AIS/bsmd.AISService/DB/AISStation.cs
index bb264494..37cb1090 100644
--- a/AIS/bsmd.AISService/DB/AISStation.cs
+++ b/AIS/bsmd.AISService/DB/AISStation.cs
@@ -13,7 +13,7 @@ namespace bsmd.AISService.DB
{
#region private members
- private int station_Id;
+ private Guid station_Id;
private string name;
private bool active;
private string comport;
@@ -177,7 +177,7 @@ namespace bsmd.AISService.DB
while (reader.Read())
{
AISStation station = new AISStation();
- station.station_Id = reader.GetInt32(0);
+ station.station_Id = reader.GetGuid(0);
station.name = reader.GetString(1);
station.active = reader.GetBoolean(2);
station.latitude = (double) reader.GetInt32(3) / 600000;
@@ -201,12 +201,12 @@ namespace bsmd.AISService.DB
public static AISStation CreateStation(string name, DBConnector con)
{
AISStation newStation = new AISStation();
+ newStation.station_Id = Guid.NewGuid();
newStation.name = name;
newStation.active = true;
- string query = string.Format("INSERT INTO aisstation SET name='{0}',active=1",
- name);
- con.ExecuteNonQuery(query);
- newStation.station_Id = Convert.ToInt32(con.ExecuteScalar("SELECT LAST_INSERT_ID()"));
+ string query = string.Format("INSERT INTO aisstation SET Id='{0}', name='{1}',active=1",
+ newStation.station_Id, newStation.name);
+ con.ExecuteNonQuery(query);
return newStation;
}
diff --git a/AIS/bsmd.AISService/Program.cs b/AIS/bsmd.AISService/Program.cs
index 28f96537..6e5351dc 100644
--- a/AIS/bsmd.AISService/Program.cs
+++ b/AIS/bsmd.AISService/Program.cs
@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
+using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.ServiceProcess;
@@ -41,7 +42,11 @@ namespace bsmd.AISService
return 1;
}
}
- else
+ else if(Debugger.IsAttached)
+ {
+ AISService aisService = new AISService();
+ aisService.DebugStart();
+ } else
{
DisplayUsage();
}
diff --git a/AIS/bsmd.AISService/ais_config.xml b/AIS/bsmd.AISService/ais_config.xml
new file mode 100644
index 00000000..42481a80
--- /dev/null
+++ b/AIS/bsmd.AISService/ais_config.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+ 127.0.0.1
+ 32100
+
+
+ ais_config.xml
+ Server=192.168.2.12;Database=ais;Uid=aisuser;Pwd=aispasswd
+ true
+ 500
+ 120
+ 120
+ 20
+
\ No newline at end of file
diff --git a/AIS/bsmd.AISService/bsmd.AISService.csproj b/AIS/bsmd.AISService/bsmd.AISService.csproj
index a42a1192..60b6de37 100644
--- a/AIS/bsmd.AISService/bsmd.AISService.csproj
+++ b/AIS/bsmd.AISService/bsmd.AISService.csproj
@@ -116,6 +116,11 @@
ProjectInstaller.cs
+
+
+ PreserveNewest
+
+