diff --git a/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs b/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs index 09a74cfa..015b03ea 100644 --- a/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs +++ b/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs @@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core { get { - return Global.FilePathPrefix + @"IR\"; + return Global.FilePathPrefix + "IR" + Global.DirectorySeparator; } } diff --git a/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index ded911e5..4d1602e2 100644 --- a/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -17,6 +17,14 @@ namespace PepperDash.Essentials.Core public static string FilePathPrefix { get; private set; } + public static char DirectorySeparator + { + get + { + return System.IO.Path.DirectorySeparatorChar; + } + } + /// /// Sets the file path prefix /// diff --git a/Essentials/PepperDashEssentials/Config/ConfigReader.cs b/Essentials/PepperDashEssentials/Config/ConfigReader.cs index 7a743451..4cda6cac 100644 --- a/Essentials/PepperDashEssentials/Config/ConfigReader.cs +++ b/Essentials/PepperDashEssentials/Config/ConfigReader.cs @@ -19,14 +19,18 @@ namespace PepperDash.Essentials public static bool LoadConfig2() { - Debug.Console(0, "Loading unmerged system/template portal configuration file."); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading unmerged system/template portal configuration file."); try { - var filePath = Global.FilePathPrefix + @"ConfigurationFile.json"; + var filePath = Global.FilePathPrefix + "configurationFile.json"; - if (!File.Exists(filePath)) +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load config file: '{0}'", filePath); + + if (!File.Exists(filePath)) { - Debug.Console(0, +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Configuration file not present. Please load file to {0} and reset program", filePath); return false; } @@ -48,11 +52,16 @@ namespace PepperDash.Essentials ConfigObject.TemplateUrl= doubleObj["template_url"].Value(); } } + +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Merged Config"); + return true; } catch (Exception e) { - Debug.Console(0, "ERROR: Config load failed: \r{0}", e); +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Config load failed: \r{0}", e); return false; } } diff --git a/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs b/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs index edf3f43f..4f12b92f 100644 --- a/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs +++ b/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs @@ -17,7 +17,7 @@ namespace PepperDash.Essentials { public static class FactoryHelper { - public static string IrDriverPathPrefix = Global.FilePathPrefix + @"IR\"; + public static string IrDriverPathPrefix = Global.FilePathPrefix + "IR" + Global.DirectorySeparator; public static void HandleUnknownType(JToken devToken, string type) { diff --git a/Essentials/PepperDashEssentials/ControlSystem.cs b/Essentials/PepperDashEssentials/ControlSystem.cs index 799666f4..ec58b75d 100644 --- a/Essentials/PepperDashEssentials/ControlSystem.cs +++ b/Essentials/PepperDashEssentials/ControlSystem.cs @@ -32,6 +32,8 @@ namespace PepperDash.Essentials /// public override void InitializeSystem() { + DeterminePlatform(); + CrestronConsole.AddNewConsoleCommand(s => { foreach (var tl in TieLineCollection.Default) @@ -54,9 +56,6 @@ namespace PepperDash.Essentials "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); - - DeterminePlatform(); - GoWithLoad(); } @@ -67,16 +66,30 @@ namespace PepperDash.Essentials /// public void DeterminePlatform() { +#warning Temporary Error logging for XiO Edge Debugging + + ErrorLog.Error("Determining Platform...."); + string filePathPrefix; + var dirSeparator = Global.DirectorySeparator; + + var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + + var versionString = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build); + if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) { - filePathPrefix = string.Format(@"\NVRAM\program{0}\", - InitialParametersClass.ApplicationNumber); + filePathPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory() + dirSeparator + "NVRAM" + + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; +#warning Temporary Error logging for XiO Edge Debugging + ErrorLog.Error(string.Format("Starting Essentials v{0} on 3-series Appliance", versionString)); } else { - filePathPrefix = (@"\USER\"); + filePathPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory() + dirSeparator + "User" + dirSeparator; +#warning Temporary Error logging for XiO Edge Debugging + ErrorLog.Error(string.Format("Starting Essentials v{0} on XiO Edge Server", versionString)); } Global.SetFilePathPrefix(filePathPrefix); @@ -93,18 +106,19 @@ namespace PepperDash.Essentials ConsoleAccessLevelEnum.AccessOperator); //PortalSync = new PepperDashPortalSyncClient(); - - Debug.Console(0, "Starting Essentials load from configuration"); +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); var filesReady = SetupFilesystem(); if (filesReady) { - Debug.Console(0, "Folder structure verified. Loading config..."); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config..."); if (!ConfigReader.LoadConfig2()) return; Load(); - Debug.Console(0, "Essentials load complete\r" + +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" + "-------------------------------------------------------------"); } else @@ -139,11 +153,11 @@ namespace PepperDash.Essentials if (!configExists) Directory.Create(configDir); - var irDir = Global.FilePathPrefix + @"ir"; + var irDir = Global.FilePathPrefix + "ir"; if (!Directory.Exists(irDir)) Directory.Create(irDir); - var sgdDir = Global.FilePathPrefix + @"sgd"; + var sgdDir = Global.FilePathPrefix + "sgd"; if (!Directory.Exists(sgdDir)) Directory.Create(sgdDir); @@ -196,7 +210,8 @@ namespace PepperDash.Essentials try { - Debug.Console(0, "Creating device '{0}'", devConf.Key); +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}'", devConf.Key); // Skip this to prevent unnecessary warnings if (devConf.Key == "processor") continue; @@ -215,13 +230,18 @@ namespace PepperDash.Essentials if (newDev != null) DeviceManager.AddDevice(newDev); else - Debug.Console(0, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key); +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key); } catch (Exception e) { - Debug.Console(0, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e); +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e); } } +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded."); + } /// @@ -240,6 +260,10 @@ namespace PepperDash.Essentials if (newTL != null) tlc.Add(newTL); } + +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded."); + } /// @@ -249,7 +273,7 @@ namespace PepperDash.Essentials { if (ConfigReader.ConfigObject.Rooms == null) { - Debug.Console(0, "WARNING: Configuration contains no rooms"); + Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms"); return; } @@ -262,31 +286,39 @@ namespace PepperDash.Essentials { DeviceManager.AddDevice(room); - Debug.Console(1, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion"); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion"); DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1)); + + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); // Cotija bridge var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom); AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present DeviceManager.AddDevice(bridge); + + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added..."); } else if (room is EssentialsHuddleVtc1Room) { DeviceManager.AddDevice(room); - Debug.Console(1, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion"); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion"); DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1)); } else { - Debug.Console(1, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion"); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion"); DeviceManager.AddDevice(room); } } else - Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key); } + +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded."); + } /// @@ -315,11 +347,11 @@ namespace PepperDash.Essentials { try { - LogoServer = new HttpLogoServer(8080, @"\html\logo"); - } + LogoServer = new HttpLogoServer(8080, Global.FilePathPrefix + "html" + Global.DirectorySeparator + "logo"); + } catch (Exception) { - Debug.Console(0, "NOTICE: Logo server cannot be started. Likely already running in another program"); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program"); } } } diff --git a/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index 7233fd6c..93db0a6e 100644 --- a/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -128,55 +128,63 @@ namespace PepperDash.Essentials.Fusion : base(room.Key + "-fusion") { - Room = room; - - IpId = ipId; - - FusionStaticAssets = new Dictionary(); - - GUIDs = new FusionRoomGuids(); - - var mac = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_MAC_ADDRESS, 0); - - var slot = Global.ControlSystem.ProgramNumber; - - string guidFilePath = Global.FilePathPrefix + string.Format(@"{1}-FusionGuids.json", Global.ControlSystem.ProgramNumber, InitialParametersClass.ProgramIDTag); - - GuidFileExists = File.Exists(guidFilePath); - - // Check if file exists - if (!GuidFileExists) + try { - // Does not exist. Create GUIDs - GUIDs = new FusionRoomGuids(Room.Name, ipId, GUIDs.GenerateNewRoomGuid(slot, mac), FusionStaticAssets); - } - else - { - // Exists. Read GUIDs - ReadGuidFile(guidFilePath); - } - CreateSymbolAndBasicSigs(IpId); - SetUpSources(); - SetUpCommunitcationMonitors(); - SetUpDisplay(); - SetUpError(); - ExecuteCustomSteps(); + Room = room; - if(Room.RoomOccupancy != null) - { - if(Room.OccupancyStatusProviderIsRemote) - SetUpRemoteOccupancy(); + IpId = ipId; + + FusionStaticAssets = new Dictionary(); + + GUIDs = new FusionRoomGuids(); + + var mac = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_MAC_ADDRESS, 0); + + var slot = Global.ControlSystem.ProgramNumber; + + string guidFilePath = Global.FilePathPrefix + string.Format(@"{0}-FusionGuids.json", InitialParametersClass.ProgramIDTag); + + GuidFileExists = File.Exists(guidFilePath); + + // Check if file exists + if (!GuidFileExists) + { + // Does not exist. Create GUIDs + GUIDs = new FusionRoomGuids(Room.Name, ipId, GUIDs.GenerateNewRoomGuid(slot, mac), FusionStaticAssets); + } else { - SetUpLocalOccupancy(); + // Exists. Read GUIDs + ReadGuidFile(guidFilePath); } + + CreateSymbolAndBasicSigs(IpId); + SetUpSources(); + SetUpCommunitcationMonitors(); + SetUpDisplay(); + SetUpError(); + ExecuteCustomSteps(); + + if (Room.RoomOccupancy != null) + { + if (Room.OccupancyStatusProviderIsRemote) + SetUpRemoteOccupancy(); + else + { + SetUpLocalOccupancy(); + } + } + + // Make it so! + FusionRVI.GenerateFileForAllFusionDevices(); + + GenerateGuidFile(guidFilePath); + } + catch (Exception e) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Error Building Fusion System Controller: {0}", e); } - - // Make it so! - FusionRVI.GenerateFileForAllFusionDevices(); - - GenerateGuidFile(guidFilePath); } /// @@ -245,7 +253,7 @@ namespace PepperDash.Essentials.Fusion { if(string.IsNullOrEmpty(filePath)) { - Debug.Console(0, this, "Error reading guid file. No path specified."); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Error reading guid file. No path specified."); return; } @@ -270,7 +278,7 @@ namespace PepperDash.Essentials.Fusion } - Debug.Console(0, this, "Fusion Guids successfully read from file: {0}", filePath); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Fusion Guids successfully read from file: {0}", filePath); Debug.Console(1, this, "\nRoom Name: {0}\nIPID: {1:x}\n RoomGuid: {2}", Room.Name, IpId, RoomGuid); @@ -281,7 +289,7 @@ namespace PepperDash.Essentials.Fusion } catch (Exception e) { - Debug.Console(0, this, "Error reading guid file: {0}", e); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Error reading guid file: {0}", e); } finally { @@ -293,7 +301,7 @@ namespace PepperDash.Essentials.Fusion protected virtual void CreateSymbolAndBasicSigs(uint ipId) { - Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating Fusion Room symbol with GUID: {0}", RoomGuid); FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid); FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use(); @@ -395,31 +403,20 @@ namespace PepperDash.Essentials.Fusion protected void GetProcessorInfo() { - //SystemName = FusionRoom.CreateOffsetStringSig(50, "Info - Processor - System Name", eSigIoMask.InputSigOnly); - //Model = FusionRoom.CreateOffsetStringSig(51, "Info - Processor - Model", eSigIoMask.InputSigOnly); - //SerialNumber = FusionRoom.CreateOffsetStringSig(52, "Info - Processor - Serial Number", eSigIoMask.InputSigOnly); - //Uptime = FusionRoom.CreateOffsetStringSig(53, "Info - Processor - Uptime", eSigIoMask.InputSigOnly); Firmware = FusionRoom.CreateOffsetStringSig(61, "Info - Processor - Firmware", eSigIoMask.InputSigOnly); - for (int i = 0; i < Global.ControlSystem.NumProgramsSupported; i++) + if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) { - var join = 62 + i; - var progNum = i + 1; - Program[i] = FusionRoom.CreateOffsetStringSig((uint)join, string.Format("Info - Processor - Program {0}", progNum), eSigIoMask.InputSigOnly); + for (int i = 0; i < Global.ControlSystem.NumProgramsSupported; i++) + { + var join = 62 + i; + var progNum = i + 1; + Program[i] = FusionRoom.CreateOffsetStringSig((uint)join, string.Format("Info - Processor - Program {0}", progNum), eSigIoMask.InputSigOnly); + } } Firmware.InputSig.StringValue = InitialParametersClass.FirmwareVersion; - - //var programs = ProcessorProgReg.GetProcessorProgReg(); - - //for (int i = 1; i < Global.ControlSystem.NumProgramsSupported; i++) - //{ - // var join = 62 + i; - // var progNum = i + 1; - // if (programs[i].Exists) - // Program[i].InputSig.StringValue = programs[i].Name; - //} } diff --git a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index 9224a12b..21d81863 100644 --- a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -37,8 +37,9 @@ namespace PepperDash.Essentials : base(key, name) { AddPostActivationAction(() => - { - Debug.Console(0, this, "Creating hardware..."); + { +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating touchpanel hardware..."); type = type.ToLower(); try { @@ -66,15 +67,17 @@ namespace PepperDash.Essentials Panel = new Tsw1052(id, Global.ControlSystem); else if (type == "tsw1060") Panel = new Tsw1060(id, Global.ControlSystem); - else - { - Debug.Console(0, this, "WARNING: Cannot create TSW controller with type '{0}'", type); + else + { +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); return; } } catch (Exception e) - { - Debug.Console(0, this, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message); + { +#warning Temporary Error logging for XiO Edge Debugging + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message); return; } @@ -89,13 +92,14 @@ namespace PepperDash.Essentials //CrestronInvoke.BeginInvoke(o => // { - var regSuccess = Panel.Register(); + var regSuccess = Panel.Register(); +#warning Temporary Error logging for XiO Edge Debugging if (regSuccess != eDeviceRegistrationUnRegistrationResponse.Success) - Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess); // Give up cleanly if SGD is not present. var sgdName = Global.FilePathPrefix - + @"\sgd\" + props.SgdFile; + + Global.DirectorySeparator + "sgd" + Global.DirectorySeparator + props.SgdFile; if (!File.Exists(sgdName)) { Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName); diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index addd7a14..6788b809 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 d1dbc7c7..66973a58 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ