diff --git a/App.config b/App.config
index f9c3f0a..7fba6e9 100644
--- a/App.config
+++ b/App.config
@@ -293,6 +293,9 @@
+
+ False
+
diff --git a/My Project/Settings.Designer.vb b/My Project/Settings.Designer.vb
index f84ad89..95aca33 100644
--- a/My Project/Settings.Designer.vb
+++ b/My Project/Settings.Designer.vb
@@ -15,7 +15,7 @@ Option Explicit On
Namespace My
_
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
@@ -1127,6 +1127,18 @@ Namespace My
Me("Insteon_SumpAlarmAddr") = value
End Set
End Property
+
+ _
+ Public Property Sync_LocalQueueMode() As Boolean
+ Get
+ Return CType(Me("Sync_LocalQueueMode"),Boolean)
+ End Get
+ Set
+ Me("Sync_LocalQueueMode") = value
+ End Set
+ End Property
End Class
End Namespace
diff --git a/My Project/Settings.settings b/My Project/Settings.settings
index 1957ca7..5c102b7 100644
--- a/My Project/Settings.settings
+++ b/My Project/Settings.settings
@@ -275,5 +275,8 @@
+
+ False
+
\ No newline at end of file
diff --git a/modConverse.vb b/modConverse.vb
index 3158997..59b0a36 100644
--- a/modConverse.vb
+++ b/modConverse.vb
@@ -97,6 +97,9 @@ Module modConverse
strCommandResponse = modInsteon.Disable()
Case "library"
strCommandResponse = modLibrary.Disable()
+ Case "localqueue"
+ My.Settings.Sync_LocalQueueMode = False
+ strCommandResponse = "Local queue mode disabled"
Case "mail"
strCommandResponse = modMail.Disable()
Case "mapquest"
@@ -156,6 +159,9 @@ Module modConverse
strCommandResponse = modInsteon.Enable()
Case "library"
strCommandResponse = modLibrary.Enable()
+ Case "localqueue"
+ My.Settings.Sync_LocalQueueMode = True
+ strCommandResponse = "Local queue mode enabled"
Case "mail"
strCommandResponse = modMail.Enable()
Case "mapquest"
diff --git a/modDatabase.vb b/modDatabase.vb
index 8576599..8982f22 100644
--- a/modDatabase.vb
+++ b/modDatabase.vb
@@ -6,9 +6,10 @@ Module modDatabase
Public conn As SQLiteConnection = New SQLiteConnection
Sub CreateDb()
- Execute("CREATE TABLE If Not EXISTS ""CONFIG"" (""Key"" varchar(100) primary key not null ,""Value"" varchar )")
+ Execute("CREATE TABLE IF NOT EXISTS ""CONFIG"" (""Key"" varchar(100) primary key not null ,""Value"" varchar )")
Execute("CREATE TABLE IF NOT EXISTS DEVICES(Id INTEGER PRIMARY KEY, Name TEXT, Type TEXT, Model TEXT, Location TEXT, Address TEXT UNIQUE)")
Execute("CREATE TABLE IF NOT EXISTS ENVIRONMENT(Id INTEGER PRIMARY KEY, Date TEXT, Source TEXT, Location TEXT, Temperature INTEGER, Humidity INTEGER, Condition TEXT)")
+ Execute("CREATE TABLE IF NOT EXISTS ""LOCALQUEUE"" (""Id"" integer primary key autoincrement not null ,""Src"" varchar ,""Auth"" varchar ,""Dest"" varchar ,""Mesg"" varchar , ""Recv"" integer )")
Execute("CREATE TABLE IF NOT EXISTS LOCATION(Id INTEGER PRIMARY KEY, Date TEXT, Latitude REAL, Longitude REAL, Speed REAL)")
Execute("CREATE TABLE IF NOT EXISTS PERSONS(Id INTEGER PRIMARY KEY, Date TEXT, FirstName TEXT, LastName TEXT, Nickname TEXT, PersonType INTEGER, Email TEXT, PhoneNumber TEXT, PhoneCarrier INTEGER, MsgPreference INTEGER, Address TEXT, Gender INTEGER, IsSocial INTEGER)")
Execute("CREATE TABLE IF NOT EXISTS PLACES(Id INTEGER PRIMARY KEY, Date TEXT, Name TEXT, Location TEXT)")
diff --git a/modSync.vb b/modSync.vb
index 1c98cee..a17502f 100644
--- a/modSync.vb
+++ b/modSync.vb
@@ -4,11 +4,19 @@ Module modSync
Dim tmrSyncHeartbeatTimer As System.Timers.Timer
Sub InitialHeartbeatHandler()
- SendMessage("server", "fetch", "none")
+ If My.Settings.Sync_LocalQueueMode = False Then
+ SendMessage("server", "fetch", "none")
+ Else
+ GetLocalMessage()
+ End If
End Sub
Sub SendHeartbeatHandler(sender As Object, e As EventArgs)
- SendMessage("server", "fetch", "none")
+ If My.Settings.Sync_LocalQueueMode = False Then
+ SendMessage("server", "fetch", "none")
+ Else
+ GetLocalMessage()
+ End If
End Sub
Function ClearSyncCredentials() As String
@@ -38,6 +46,14 @@ Module modSync
Return "Sync module enabled"
End Function
+ Function GetLocalMessage() As String
+ Dim strLocalMesg As String = ""
+ modDatabase.ExecuteReader("SELECT Mesg FROM LOCALQUEUE WHERE Src = 'sync' AND Auth = 'server' AND Dest = 'hac' AND Recv = 0 LIMIT 1", strLocalMesg)
+ modDatabase.Execute("UPDATE LOCALQUEUE SET Recv = 1 WHERE Src = 'sync' AND Auth = 'server' AND Dest = 'hac' AND Recv = 0 AND Mesg = '" And strLocalMesg And "'")
+ modConverse.Interpret(strLocalMesg, True, False)
+ Return "OK"
+ End Function
+
Function Load() As String
If My.Settings.Sync_Enable = True Then
My.Application.Log.WriteEntry("Loading sync module")