mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Config Update Working
This commit is contained in:
@@ -17,6 +17,7 @@ using PepperDash.Core;
|
|||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Room.Cotija;
|
using PepperDash.Essentials.Room.Cotija;
|
||||||
|
using PepperDash.Essentials.AppServer.Messengers;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
@@ -39,6 +40,8 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
Dictionary<string, CTimer> PushedActions = new Dictionary<string, CTimer>();
|
Dictionary<string, CTimer> PushedActions = new Dictionary<string, CTimer>();
|
||||||
|
|
||||||
|
public ConfigMessenger ConfigMessenger { get; private set; }
|
||||||
|
|
||||||
CTimer ServerHeartbeatCheckTimer;
|
CTimer ServerHeartbeatCheckTimer;
|
||||||
|
|
||||||
long ServerHeartbeatInterval = 20000;
|
long ServerHeartbeatInterval = 20000;
|
||||||
@@ -49,7 +52,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
DateTime LastAckMessage;
|
DateTime LastAckMessage;
|
||||||
|
|
||||||
string SystemUuid;
|
public string SystemUuid;
|
||||||
|
|
||||||
List<CotijaBridgeBase> RoomBridges = new List<CotijaBridgeBase>();
|
List<CotijaBridgeBase> RoomBridges = new List<CotijaBridgeBase>();
|
||||||
|
|
||||||
@@ -97,9 +100,15 @@ namespace PepperDash.Essentials
|
|||||||
CrestronConsole.AddNewConsoleCommand(s => CleanUpWebsocketClient(), "mobiledisco",
|
CrestronConsole.AddNewConsoleCommand(s => CleanUpWebsocketClient(), "mobiledisco",
|
||||||
"Disconnects websocket", ConsoleAccessLevelEnum.AccessOperator);
|
"Disconnects websocket", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
|
CrestronConsole.AddNewConsoleCommand(s => ParseStreamRx(s), "mobilesimulateaction", "Simulates a message from the server", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
|
||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
|
|
||||||
|
// Config Messenger
|
||||||
|
var cmKey = Key + "-config";
|
||||||
|
ConfigMessenger = new ConfigMessenger(cmKey, "/config");
|
||||||
|
ConfigMessenger.RegisterWithAppServer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -4,9 +4,54 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
public class ConfigMessenger
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles interactions with the app server to update the config
|
||||||
|
/// </summary>
|
||||||
|
public class ConfigMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
|
public ConfigMessenger(string key, string messagePath)
|
||||||
|
: base(key, messagePath)
|
||||||
|
{
|
||||||
|
ConfigUpdater.ConfigStatusChanged -= ConfigUpdater_ConfigStatusChanged;
|
||||||
|
ConfigUpdater.ConfigStatusChanged += new EventHandler<ConfigStatusEventArgs>(ConfigUpdater_ConfigStatusChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigUpdater_ConfigStatusChanged(object sender, ConfigStatusEventArgs e)
|
||||||
|
{
|
||||||
|
PostUpdateStatus(e.UpdateStatus.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
|
{
|
||||||
|
appServerController.AddAction(MessagePath + "/updateConfig", new Action<string>(s => GetConfigFile(s)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetConfigFile(string url)
|
||||||
|
{
|
||||||
|
url = string.Format("http://{0}/api/system/{1}/config", AppServerController.Config.ServerUrl, AppServerController.SystemUuid);
|
||||||
|
|
||||||
|
ConfigUpdater.GetConfigFromServer(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Posts a message with the current status of the config update
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status"></param>
|
||||||
|
void PostUpdateStatus(string status)
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
updateStatus = status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
public AudioCodecBaseMessenger ACMessenger { get; private set; }
|
public AudioCodecBaseMessenger ACMessenger { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -108,6 +108,7 @@
|
|||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AppServer\Messengers\ConfigMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\Ddvc01AtcMessenger.cs" />
|
<Compile Include="AppServer\Messengers\Ddvc01AtcMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\AudioCodecBaseMessenger.cs" />
|
<Compile Include="AppServer\Messengers\AudioCodecBaseMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\Ddvc01VtcMessenger.cs" />
|
<Compile Include="AppServer\Messengers\Ddvc01VtcMessenger.cs" />
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
SetupCallStagingPopover();
|
SetupCallStagingPopover();
|
||||||
SetupDialKeypad();
|
SetupDialKeypad();
|
||||||
ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5);
|
ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5);
|
||||||
SetupDirectoryList();
|
|
||||||
SetupRecentCallsList();
|
SetupRecentCallsList();
|
||||||
SetupFavorites();
|
SetupFavorites();
|
||||||
SetupLayoutControls();
|
SetupLayoutControls();
|
||||||
@@ -160,6 +159,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
});
|
});
|
||||||
SearchStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecDirectorySearchEntryText]);
|
SearchStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecDirectorySearchEntryText]);
|
||||||
|
|
||||||
|
SetupDirectoryList();
|
||||||
|
|
||||||
SearchStringBackspaceVisibleFeedback = new BoolFeedback(() => SearchStringBuilder.Length > 0);
|
SearchStringBackspaceVisibleFeedback = new BoolFeedback(() => SearchStringBuilder.Length > 0);
|
||||||
SearchStringBackspaceVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackspaceVisible]);
|
SearchStringBackspaceVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackspaceVisible]);
|
||||||
|
|
||||||
@@ -1065,19 +1066,12 @@ namespace PepperDash.Essentials.UIDrivers.VC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void SearchKeypadClear()
|
void SearchKeypadClear()
|
||||||
{
|
{
|
||||||
try
|
SearchStringBuilder.Remove(0, SearchStringBuilder.Length);
|
||||||
{
|
SearchStringFeedback.FireUpdate();
|
||||||
SearchStringBuilder.Remove(0, SearchStringBuilder.Length);
|
SearchStringKeypadCheckEnables();
|
||||||
SearchStringFeedback.FireUpdate();
|
|
||||||
SearchStringKeypadCheckEnables();
|
|
||||||
|
|
||||||
if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
||||||
SetCurrentDirectoryToRoot();
|
SetCurrentDirectoryToRoot();
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Debug.Console(1, "SearchKeypadClear() blew up!: {0}", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user