mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
Rearranged how cotija bridge are brought up in relation to parent; adding ddvd01 bridge
This commit is contained in:
@@ -69,10 +69,24 @@ namespace PepperDash.Essentials
|
|||||||
return new CotijaSystemController(key, name, props);
|
return new CotijaSystemController(key, name, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (typeName == "cotijaddvc01room")
|
else if (typeName == "cotijaddvc01roombridge")
|
||||||
{
|
{
|
||||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||||
return new PepperDash.Essentials.Room.Cotija.CotijaDdvc01RoomBridge(key, name, comm.IpIdInt);
|
|
||||||
|
var bridge = new PepperDash.Essentials.Room.Cotija.CotijaDdvc01RoomBridge(key, name, comm.IpIdInt);
|
||||||
|
bridge.AddPreActivationAction(() =>
|
||||||
|
{
|
||||||
|
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "cotijaServer") as CotijaSystemController;
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present");
|
||||||
|
}
|
||||||
|
Debug.Console(0, bridge, "Linking to parent controller");
|
||||||
|
bridge.AddParent(parent);
|
||||||
|
parent.CotijaRooms.Add(bridge);
|
||||||
|
});
|
||||||
|
|
||||||
|
return bridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using PepperDash.Essentials.Core;
|
|||||||
using PepperDash.Essentials.Devices.Common;
|
using PepperDash.Essentials.Devices.Common;
|
||||||
using PepperDash.Essentials.DM;
|
using PepperDash.Essentials.DM;
|
||||||
using PepperDash.Essentials.Fusion;
|
using PepperDash.Essentials.Fusion;
|
||||||
|
using PepperDash.Essentials.Room.Cotija;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
@@ -226,6 +227,12 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadRooms()
|
public void LoadRooms()
|
||||||
{
|
{
|
||||||
|
if (ConfigReader.ConfigObject.Rooms == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "WARNING: Configuration contains no rooms");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
|
||||||
{
|
{
|
||||||
var room = roomConfig.GetRoomObject();
|
var room = roomConfig.GetRoomObject();
|
||||||
@@ -238,12 +245,8 @@ namespace PepperDash.Essentials
|
|||||||
Debug.Console(1, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
Debug.Console(1, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
|
||||||
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
|
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
|
||||||
|
|
||||||
var cotija = DeviceManager.GetDeviceForKey("cotijaServer") as CotijaSystemController;
|
var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
|
||||||
|
AddBridgePostActivationHelper(bridge);
|
||||||
if (cotija != null)
|
|
||||||
{
|
|
||||||
cotija.CotijaRooms.Add(new CotijaEssentialsHuddleSpaceRoomBridge(cotija, room as EssentialsHuddleSpaceRoom));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (room is EssentialsHuddleVtc1Room)
|
else if (room is EssentialsHuddleVtc1Room)
|
||||||
{
|
{
|
||||||
@@ -264,12 +267,30 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helps add the post activation steps that link bridges to main controller
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bridge"></param>
|
||||||
|
void AddBridgePostActivationHelper(CotijaBridgeBase bridge)
|
||||||
|
{
|
||||||
|
bridge.AddPostActivationAction(() =>
|
||||||
|
{
|
||||||
|
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "cotijaServer") as CotijaSystemController;
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present");
|
||||||
|
}
|
||||||
|
Debug.Console(0, bridge, "Linking to parent controller");
|
||||||
|
bridge.AddParent(parent);
|
||||||
|
parent.CotijaRooms.Add(bridge);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires up a logo server if not already running
|
/// Fires up a logo server if not already running
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void LoadLogoServer()
|
void LoadLogoServer()
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LogoServer = new HttpLogoServer(8080, @"\html\logo");
|
LogoServer = new HttpLogoServer(8080, @"\html\logo");
|
||||||
|
|||||||
@@ -141,6 +141,7 @@
|
|||||||
<Compile Include="Room\Config\EssentialsRoomEmergencyConfig.cs" />
|
<Compile Include="Room\Config\EssentialsRoomEmergencyConfig.cs" />
|
||||||
<Compile Include="Room\Cotija\CotijaConfig.cs" />
|
<Compile Include="Room\Cotija\CotijaConfig.cs" />
|
||||||
<Compile Include="Room\Cotija\Interfaces.cs" />
|
<Compile Include="Room\Cotija\Interfaces.cs" />
|
||||||
|
<Compile Include="Room\Cotija\RoomBridges\CotijaBridgeBase.cs" />
|
||||||
<Compile Include="Room\Cotija\RoomBridges\CotijaDdvc01RoomBridge.cs" />
|
<Compile Include="Room\Cotija\RoomBridges\CotijaDdvc01RoomBridge.cs" />
|
||||||
<Compile Include="Room\Cotija\RoomBridges\CotijaEssentialsHuddleSpaceRoomBridge.cs" />
|
<Compile Include="Room\Cotija\RoomBridges\CotijaEssentialsHuddleSpaceRoomBridge.cs" />
|
||||||
<Compile Include="Room\Cotija\DeviceTypeInterfaces\IChannelExtensions.cs" />
|
<Compile Include="Room\Cotija\DeviceTypeInterfaces\IChannelExtensions.cs" />
|
||||||
|
|||||||
@@ -4,16 +4,28 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class CotijaBridgeBase
|
public abstract class CotijaBridgeBase: Device
|
||||||
{
|
{
|
||||||
public CotijaSystemController Parent { get; private set; }
|
public CotijaSystemController Parent { get; private set; }
|
||||||
|
|
||||||
public CotijaBridgeBase(CotijaSystemController parent)
|
public CotijaBridgeBase(string key, string name)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parent"></param>
|
||||||
|
public void AddParent(CotijaSystemController parent)
|
||||||
{
|
{
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,10 +118,12 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
|
|
||||||
public ThreeSeriesTcpIpEthernetIntersystemCommunications EISC { get; private set; }
|
public ThreeSeriesTcpIpEthernetIntersystemCommunications EISC { get; private set; }
|
||||||
|
|
||||||
CotijaSystemController Parent;
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool ConfigIsLoaded { get; private set; }
|
public bool ConfigIsLoaded { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -131,7 +133,6 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
public CotijaDdvc01RoomBridge(string key, string name, uint ipId)
|
public CotijaDdvc01RoomBridge(string key, string name, uint ipId)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
Key = key;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EISC = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipId, "127.0.0.2", Global.ControlSystem);
|
EISC = new ThreeSeriesTcpIpEthernetIntersystemCommunications(ipId, "127.0.0.2", Global.ControlSystem);
|
||||||
@@ -146,24 +147,17 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finish wiring up everything after all devices are created
|
/// Finish wiring up everything after all devices are created. The base class will hunt down the related
|
||||||
|
/// parent controller and link them up.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override bool CustomActivate()
|
public override bool CustomActivate()
|
||||||
{
|
{
|
||||||
|
|
||||||
Parent = DeviceManager.AllDevices.FirstOrDefault(d => d is CotijaSystemController) as CotijaSystemController;
|
|
||||||
if (Parent == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, "ERROR: Cannot build CotijaDdvc01RoomBridge. System controller not present");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetupFunctions();
|
SetupFunctions();
|
||||||
SetupFeedbacks();
|
SetupFeedbacks();
|
||||||
EISC.SigChange += EISC_SigChange;
|
EISC.SigChange += EISC_SigChange;
|
||||||
// load config if it's already there
|
// load config if it's already there
|
||||||
if (EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
|
if (EISC.IsOnline || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
|
||||||
LoadConfigValues();
|
LoadConfigValues();
|
||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parent"></param>
|
/// <param name="parent"></param>
|
||||||
/// <param name="room"></param>
|
/// <param name="room"></param>
|
||||||
public CotijaEssentialsHuddleSpaceRoomBridge(CotijaSystemController parent, EssentialsHuddleSpaceRoom room):base(parent)
|
public CotijaEssentialsHuddleSpaceRoomBridge(EssentialsHuddleSpaceRoom room):
|
||||||
|
base("cotijaController", "Cotija Controller")
|
||||||
{
|
{
|
||||||
Room = room;
|
Room = room;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user