feat: updates for web debugging

This commit is contained in:
Neil Dorin
2023-11-02 23:31:15 -06:00
parent e1eb432dee
commit 5a097e7057
13 changed files with 240 additions and 203 deletions

View File

@@ -5,18 +5,15 @@ using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.Diagnostics;
using Full.Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Fusion;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Core.Web;
using PepperDash.Essentials.Fusion;
using PepperDash.Essentials.Room.Config;
using System;
using System.Collections.Generic;
using System.Linq;
namespace PepperDash.Essentials
@@ -118,6 +115,8 @@ namespace PepperDash.Essentials
CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts,
"getroutingports", "Reports all routing ports, if any. Requires a device key", ConsoleAccessLevelEnum.AccessOperator);
DeviceManager.AddDevice(new EssentialsWebApi("essentialsWebApi", "Essentials Web API"));
if (!Debug.DoNotLoadOnNextBoot)
{
GoWithLoad();
@@ -149,11 +148,22 @@ namespace PepperDash.Essentials
directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory();
var fullVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
//var assembly = Assembly.GetExecutingAssembly();
AssemblyInformationalVersionAttribute fullVersionAtt = fullVersion[0] as AssemblyInformationalVersionAttribute;
//Debug.Console(0, "Assembly Name: ", assembly.FullName);
Global.SetAssemblyVersion(fullVersionAtt.InformationalVersion);
//var fullVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
//if (fullVersion.Length == 0)
//{
// Debug.Console(0, "***********************Unable to determine version.***********************");
//}
//AssemblyInformationalVersionAttribute fullVersionAtt = fullVersion[0] as AssemblyInformationalVersionAttribute;
//Debug.Console(0, "Full Version: {0}", fullVersionAtt.InformationalVersion);
//Global.SetAssemblyVersion(fullVersionAtt.InformationalVersion);
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS
{
@@ -202,7 +212,7 @@ namespace PepperDash.Essentials
}
else // Handles Linux OS (Virtual Control)
{
Debug.SetDebugLevel(2);
//Debug.SetDebugLevel(2);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", Global.AssemblyVersion);
@@ -290,6 +300,8 @@ namespace PepperDash.Essentials
{
Debug.Console(0, "Verifying and/or creating folder structure");
var configDir = Global.FilePathPrefix;
Debug.Console(0, "FilePathPrefix: {0}", configDir);
var configExists = Directory.Exists(configDir);
if (!configExists)
Directory.Create(configDir);
@@ -358,7 +370,6 @@ namespace PepperDash.Essentials
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// DeviceManager.AddDevice(new EssemtialsWebApi("essentialsWebApi","Essentials Web API"));
// Add global System Monitor device
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
@@ -387,51 +398,6 @@ namespace PepperDash.Essentials
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
//if (newDev == null)
// newDev = PepperDash.Essentials.Core.ProcessorExtensionDeviceFactory.GetExtensionDevice(devConf);
//if (newDev != null)
//{
// DeviceManager.AddDevice(newDev);
// continue;
//}
// Check if the processor is a DMPS model
//if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
//{
// Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
// var propertiesConfig = JsonConvert.DeserializeObject<DM.Config.DmpsRoutingPropertiesConfig>(devConf.Properties.ToString());
// if(propertiesConfig == null)
// propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig();
// DeviceManager.AddDevice(DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig));
//}
//else
//if (this.ControllerPrompt.IndexOf("mpc3", StringComparison.OrdinalIgnoreCase) > -1)
//{
// Debug.Console(2, "MPC3 processor type detected. Adding Mpc3TouchpanelController.");
// var butToken = devConf.Properties["buttons"];
// if (butToken != null)
// {
// var buttons = butToken.ToObject<Dictionary<string, Essentials.Core.Touchpanels.KeypadButton>>();
// var tpController = new Essentials.Core.Touchpanels.Mpc3TouchpanelController(devConf.Key, devConf.Name, Global.ControlSystem, buttons);
// DeviceManager.AddDevice(tpController);
// }
// else
// {
// Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Unable to deserialize buttons collection for device: {0}", devConf.Key);
// }
//}
//else
//{
// Debug.Console(2, "************Processor is not DMPS type***************");
//}
continue;
}