From 3ceecd3fbed7adb691d02b34dccae53d7f7d1d6d Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Mon, 10 Jun 2019 11:59:09 -0600 Subject: [PATCH] Modified volumes format; added config for VC cameras and recents --- .../Messengers/Ddvc01VtcMessenger.cs | 17 ++ .../RoomBridges/CotijaDdvc01RoomBridge.cs | 172 +++++++++++++----- PepperDashEssentials/AppServer/Volumes.cs | 11 +- PepperDashEssentials/ControlSystem.cs | 6 - .../Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 6 files changed, 150 insertions(+), 60 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index d6f20ab4..fbddf075 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -123,6 +123,15 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint BCameraModeOff = 833; + /// + /// 841 + /// + const uint BCameraSelfView = 841; + + /// + /// 842 + /// + const uint BCameraLayout = 842; /********* Ushorts *********/ @@ -330,6 +339,11 @@ namespace PepperDash.Essentials.AppServer.Messengers EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode()); EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode()); + EISC.SetBoolSigAction(BCameraSelfView, b => PostStatusMessage(new + { + cameraSelfView = b + })); + EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera()); @@ -356,6 +370,8 @@ namespace PepperDash.Essentials.AppServer.Messengers addAction("/cameraModeAuto", BCameraModeAuto); addAction("/cameraModeManual", BCameraModeManual); addAction("/cameraModeOff", BCameraModeOff); + addAction("/cameraSelfView", BCameraSelfView); + addAction("/cameraLayout", BCameraLayout); asc.AddAction("/cameraSelect", new Action(SelectCamera)); @@ -437,6 +453,7 @@ namespace PepperDash.Essentials.AppServer.Messengers { calls = GetCurrentCallList(), cameraMode = GetCameraMode(), + cameraSelfView = EISC.GetBool(BCameraSelfView), currentCallString = EISC.GetString(SCurrentCallNumber), currentDialString = EISC.GetString(SCurrentDialString), directoryContactSelected = new diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index fdd73989..c59a5026 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -27,6 +27,11 @@ namespace PepperDash.Essentials.Room.Cotija /// public const uint RoomIsOn = 301; + /// + /// 12 + /// + public const uint PrivacyMute = 12; + /// /// 41 /// @@ -38,15 +43,15 @@ namespace PepperDash.Essentials.Room.Cotija /// /// 51 /// - public const uint ActivitySharePress = 51; + public const uint ActivityShare = 51; /// /// 52 /// - public const uint ActivityPhoneCallPress = 52; + public const uint ActivityPhoneCall = 52; /// /// 53 /// - public const uint ActivityVideoCallPress = 53; + public const uint ActivityVideoCall = 53; /// /// 1 @@ -85,6 +90,14 @@ namespace PepperDash.Essentials.Room.Cotija /// public const uint ConfigIsReady = 501; /// + /// 502 + /// + public const uint HideVideoConfRecents = 502; + /// + /// 503 + /// + public const uint ShowCameraWhenNotInCall = 503; + /// /// 601 /// public const uint SourceShareDisableStartJoin = 601; @@ -319,16 +332,26 @@ namespace PepperDash.Essentials.Room.Cotija })); Parent.AddAction(@"/room/room1/defaultsource", new Action(() => - EISC.PulseBool(BoolJoin.ActivitySharePress))); + EISC.PulseBool(BoolJoin.ActivityShare))); Parent.AddAction(@"/room/room1/activityVideo", new Action(() => - EISC.PulseBool(BoolJoin.ActivityVideoCallPress))); + EISC.PulseBool(BoolJoin.ActivityVideoCall))); Parent.AddAction(@"/room/room1/activityPhone", new Action(() => - EISC.PulseBool(BoolJoin.ActivityPhoneCallPress))); + EISC.PulseBool(BoolJoin.ActivityPhoneCall))); Parent.AddAction(@"/room/room1/volumes/master/level", new Action(u => EISC.SetUshort(UshortJoin.MasterVolumeLevel, u))); Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() => EISC.PulseBool(BoolJoin.MasterVolumeIsMuted))); + Parent.AddAction(@"/room/room1/volumes/master/privacyMuteToggle", new Action(() => + EISC.PulseBool(BoolJoin.PrivacyMute))); + for (uint i = 2; i <= 7; i++) + { + var index = i; + Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/level", index), new Action(u => + EISC.SetUshort(index, u))); + Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/muteToggle", index), new Action(() => + EISC.PulseBool(index))); + } Parent.AddAction(@"/room/room1/shutdownStart", new Action(() => EISC.PulseBool(BoolJoin.ShutdownStart))); @@ -387,7 +410,6 @@ namespace PepperDash.Essentials.Room.Cotija } } })); - EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b => PostStatusMessage(new { @@ -399,6 +421,48 @@ namespace PepperDash.Essentials.Room.Cotija } } })); + EISC.SetBoolSigAction(BoolJoin.PrivacyMute, b => + PostStatusMessage(new + { + volumes = new + { + master = new + { + privacyMuted = b + } + } + })); + + for (uint i = 2; i <= 7; i++) + { + var index = i; // local scope for lambdas + EISC.SetUShortSigAction(index, u => // start at join 2 + { + // need a dict in order to create the level-n property on auxFaders + var dict = new Dictionary(); + dict.Add("level-" + index, new { level = u }); + PostStatusMessage(new + { + volumes = new + { + auxFaders = dict, + } + }); + }); + EISC.SetBoolSigAction(index, b => + { + // need a dict in order to create the level-n property on auxFaders + var dict = new Dictionary(); + dict.Add("level-" + index, new { muted = b }); + PostStatusMessage(new + { + volumes = new + { + auxFaders = dict, + } + }); + }); + } // shutdown things @@ -421,6 +485,23 @@ namespace PepperDash.Essentials.Room.Cotija // Config things EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues); + + // Activity modes + EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(3)); + EISC.SetSigTrueAction(BoolJoin.ActivityShare, () => UpdateActivity(1)); + EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(2)); + } + + + /// + /// Updates activity states + /// + void UpdateActivity(int mode) + { + PostStatusMessage(new + { + activityMode = mode, + }); } /// @@ -471,17 +552,6 @@ namespace PepperDash.Essentials.Room.Cotija rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue; rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue; rmProps.SpeedDials = new List(); - // add speed dials as long as there are more - up to 4 - -#warning fix speed dials - 512-515 names, 516-519 numbers - for (uint i = 512; i <= 519; i = i + 2) - { - var num = EISC.StringOutput[i].StringValue; - if (string.IsNullOrEmpty(num)) - break; - var name = EISC.StringOutput[i + 1].StringValue; - rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name}); - } // This MAY need a check rmProps.AudioCodecKey = "audioCodec"; @@ -575,7 +645,7 @@ namespace PepperDash.Essentials.Room.Cotija co.SourceLists.Add("default", newSl); - // build "audioCodec" config if we need + // Build "audioCodec" config if we need if (!string.IsNullOrEmpty(rmProps.AudioCodecKey)) { var acFavs = new List(); @@ -610,25 +680,11 @@ namespace PepperDash.Essentials.Room.Cotija co.Devices.Add(acConf); } + // Build Video codec config if (!string.IsNullOrEmpty(rmProps.VideoCodecKey)) { -#warning Break out these video codec favs + // No favorites, for now? var favs = new List(); - for (uint i = 0; i < 4; i++) - { - if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i)) - { - break; - } - favs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem() - { - Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i), - Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i), - Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio - }); - } - - // cameras var camsProps = new List(); @@ -658,6 +714,8 @@ namespace PepperDash.Essentials.Room.Cotija { favorites = favs, cameras = camsProps, + hideRecents = EISC.BooleanOutput[BoolJoin.HideVideoConfRecents].BoolValue, + showCamerasWhenNotInCall = EISC.BooleanOutput[BoolJoin.ShowCameraWhenNotInCall].BoolValue, }; var str = "videoCodec"; var conf = new DeviceConfig() @@ -689,39 +747,41 @@ namespace PepperDash.Essentials.Room.Cotija { if (ConfigIsLoaded) { - var count = EISC.UShortOutput[801].UShortValue; + var count = EISC.UShortOutput[101].UShortValue; Debug.Console(1, this, "The Fader Count is : {0}", count); // build volumes object, serialize and put in content of method below - var auxFaders = new List(); - // Create auxFaders - for (uint i = 2; i <= count; i++) - { - auxFaders.Add( - new Volume(string.Format("level-{0}", i), - EISC.UShortOutput[i].UShortValue, - EISC.BooleanOutput[i].BoolValue, - EISC.StringOutput[800 + i].StringValue, - true, - "someting.png")); - } + var auxFaderDict = new Dictionary(); + for (uint i = 2; i <= count; i++) + { + auxFaderDict.Add("level-" + i, + new Volume("level-" + i, + EISC.UShortOutput[i].UShortValue, + EISC.BooleanOutput[i].BoolValue, + EISC.StringOutput[i].StringValue, + true, + "someting.png")); + } var volumes = new Volumes(); volumes.Master = new Volume("master", EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue, EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue, - EISC.StringOutput[801].StringValue, + EISC.StringOutput[1].StringValue, true, "something.png"); + volumes.Master.HasPrivacyMute = true; + volumes.Master.PrivacyMuted = EISC.BooleanOutput[BoolJoin.PrivacyMute].BoolValue; - volumes.AuxFaders = auxFaders; + volumes.AuxFaders = auxFaderDict; PostStatusMessage(new { + activityMode = GetActivityMode(), isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue, selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue, volumes = volumes @@ -736,6 +796,18 @@ namespace PepperDash.Essentials.Room.Cotija } } + /// + /// Returns the activity mode int + /// + /// + int GetActivityMode() + { + if (EISC.BooleanOutput[BoolJoin.ActivityPhoneCall].BoolValue) return 3; + else if (EISC.BooleanOutput[BoolJoin.ActivityShare].BoolValue) return 1; + else if (EISC.BooleanOutput[BoolJoin.ActivityVideoCall].BoolValue) return 2; + return 0; + } + /// /// Helper for posting status message /// diff --git a/PepperDashEssentials/AppServer/Volumes.cs b/PepperDashEssentials/AppServer/Volumes.cs index 38de8ef2..cf22181a 100644 --- a/PepperDashEssentials/AppServer/Volumes.cs +++ b/PepperDashEssentials/AppServer/Volumes.cs @@ -14,11 +14,11 @@ namespace PepperDash.Essentials.Room.Cotija public Volume Master { get; set; } [JsonProperty("auxFaders")] - public List AuxFaders { get; set; } + public Dictionary AuxFaders { get; set; } public Volumes() { - AuxFaders = new List(); + AuxFaders = new Dictionary(); } } @@ -39,6 +39,13 @@ namespace PepperDash.Essentials.Room.Cotija [JsonProperty("hasMute")] public bool HasMute { get; set; } + [JsonProperty("hasPrivacyMute")] + public bool HasPrivacyMute { get; set; } + + [JsonProperty("privacyMuted")] + public bool PrivacyMuted { get; set; } + + [JsonProperty("muteIcon")] public string MuteIcon { get; set; } diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 8124beb7..e2333ac0 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -193,17 +193,11 @@ namespace PepperDash.Essentials var dir = Global.FilePathPrefix + "plugins"; if (Directory.Exists(dir)) { - // TODO Clear out or create localPlugins folder (maybe in program slot folder) - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins"); var di = new DirectoryInfo(dir); var files = di.GetFiles("*.dll"); foreach (FileInfo fi in files) { - // TODO COPY plugin to loadedPlugins folder - - // TODO LOAD that loadedPlugins dll file - var assy = Assembly.LoadFrom(fi.FullName); var ver = assy.GetName().Version; var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index aee2b8e7..3be0f536 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.5.*")] +[assembly: AssemblyVersion("1.4.6.*")] diff --git a/essentials-framework b/essentials-framework index 2c636c33..847b3e04 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 2c636c3347a406c4254d895789f40dd183f00ca9 +Subproject commit 847b3e044ddc099da5e2ba8baf991e36859bd8f6