diff --git a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs index dcfb5aea..8e8b75ee 100644 --- a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,6 +4,6 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")] -[assembly: AssemblyVersion("1.1.4.*")] +[assembly: AssemblyVersion("1.1.6.*")] \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs b/Essentials/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs index ca93fd42..c2ec9785 100644 --- a/Essentials/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs +++ b/Essentials/PepperDashEssentials/Room/Cotija/CotijaSystemController.cs @@ -79,30 +79,7 @@ namespace PepperDash.Essentials CrestronConsole.ConsoleCommandResponse("HTTP Debug {0}", HttpDebugEnabled ? "Enabled" : "Disabled"); }, "mobilehttpdebug", "1 enables more verbose HTTP response debugging", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => - { - s = s.Trim(); - if (string.IsNullOrEmpty(s)) - { - CrestronConsole.ConsoleCommandResponse("Command must include http URL"); - return; - } - - try - { - var resp = new HttpClient().Get(s); - CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}", resp); - - } - catch (HttpException e) - { - CrestronConsole.ConsoleCommandResponse("Exception in request:"); - CrestronConsole.ConsoleCommandResponse("Response URL: {0}", e.Response.ResponseUrl); - CrestronConsole.ConsoleCommandResponse("Response Error Code: {0}", e.Response.Code); - CrestronConsole.ConsoleCommandResponse("Response body: {0}", e.Response.ContentString); - } - - }, + CrestronConsole.AddNewConsoleCommand(TestHttpRequest, "mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator); } @@ -253,10 +230,10 @@ namespace PepperDash.Essentials /// URL of the server, including the port number, if not 80. Format: "serverUrlOrIp:port" void RegisterSystemToServer() { - var ready = RegisterLockEvent.Wait(2000); + var ready = RegisterLockEvent.Wait(20000); if (!ready) { - Debug.Console(1, this, "RegisterSystemToServer failed to enter after 2 seconds. Ignoring"); + Debug.Console(1, this, "RegisterSystemToServer failed to enter after 20 seconds. Ignoring"); return; } RegisterLockEvent.Reset(); @@ -274,7 +251,7 @@ namespace PepperDash.Essentials if (string.IsNullOrEmpty(postBody)) { - Debug.Console(1, this, "ERROR: Config post body is empty. Cannot register with server."); + Debug.Console(1, this, "ERROR: Config body is empty. Cannot register with server."); } else { @@ -299,6 +276,7 @@ namespace PepperDash.Essentials { Debug.Console(0, this, "ERROR: Initilizing Room: {0}", e); RegisterLockEvent.Set(); + StartReconnectTimer(); } } @@ -361,6 +339,7 @@ namespace PepperDash.Essentials ServerReconnectTimer = null; } + // Success here! ConnectStreamClient(); } else @@ -371,11 +350,13 @@ namespace PepperDash.Essentials { Debug.Console(1, this, "Null response received from server."); } + StartReconnectTimer(); } } catch (Exception e) { Debug.Console(1, this, "Error Initializing Stream Client: {0}", e); + StartReconnectTimer(); } RegisterLockEvent.Set(); } @@ -637,5 +618,56 @@ namespace PepperDash.Essentials Debug.Console(1, this, "Unable to parse message: {0}", err); } } + + void TestHttpRequest(string s) + { + { + s = s.Trim(); + if (string.IsNullOrEmpty(s)) + { + PrintTestHttpRequestUsage(); + return; + } + var tokens = s.Split(' '); + if (tokens.Length < 2) + { + PrintTestHttpRequestUsage(); + return; + } + + try + { + var url = tokens[1]; + if (tokens[0].ToLower() == "get") + { + var resp = new HttpClient().Get(url); + CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}", resp); + } + else if (tokens[1].ToLower() == "post") + { + var resp = new HttpClient().Post(url, new byte[] { }); + CrestronConsole.ConsoleCommandResponse("RESPONSE:\r{0}", resp); + } + + else + { + PrintTestHttpRequestUsage(); + } + } + catch (HttpException e) + { + CrestronConsole.ConsoleCommandResponse("Exception in request:"); + CrestronConsole.ConsoleCommandResponse("Response URL: {0}", e.Response.ResponseUrl); + CrestronConsole.ConsoleCommandResponse("Response Error Code: {0}", e.Response.Code); + CrestronConsole.ConsoleCommandResponse("Response body: {0}", e.Response.ContentString); + } + + } + } + + void PrintTestHttpRequestUsage() + { + CrestronConsole.ConsoleCommandResponse("Usage: mobilehttprequest:N get/post url "); + } } } \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 932b1e34..3ca0d74d 100644 --- a/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -191,6 +191,8 @@ namespace PepperDash.Essentials /// public IHasScheduleAwareness ScheduleSource { get { return VideoCodec as IHasScheduleAwareness; } } + CCriticalSection SourceSelectLock = new CCriticalSection(); + /// /// /// @@ -316,6 +318,9 @@ namespace PepperDash.Essentials // Run this on a separate thread new CTimer(o => { + // try to prevent multiple simultaneous selections + SourceSelectLock.TryEnter(); + try { @@ -374,11 +379,9 @@ namespace PepperDash.Essentials (item.SourceDevice as IUsageTracking).UsageTracker.StartDeviceUsage(); } - // See if this can be moved into common, base-class method ------------- - // Set volume control, using default if non provided IBasicVolumeControls volDev = null; // Handle special cases for volume control @@ -443,6 +446,7 @@ namespace PepperDash.Essentials Debug.Console(1, this, "ERROR in routing: {0}", e); } + SourceSelectLock.Leave(); }, 0); // end of CTimer } diff --git a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 1accd526..0b169527 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -995,6 +995,7 @@ namespace PepperDash.Essentials var srcList = config[_CurrentRoom.SourceListKey].OrderBy(kv => kv.Value.Order); // Setup sources list + SourceStagingSrl.Clear(); uint i = 1; // counter for UI list foreach (var kvp in srcList) { diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index d516fea6..40b10013 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 0bf9eb39..8ec58d5d 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ