public static void LinkToApi(this StatusSignController ssDevice, BasicTriList trilist, uint joinStart, string joinMapKey) { var joinMap = new StatusSignControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <StatusSignControllerJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, ssDevice, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); trilist.SetBoolSigAction(joinMap.RedControl, b => EnableControl(trilist, joinMap, ssDevice)); trilist.SetBoolSigAction(joinMap.GreenControl, b => EnableControl(trilist, joinMap, ssDevice)); trilist.SetBoolSigAction(joinMap.BlueControl, b => EnableControl(trilist, joinMap, ssDevice)); trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, ssDevice)); trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, ssDevice)); trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); trilist.StringInput[joinMap.Name].StringValue = ssDevice.Name; ssDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); ssDevice.RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl]); ssDevice.BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl]); ssDevice.GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl]); ssDevice.RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed]); ssDevice.BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed]); ssDevice.GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); }
static void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist) { if (!supportsHdcp2) { trilist.SetUShortSigAction(join, new Action <ushort>(s => { if (s == 0) { port.HdcpSupportOff(); } else if (s > 0) { port.HdcpSupportOn(); } })); } else { trilist.SetUShortSigAction(join, new Action <ushort>(u => { port.HdcpReceiveCapability = (eHdcpCapabilityType)u; })); } }
static void SetHdcpStateAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist) { if (hdcpTypeSimple) { trilist.SetUShortSigAction(join, new Action <ushort>(s => { if (s == 0) { port.HdcpSupportOff(); } else if (s > 0) { port.HdcpSupportOn(); } })); } else { trilist.SetUShortSigAction(join, new Action <ushort>(u => { port.HdcpReceiveCapability = (eHdcpCapabilityType)u; })); } }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new StatusSignControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <StatusSignControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); trilist.SetBoolSigAction(joinMap.RedControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); trilist.SetBoolSigAction(joinMap.GreenControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); trilist.SetBoolSigAction(joinMap.BlueControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); trilist.SetUShortSigAction(joinMap.RedLed.JoinNumber, u => SetColor(trilist, joinMap, this)); trilist.SetUShortSigAction(joinMap.GreenLed.JoinNumber, u => SetColor(trilist, joinMap, this)); trilist.SetUShortSigAction(joinMap.BlueLed.JoinNumber, u => SetColor(trilist, joinMap, this)); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl.JoinNumber]); BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl.JoinNumber]); GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl.JoinNumber]); RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed.JoinNumber]); BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed.JoinNumber]); GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); }
private void SetHdcpStateAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) { if (hdcpTypeSimple) { trilist.SetUShortSigAction(join, s => { if (s == 0) { port.HdcpSupportOff(); } else if (s > 0) { port.HdcpSupportOn(); } }); } else { trilist.SetUShortSigAction(join, u => { port.HdcpCapability = (eHdcpCapabilityType)u; }); } }
static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) { if (hdcpTypeSimple) { trilist.SetUShortSigAction(join, new Action <ushort>(s => { if (s == 0) { port.HdcpSupportOff(); } else if (s > 0) { port.HdcpSupportOn(); } })); } else { trilist.SetUShortSigAction(join, new Action <ushort>(s => { port.HdcpCapability = (eHdcpCapabilityType)s; })); } }
protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GenericLightingJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <GenericLightingJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString()); // GenericLighitng Actions & FeedBack trilist.SetUShortSigAction(joinMap.SelectScene.JoinNumber, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u])); var sceneIndex = 0; foreach (var scene in lightingDevice.LightingScenes) { trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[sceneIndex])); scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)]); trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)].StringValue = scene.Name; trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + sceneIndex)].BoolValue = true; sceneIndex++; } return(joinMap); }
public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey) { GenericLightingJoinMap joinMap = new GenericLightingJoinMap(); var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <GenericLightingJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString()); // GenericLighitng Actions & FeedBack trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u])); int sceneIndex = 1; foreach (var scene in lightingDevice.LightingScenes) { var tempIndex = sceneIndex - 1; trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex])); scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]); trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name; trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true; sceneIndex++; } if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea") { var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea; lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s); } //ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; }); /* * var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea; * * * for (uint i = 1; i <= lightingBase.CircuitCount; i++) * { * var circuit = i; * lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); * lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); * lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); * trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1)); * trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1)); * trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1)); * * } */ }
public static void LinkToApi(this AirMediaController airMedia, BasicTriList trilist, uint joinStart, string joinMapKey) { AirMediaControllerJoinMap joinMap = new AirMediaControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <AirMediaControllerJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Airmedia: {0}", airMedia.Name); trilist.StringInput[joinMap.Name].StringValue = airMedia.Name; var commMonitor = airMedia as ICommunicationMonitor; if (commMonitor != null) { commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); } airMedia.IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession]); airMedia.HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync]); trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled, new Action(airMedia.AirMedia.DisplayControl.EnableAutomaticRouting)); trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled, new Action(airMedia.AirMedia.DisplayControl.DisableAutomaticRouting)); airMedia.AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled]); trilist.SetUShortSigAction(joinMap.VideoOut, new Action <ushort>((u) => airMedia.SelectVideoOut(u))); airMedia.VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut]); airMedia.ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB]); airMedia.NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB]); trilist.SetUShortSigAction(joinMap.LoginCode, new Action <ushort>((u) => airMedia.AirMedia.AirMedia.LoginCode.UShortValue = u)); airMedia.LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode]); airMedia.ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB]); airMedia.HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB]); airMedia.SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback]); }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new AirMediaControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <AirMediaControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Airmedia: {0}", Name); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; var commMonitor = this as ICommunicationMonitor; commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession.JoinNumber]); HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync.JoinNumber]); trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled.JoinNumber, AirMedia.DisplayControl.EnableAutomaticRouting); trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled.JoinNumber, AirMedia.DisplayControl.DisableAutomaticRouting); AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled.JoinNumber]); trilist.SetUShortSigAction(joinMap.VideoOut.JoinNumber, (u) => SelectVideoOut(u)); VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut.JoinNumber]); ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB.JoinNumber]); NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB.JoinNumber]); trilist.SetUShortSigAction(joinMap.LoginCode.JoinNumber, (u) => AirMedia.AirMedia.LoginCode.UShortValue = u); LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode.JoinNumber]); ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB.JoinNumber]); HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB.JoinNumber]); SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback.JoinNumber]); }
protected void LinkDmRmcToApi(DmRmcControllerBase rmc, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmRmcControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DmRmcControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); rmc.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); if (rmc.VideoOutputResolutionFeedback != null) { rmc.VideoOutputResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentOutputResolution.JoinNumber]); } if (rmc.EdidManufacturerFeedback != null) { rmc.EdidManufacturerFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidManufacturer.JoinNumber]); } if (rmc.EdidNameFeedback != null) { rmc.EdidNameFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidName.JoinNumber]); } if (rmc.EdidPreferredTimingFeedback != null) { rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming.JoinNumber]); } if (rmc.EdidSerialNumberFeedback != null) { rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber.JoinNumber]); } //If the device is an DM-RMC-4K-Z-SCALER-C var routing = rmc as IRmcRouting; if (routing == null) { return; } if (routing.AudioVideoSourceNumericFeedback != null) { routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource.JoinNumber]); } trilist.SetUShortSigAction(joinMap.AudioVideoSource.JoinNumber, a => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo)); }
public SIMPLCameraMessenger(string key, BasicTriList eisc, string messagePath, uint joinStart) : base(key, messagePath) { EISC = eisc; JoinMap = new CameraControllerJoinMap(joinStart); EISC.SetUShortSigAction(JoinMap.NumberOfPresets.JoinNumber, (u) => SendCameraFullMessageObject()); EISC.SetBoolSigAction(JoinMap.CameraModeAuto.JoinNumber, (b) => PostCameraMode()); EISC.SetBoolSigAction(JoinMap.CameraModeManual.JoinNumber, (b) => PostCameraMode()); EISC.SetBoolSigAction(JoinMap.CameraModeOff.JoinNumber, (b) => PostCameraMode()); }
// This device has a different class for com ports which will make it hard to implement IComPorts.... //#region IComPorts Members //public CrestronCollection<ComPort> ComPorts { get { return TxRxPair.ComPorts as CrestronCollection<ComPort>; } } //public int NumberOfComPorts { get { return 1; } } //#endregion public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new HdMdxxxCEControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <HdMdxxxCEControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); RemoteEndDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RemoteEndDetected.JoinNumber]); trilist.SetSigTrueAction(joinMap.AutoRouteOn.JoinNumber, AutoRouteOn); AutoRouteOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoRouteOn.JoinNumber]); trilist.SetSigTrueAction(joinMap.AutoRouteOff.JoinNumber, AutoRouteOff); AutoRouteOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoRouteOff.JoinNumber]); trilist.SetSigTrueAction(joinMap.PriorityRoutingOn.JoinNumber, PriorityRouteOn); PriorityRoutingOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOn.JoinNumber]); trilist.SetSigTrueAction(joinMap.PriorityRoutingOff.JoinNumber, PriorityRouteOff); PriorityRoutingOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOff.JoinNumber]); trilist.SetSigTrueAction(joinMap.InputOnScreenDisplayEnabled.JoinNumber, OnScreenDisplayEnable); InputOnScreenDisplayEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayEnabled.JoinNumber]); trilist.SetSigTrueAction(joinMap.AutoRouteOff.JoinNumber, OnScreenDisplayDisable); InputOnScreenDisplayEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayDisabled.JoinNumber]); trilist.SetUShortSigAction(joinMap.VideoSource.JoinNumber, (i) => ExecuteSwitch(i, null, eRoutingSignalType.Video | eRoutingSignalType.Audio)); VideoSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoSource.JoinNumber]); trilist.UShortInput[joinMap.SourceCount.JoinNumber].UShortValue = (ushort)InputPorts.Count; foreach (var input in InputPorts) { var number = Convert.ToUInt16(input.Selector); var numberJoin = (UInt16)(number - 1); SyncDetectedFeedbacks[number].LinkInputSig(trilist.BooleanInput[joinMap.SyncDetected.JoinNumber + numberJoin]); trilist.StringInput[joinMap.SourceNames.JoinNumber + numberJoin].StringValue = input.Key; } }
public static void LinkToApi(this HdMdxxxCEController hdMdPair, BasicTriList trilist, uint joinStart, string joinMapKey) { HdMdxxxCEControllerJoinMap joinMap = new HdMdxxxCEControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <HdMdxxxCEControllerJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, hdMdPair, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); hdMdPair.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); hdMdPair.RemoteEndDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RemoteEndDetected]); trilist.SetSigTrueAction(joinMap.AutoRouteOn, new Action(() => hdMdPair.AutoRouteOn())); hdMdPair.AutoRouteOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoRouteOn]); trilist.SetSigTrueAction(joinMap.AutoRouteOff, new Action(() => hdMdPair.AutoRouteOff())); hdMdPair.AutoRouteOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoRouteOff]); trilist.SetSigTrueAction(joinMap.PriorityRoutingOn, new Action(() => hdMdPair.PriorityRouteOn())); hdMdPair.PriorityRoutingOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOn]); trilist.SetSigTrueAction(joinMap.PriorityRoutingOff, new Action(() => hdMdPair.PriorityRouteOff())); hdMdPair.PriorityRoutingOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PriorityRoutingOff]); trilist.SetSigTrueAction(joinMap.InputOnScreenDisplayEnabled, new Action(() => hdMdPair.OnScreenDisplayEnable())); hdMdPair.InputOnScreenDisplayEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayEnabled]); trilist.SetSigTrueAction(joinMap.AutoRouteOff, new Action(() => hdMdPair.OnScreenDisplayDisable())); hdMdPair.InputOnScreenDisplayEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.InputOnScreenDisplayDisabled]); trilist.SetUShortSigAction(joinMap.VideoSource, new Action <ushort>((i) => hdMdPair.ExecuteSwitch(i, null, eRoutingSignalType.Video | eRoutingSignalType.Audio))); hdMdPair.VideoSourceFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoSource]); trilist.UShortInput[joinMap.SourceCount].UShortValue = (ushort)hdMdPair.InputPorts.Count; foreach (var input in hdMdPair.InputPorts) { var number = Convert.ToUInt16(input.Selector); hdMdPair.SyncDetectedFeedbacks[number].LinkInputSig(trilist.BooleanInput[joinMap.SyncDetected + number]); trilist.StringInput[joinMap.SourceNames + number].StringValue = input.Key; } }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new TesiraSwitcherJoinMapAdvancedStandalone(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <TesiraSwitcherJoinMapAdvancedStandalone>(joinMapSerialized); } if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } if (!Enabled) { return; } Debug.Console(2, this, "Tesira Switcher {0} is Enabled", Key); var s = this as IRoutingWithFeedback; s.SourceIndexFeedback.LinkInputSig(trilist.UShortInput[joinMap.Index.JoinNumber]); trilist.SetUShortSigAction(joinMap.Index.JoinNumber, u => SetSource(u)); NameFeedback.LinkInputSig(trilist.StringInput[joinMap.Label.JoinNumber]); trilist.OnlineStatusChange += (d, args) => { if (!args.DeviceOnLine) { return; } foreach (var feedback in Feedbacks) { feedback.FireUpdate(); } }; }
static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart) { var volumeLevelJoin = joinStart; var muteOnJoin = joinStart; var muteOffJoin = joinStart + 1; var volumeUpJoin = joinStart + 2; var volumeDownJoin = joinStart + 3; trilist.SetUShortSigAction(volumeLevelJoin, new Action <ushort>(o => output.SetVolume(o))); output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]); trilist.SetSigTrueAction(muteOnJoin, new Action(output.MuteOn)); output.MuteFeedback.LinkInputSig(trilist.BooleanInput[muteOnJoin]); trilist.SetSigTrueAction(muteOffJoin, new Action(output.MuteOff)); output.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[muteOffJoin]); trilist.SetBoolSigAction(volumeUpJoin, new Action <bool>(b => output.VolumeUp(b))); trilist.SetBoolSigAction(volumeDownJoin, new Action <bool>(b => output.VolumeDown(b))); }
public void CustomUnregsiterWithAppServer(MobileControlSystemController appServerController) { appServerController.RemoveAction(MessagePath + "/fullStatus"); appServerController.RemoveAction(MessagePath + "/cameraUp"); appServerController.RemoveAction(MessagePath + "/cameraDown"); appServerController.RemoveAction(MessagePath + "/cameraLeft"); appServerController.RemoveAction(MessagePath + "/cameraRight"); appServerController.RemoveAction(MessagePath + "/cameraZoomIn"); appServerController.RemoveAction(MessagePath + "/cameraZoomOut"); appServerController.RemoveAction(MessagePath + "/cameraModeAuto"); appServerController.RemoveAction(MessagePath + "/cameraModeManual"); appServerController.RemoveAction(MessagePath + "/cameraModeOff"); EISC.SetUShortSigAction(JoinMap.NumberOfPresets.JoinNumber, null); EISC.SetBoolSigAction(JoinMap.CameraModeAuto.JoinNumber, null); EISC.SetBoolSigAction(JoinMap.CameraModeManual.JoinNumber, null); EISC.SetBoolSigAction(JoinMap.CameraModeOff.JoinNumber, null); }
public static void LinkToApi(this DmTxControllerBase tx, BasicTriList trilist, uint joinStart, string joinMapKey) { DmTxControllerJoinMap joinMap = new DmTxControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DmTxControllerJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus]); tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution]); trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; bool hdcpTypeSimple; if (tx.Hardware is DmTx4kX02CBase || tx.Hardware is DmTx4kzX02CBase) { hdcpTypeSimple = false; } else { hdcpTypeSimple = true; } if (tx is ITxRouting) { var txR = tx as ITxRouting; trilist.SetUShortSigAction(joinMap.VideoInput, new Action <ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video))); trilist.SetUShortSigAction(joinMap.AudioInput, new Action <ushort>(i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio))); txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput]); txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput]); trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; if (txR.InputPorts[DmPortName.HdmiIn] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn]; if (tx.Feedbacks["HdmiInHdcpCapability"] != null) { (tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); } if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); } } if (txR.InputPorts[DmPortName.HdmiIn1] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn1]; if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null) { (tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); } if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); } } if (txR.InputPorts[DmPortName.HdmiIn2] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn2]; if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null) { (tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback).LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState]); } if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) { var port = inputPort.Port as EndpointHdmiInput; SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState, trilist); } } } var txFreeRun = tx as IHasFreeRun; if (txFreeRun != null) { txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled]); trilist.SetBoolSigAction(joinMap.FreeRunEnabled, new Action <bool>(b => txFreeRun.SetFreeRunEnabled(b))); } var txVga = tx as IVgaBrightnessContrastControls; { txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness]); txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast]); trilist.SetUShortSigAction(joinMap.VgaBrightness, new Action <ushort>(u => txVga.SetVgaBrightness(u))); trilist.SetUShortSigAction(joinMap.VgaContrast, new Action <ushort>(u => txVga.SetVgaContrast(u))); } }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new I18NUtilityJoinMap(joinStart); // This adds the join map to the collection on the bridge if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); //Set actions & Feedback for languages trilist.SetUShortSigAction(joinMap.CurrentLanguage.JoinNumber, i => { if (i <= 0) { return; } CurrentLanguageIndex = i; CurrentLanguageString = _languagesConfig.LanguageDefinitions.Keys.ToList()[i - 1]; CurrentLanguage = GetLanguageDefinitionByName(CurrentLanguageString); SetLanguageStrings(trilist, joinMap); }); trilist.SetStringSigAction(joinMap.CurrentLanguage.JoinNumber, s => { if (String.IsNullOrEmpty(s)) { return; } CurrentLanguageString = s; try { CurrentLanguageIndex = _languagesConfig.LanguageDefinitions.Keys.ToList().IndexOf(CurrentLanguageString); } catch (Exception ex) { CurrentLanguageIndex = 0; Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to get index for language {0}\r\n{1}", CurrentLanguageString, ex.Message); } CurrentLanguage = GetLanguageDefinitionByName(CurrentLanguageString); SetLanguageStrings(trilist, joinMap); }); CurrentLanguageFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentLanguage.JoinNumber]); CurrentLanguageIntFeedback.LinkInputSig(trilist.UShortInput[joinMap.CurrentLanguage.JoinNumber]); SetLanguageInfo(trilist, joinMap); trilist.OnlineStatusChange += (o, a) => { if (!a.DeviceOnLine) { return; } SetLanguageInfo(trilist, joinMap); CurrentLanguageFeedback.FireUpdate(); SetLanguageStrings(trilist, joinMap); }; }
public static void LinkToApiExt(this PanasonicDisplay displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) { DisplayControllerJoinMap joinMap = new DisplayControllerJoinMap(); var JoinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(JoinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DisplayControllerJoinMap>(JoinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name; var commMonitor = displayDevice as ICommunicationMonitor; if (commMonitor != null) { commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); } displayDevice.InputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); // Two way feedbacks var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase; if (twoWayDisplay != null) { trilist.SetBool(joinMap.IsTwoWayDisplay, true); twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler <FeedbackEventArgs>(CurrentInputFeedback_OutputChange); } // Power Off trilist.SetSigTrueAction(joinMap.PowerOff, () => { displayDevice.PowerOff(); }); displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler <FeedbackEventArgs>(PowerIsOnFeedback_OutputChange); displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); // PowerOn trilist.SetSigTrueAction(joinMap.PowerOn, () => { displayDevice.PowerOn(); }); displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); int count = 1; var displayBase = displayDevice as PepperDash.Essentials.Core.DisplayBase; foreach (var input in displayDevice.InputPorts) { //displayDevice.InputKeys.Add(input.Key.ToString()); //var tempKey = InputKeys.ElementAt(count - 1); trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[input.Key.ToString()].Selector); }); Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[input.Key.ToString()].Key.ToString()); trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); count++; } Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); trilist.SetUShortSigAction(joinMap.InputSelect, (a) => { if (a == 0) { displayDevice.PowerOff(); } else if (a > 0 && a < displayDevice.InputPorts.Count) { displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); } else if (a == 102) { displayDevice.PowerToggle(); } Debug.Console(2, displayDevice, "InputChange {0}", a); }); var volumeDisplay = displayDevice as IBasicVolumeControls; if (volumeDisplay != null) { trilist.SetBoolSigAction(joinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b)); trilist.SetBoolSigAction(joinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b)); trilist.SetSigTrueAction(joinMap.VolumeMute, () => volumeDisplay.MuteToggle()); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; if (volumeDisplayWithFeedback != null) { volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevelFB]); volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); } } }
public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) { DmChassisControllerJoinMap joinMap = new DmChassisControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DmChassisControllerJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); var chassis = dmChassis.Chassis as DmMDMnxn; dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); trilist.SetUShortSigAction(joinMap.SystemId, new Action <ushort>(o => chassis.SystemId.UShortValue = o)); trilist.SetSigTrueAction(joinMap.SystemId, new Action(() => chassis.ApplySystemId())); dmChassis.SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId]); dmChassis.SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId]); // Link up outputs for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs; i++) { var ioSlot = i; // Control trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action <ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video))); trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action <ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio))); trilist.SetUShortSigAction(joinMap.OutputUsb + ioSlot, new Action <ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput))); trilist.SetUShortSigAction(joinMap.InputUsb + ioSlot, new Action <ushort>(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput))); if (dmChassis.TxDictionary.ContainsKey(ioSlot)) { Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); var txKey = dmChassis.TxDictionary[ioSlot]; var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase; var advancedTxDevice = basicTxDevice as DmTxControllerBase; if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps || dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps || dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps) { dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); } else { if (advancedTxDevice != null) { advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot); } else if (dmChassis.InputEndpointOnlineFeedbacks[ioSlot] != null) { Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot); dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); } } if (basicTxDevice != null && advancedTxDevice == null) { trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; } if (advancedTxDevice != null) { advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); } else if (advancedTxDevice == null || basicTxDevice != null) { Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot); dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)]; if (inputPort != null) { Debug.Console(1, "Port value for input card {0} is set", ioSlot); var port = inputPort.Port; if (port != null) { if (port is HdmiInputWithCEC) { Debug.Console(1, "Port is HdmiInputWithCec"); var hdmiInPortWCec = port as HdmiInputWithCEC; if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown) { SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); } dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); if (dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) { trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot]; } else { trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; } } } } else { inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)]; if (inputPort != null) { var port = inputPort.Port; if (port is DMInputPortWithCec) { Debug.Console(1, "Port is DMInputPortWithCec"); var dmInPortWCec = port as DMInputPortWithCec; if (dmInPortWCec != null) { SetHdcpStateAction(dmChassis.PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState + ioSlot, trilist); } dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); if (dmChassis.InputCardHdcpCapabilityTypes.ContainsKey(ioSlot)) { trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = (ushort)dmChassis.InputCardHdcpCapabilityTypes[ioSlot]; } else { trilist.UShortInput[joinMap.HdcpSupportCapability + ioSlot].UShortValue = 1; } } } } } } else { dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); var inputPort = dmChassis.InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)]; if (inputPort != null) { var hdmiPort = inputPort.Port as EndpointHdmiInput; if (hdmiPort != null) { SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState + ioSlot, trilist); dmChassis.InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState + ioSlot]); } } } if (dmChassis.RxDictionary.ContainsKey(ioSlot)) { Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot); var rxKey = dmChassis.RxDictionary[ioSlot]; var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase; var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase; if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps || dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps || dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps || hdBaseTDevice != null) { dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); } else if (rxDevice != null) { rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); } } // Feedback dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); dmChassis.UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb + ioSlot]); dmChassis.UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb + ioSlot]); dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); dmChassis.OutputDisabledByHdcpFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputDisabledByHdcp + ioSlot]); } }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new TesiraRoomCombinerJoinMapAdvancedStandalone(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <TesiraRoomCombinerJoinMapAdvancedStandalone>(joinMapSerialized); } if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } Debug.Console(2, "Tesira Room Combiner {0} connect", Key); var genericChannel = this as IBasicVolumeWithFeedback; if (!Enabled) { return; } Debug.Console(2, this, "TesiraChannel {0} Is Enabled", Key); NameFeedback.LinkInputSig(trilist.StringInput[joinMap.Label.JoinNumber]); VisibleFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Visible.JoinNumber]); ControlTypeFeedback.LinkInputSig(trilist.UShortInput[joinMap.Type.JoinNumber]); PermissionsFeedback.LinkInputSig(trilist.UShortInput[joinMap.Permissions.JoinNumber]); RoomGroupFeedback.LinkInputSig(trilist.UShortInput[joinMap.Group.JoinNumber]); genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.MuteToggle.JoinNumber]); genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.MuteOn.JoinNumber]); genericChannel.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.MuteOff.JoinNumber]); genericChannel.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.Volume.JoinNumber]); trilist.SetSigTrueAction(joinMap.MuteToggle.JoinNumber, genericChannel.MuteToggle); trilist.SetSigTrueAction(joinMap.MuteOn.JoinNumber, genericChannel.MuteOn); trilist.SetSigTrueAction(joinMap.MuteOff.JoinNumber, genericChannel.MuteOff); trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, genericChannel.VolumeUp); trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, genericChannel.VolumeDown); trilist.SetUShortSigAction(joinMap.Volume.JoinNumber, u => { if (u > 0) { genericChannel.SetVolume(u); } }); trilist.SetUShortSigAction(joinMap.Group.JoinNumber, u => { if (u > 0) { SetRoomGroup(u); } }); trilist.OnlineStatusChange += (d, args) => { if (!args.DeviceOnLine) { return; } foreach (var feedback in Feedbacks) { feedback.FireUpdate(); } }; }
protected void LinkOccSensorToApi(CenOdtOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { CenOdtOccupancySensorBaseJoinMap joinMap = new CenOdtOccupancySensorBaseJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <CenOdtOccupancySensorBaseJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.Online.JoinNumber]); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => { if (args.DeviceOnLine) { trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; } } ); // Occupied status trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, new Action(() => occController.ForceOccupied())); trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, new Action(() => occController.ForceVacant())); occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, new Action <bool>((b) => occController.EnableRawStates(b))); // Timouts trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, new Action <ushort>((u) => occController.SetRemoteTimeout(u))); occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); occController.RemoteTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); // LED Flash trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(true))); trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(false))); occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); // Short Timeout trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(true))); trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(false))); occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); // PIR Sensor trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, new Action(() => occController.SetPirEnable(true))); trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, new Action(() => occController.SetPirEnable(false))); occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); // PIR Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, new Action <bool>((b) => occController.IncrementPirSensitivityInOccupiedState(b))); trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, new Action <bool>((b) => occController.DecrementPirSensitivityInOccupiedState(b))); occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); // PIR Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, new Action <bool>((b) => occController.IncrementPirSensitivityInVacantState(b))); trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, new Action <bool>((b) => occController.DecrementPirSensitivityInVacantState(b))); occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); // OR When Vacated trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, new Action <bool>((b) => occController.SetOrWhenVacatedState(b))); occController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); // AND When Vacated trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, new Action <bool>((b) => occController.SetAndWhenVacatedState(b))); occController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); // Ultrasonic A Sensor trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(true))); trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(false))); occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); // Ultrasonic B Sensor trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(true))); trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(false))); occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); // US Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, new Action <bool>((b) => occController.IncrementUsSensitivityInOccupiedState(b))); trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, new Action <bool>((b) => occController.DecrementUsSensitivityInOccupiedState(b))); occController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); // US Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, new Action <bool>((b) => occController.IncrementUsSensitivityInVacantState(b))); trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, new Action <bool>((b) => occController.DecrementUsSensitivityInVacantState(b))); occController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); //Sensor Raw States occController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); occController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); }
/// <summary> /// /// </summary> /// <param name="appServerController"></param> protected override void CustomRegisterWithAppServer(MobileControlSystemController appServerController) { var asc = appServerController; EISC.SetStringSigAction(SHookState, s => { CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); PostFullStatus(); // SendCallsList(); }); EISC.SetStringSigAction(SCurrentCallNumber, s => { CurrentCallItem.Number = s; PostCallsList(); }); EISC.SetStringSigAction(SCurrentCallName, s => { CurrentCallItem.Name = s; PostCallsList(); }); EISC.SetStringSigAction(SCallDirection, s => { CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true); PostCallsList(); }); EISC.SetBoolSigAction(BCallIncoming, b => { if (b) { var ica = new CodecActiveCallItem() { Direction = eCodecCallDirection.Incoming, Id = "-video-incoming", Name = EISC.GetString(SIncomingCallName), Number = EISC.GetString(SIncomingCallNumber), Status = eCodecCallStatus.Ringing, Type = eCodecCallType.Video }; IncomingCallItem = ica; } else { IncomingCallItem = null; } PostCallsList(); }); EISC.SetBoolSigAction(BCameraSupportsAutoMode, b => { PostStatusMessage(new { cameraSupportsAutoMode = b }); }); EISC.SetBoolSigAction(BCameraSupportsOffMode, b => { PostStatusMessage(new { cameraSupportsOffMode = b }); }); // Directory insanity EISC.SetUShortSigAction(UDirectoryRowCount, u => { // The length of the list comes in before the list does. // Splice the sig change operation onto the last string sig that will be changing // when the directory entries make it through. if (PreviousDirectoryLength > 0) { EISC.ClearStringSigAction(SDirectoryEntriesStart + PreviousDirectoryLength - 1); } EISC.SetStringSigAction(SDirectoryEntriesStart + u - 1, s => PostDirectory()); PreviousDirectoryLength = u; }); EISC.SetStringSigAction(SDirectoryEntrySelectedName, s => { PostStatusMessage(new { directoryContactSelected = new { name = EISC.GetString(SDirectoryEntrySelectedName), } }); }); EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s => { PostStatusMessage(new { directoryContactSelected = new { number = EISC.GetString(SDirectoryEntrySelectedNumber), } }); }); EISC.SetStringSigAction(SDirectorySelectedFolderName, s => PostStatusMessage(new { directorySelectedFolderName = EISC.GetString(SDirectorySelectedFolderName) })); EISC.SetSigTrueAction(BCameraModeAuto, () => PostCameraMode()); EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode()); EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode()); EISC.SetBoolSigAction(BCameraSelfView, b => PostStatusMessage(new { cameraSelfView = b })); EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera()); // Add press and holds using helper action Action <string, uint> addPHAction = (s, u) => AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); addPHAction("/cameraUp", BCameraControlUp); addPHAction("/cameraDown", BCameraControlDown); addPHAction("/cameraLeft", BCameraControlLeft); addPHAction("/cameraRight", BCameraControlRight); addPHAction("/cameraZoomIn", BCameraControlZoomIn); addPHAction("/cameraZoomOut", BCameraControlZoomOut); // Add straight pulse calls using helper action Action <string, uint> addAction = (s, u) => AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); addAction("/endCallById", BDialHangup); addAction("/endAllCalls", BDialHangup); addAction("/acceptById", BIncomingAnswer); addAction("/rejectById", BIncomingReject); addAction("/speedDial1", BSpeedDial1); addAction("/speedDial2", BSpeedDial2); addAction("/speedDial3", BSpeedDial3); addAction("/speedDial4", BSpeedDial4); addAction("/cameraModeAuto", BCameraModeAuto); addAction("/cameraModeManual", BCameraModeManual); addAction("/cameraModeOff", BCameraModeOff); addAction("/cameraSelfView", BCameraSelfView); addAction("/cameraLayout", BCameraLayout); asc.AddAction("/cameraSelect", new Action <string>(SelectCamera)); // camera presets for (uint i = 0; i < 6; i++) { addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i); } asc.AddAction(MessagePath + "/isReady", new Action(PostIsReady)); // Get status asc.AddAction(MessagePath + "/fullStatus", new Action(PostFullStatus)); // Dial on string asc.AddAction(MessagePath + "/dial", new Action <string>(s => EISC.SetString(SCurrentDialString, s))); // Pulse DTMF asc.AddAction(MessagePath + "/dtmf", new Action <string>(s => { if (DTMFMap.ContainsKey(s)) { EISC.PulseBool(DTMFMap[s], 100); } })); // Directory madness asc.AddAction(MessagePath + "/directoryRoot", new Action(() => EISC.PulseBool(BDirectoryRoot))); asc.AddAction(MessagePath + "/directoryBack", new Action(() => EISC.PulseBool(BDirectoryFolderBack))); asc.AddAction(MessagePath + "/directoryById", new Action <string>(s => { // the id should contain the line number to forward to simpl try { var u = ushort.Parse(s); EISC.SetUshort(UDirectorySelectRow, u); EISC.PulseBool(BDirectoryLineSelected); } catch (Exception) { Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "/directoryById request contains non-numeric ID incompatible with DDVC bridge"); } })); asc.AddAction(MessagePath + "/directorySelectContact", new Action <string>(s => { try { var u = ushort.Parse(s); EISC.SetUshort(UDirectorySelectRow, u); EISC.PulseBool(BDirectoryLineSelected); } catch { } })); asc.AddAction(MessagePath + "/directoryDialContact", new Action(() => { EISC.PulseBool(BDirectoryDialSelectedLine); })); asc.AddAction(MessagePath + "/getDirectory", new Action(() => { if (EISC.GetUshort(UDirectoryRowCount) > 0) { PostDirectory(); } else { EISC.PulseBool(BDirectoryRoot); } })); }
public static void LinkToApi(this GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey) { GlsOccupancySensorBaseJoinMap joinMap = new GlsOccupancySensorBaseJoinMap(); var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <GlsOccupancySensorBaseJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); #region Single and Dual Sensor Stuff occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); trilist.StringInput[joinMap.Name].StringValue = occController.Name; trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => { if (args.DeviceOnLine) { trilist.StringInput[joinMap.Name].StringValue = occController.Name; } } ); // Occupied status trilist.SetSigTrueAction(joinMap.ForceOccupied, new Action(() => occController.ForceOccupied())); trilist.SetSigTrueAction(joinMap.ForceVacant, new Action(() => occController.ForceVacant())); occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]); occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]); occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]); trilist.SetBoolSigAction(joinMap.EnableRawStates, new Action <bool>((b) => occController.EnableRawStates(b))); // Timouts trilist.SetUShortSigAction(joinMap.Timeout, new Action <ushort>((u) => occController.SetRemoteTimeout(u))); occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]); occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]); // LED Flash trilist.SetSigTrueAction(joinMap.EnableLedFlash, new Action(() => occController.SetLedFlashEnable(true))); trilist.SetSigTrueAction(joinMap.DisableLedFlash, new Action(() => occController.SetLedFlashEnable(false))); occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]); // Short Timeout trilist.SetSigTrueAction(joinMap.EnableShortTimeout, new Action(() => occController.SetShortTimeoutState(true))); trilist.SetSigTrueAction(joinMap.DisableShortTimeout, new Action(() => occController.SetShortTimeoutState(false))); occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]); // PIR Sensor trilist.SetSigTrueAction(joinMap.EnablePir, new Action(() => occController.SetPirEnable(true))); trilist.SetSigTrueAction(joinMap.DisablePir, new Action(() => occController.SetPirEnable(false))); occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]); // PIR Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, new Action <bool>((b) => occController.IncrementPirSensitivityInOccupiedState(b))); trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, new Action <bool>((b) => occController.DecrementPirSensitivityInOccupiedState(b))); occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]); // PIR Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, new Action <bool>((b) => occController.IncrementPirSensitivityInVacantState(b))); trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, new Action <bool>((b) => occController.DecrementPirSensitivityInVacantState(b))); occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]); #endregion #region Dual Technology Sensor Stuff var odtOccController = occController as GlsOdtOccupancySensorController; if (odtOccController != null) { // OR When Vacated trilist.SetBoolSigAction(joinMap.OrWhenVacated, new Action <bool>((b) => odtOccController.SetOrWhenVacatedState(b))); odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]); // AND When Vacated trilist.SetBoolSigAction(joinMap.AndWhenVacated, new Action <bool>((b) => odtOccController.SetAndWhenVacatedState(b))); odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]); // Ultrasonic A Sensor trilist.SetSigTrueAction(joinMap.EnableUsA, new Action(() => odtOccController.SetUsAEnable(true))); trilist.SetSigTrueAction(joinMap.DisableUsA, new Action(() => odtOccController.SetUsAEnable(false))); odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]); // Ultrasonic B Sensor trilist.SetSigTrueAction(joinMap.EnableUsB, new Action(() => odtOccController.SetUsBEnable(true))); trilist.SetSigTrueAction(joinMap.DisableUsB, new Action(() => odtOccController.SetUsBEnable(false))); odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]); // US Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, new Action <bool>((b) => odtOccController.IncrementUsSensitivityInOccupiedState(b))); trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, new Action <bool>((b) => odtOccController.DecrementUsSensitivityInOccupiedState(b))); odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]); // US Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, new Action <bool>((b) => odtOccController.IncrementUsSensitivityInVacantState(b))); trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, new Action <bool>((b) => odtOccController.DecrementUsSensitivityInVacantState(b))); odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); //Sensor Raw States odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback]); odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback]); } #endregion }
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var inputNumber = 0; var inputKeys = new List <string>(); var joinMap = new DisplayControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DisplayControllerJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); trilist.StringInput[joinMap.Name].StringValue = displayDevice.Name; var commMonitor = displayDevice as ICommunicationMonitor; if (commMonitor != null) { commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); } var inputNumberFeedback = new IntFeedback(() => inputNumber); // Two way feedbacks var twoWayDisplay = displayDevice as TwoWayDisplayBase; if (twoWayDisplay != null) { trilist.SetBool(joinMap.IsTwoWayDisplay, true); twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); } // Power Off trilist.SetSigTrueAction(joinMap.PowerOff, () => { inputNumber = 102; inputNumberFeedback.FireUpdate(); displayDevice.PowerOff(); }); displayDevice.PowerIsOnFeedback.OutputChange += (o, a) => { if (!a.BoolValue) { inputNumber = 102; inputNumberFeedback.FireUpdate(); } else { inputNumber = 0; inputNumberFeedback.FireUpdate(); } }; displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); // PowerOn trilist.SetSigTrueAction(joinMap.PowerOn, () => { inputNumber = 0; inputNumberFeedback.FireUpdate(); displayDevice.PowerOn(); }); displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); var count = 1; foreach (var input in displayDevice.InputPorts) { inputKeys.Add(input.Key); var tempKey = inputKeys.ElementAt(count - 1); trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); count++; } Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); trilist.SetUShortSigAction(joinMap.InputSelect, (a) => { if (a == 0) { displayDevice.PowerOff(); inputNumber = 0; } else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) { displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); inputNumber = a; } else if (a == 102) { displayDevice.PowerToggle(); } if (twoWayDisplay != null) { inputNumberFeedback.FireUpdate(); } }); var volumeDisplay = displayDevice as IBasicVolumeControls; if (volumeDisplay == null) { return; } trilist.SetBoolSigAction(joinMap.VolumeUp, volumeDisplay.VolumeUp); trilist.SetBoolSigAction(joinMap.VolumeDown, volumeDisplay.VolumeDown); trilist.SetSigTrueAction(joinMap.VolumeMute, volumeDisplay.MuteToggle); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; if (volumeDisplayWithFeedback == null) { return; } trilist.SetUShortSigAction(joinMap.VolumeLevel, volumeDisplayWithFeedback.SetVolume); volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]); volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); }
public static void LinkToApi(this DmpsRoutingController dmpsRouter, BasicTriList trilist, uint joinStart, string joinMapKey) { DmpsRoutingControllerJoinMap joinMap = new DmpsRoutingControllerJoinMap(); var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DmpsRoutingControllerJoinMap>(joinMapSerialized); } joinMap.OffsetJoinNumbers(joinStart); Debug.Console(1, dmpsRouter, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // Link up outputs for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherInputs; i++) { Debug.Console(2, dmpsRouter, "Linking Input Card {0}", i); var ioSlot = i; //if (dmpsRouter.TxDictionary.ContainsKey(ioSlot)) //{ // Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); // var TxKey = dmpsRouter.TxDictionary[ioSlot]; // var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase; // //TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); // // TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); // // trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u))); // // TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]); // // trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability; //} //else //{ // // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]); //} if (dmpsRouter.VideoInputSyncFeedbacks[ioSlot] != null) { dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); } if (dmpsRouter.InputNameFeedbacks[ioSlot] != null) { dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); } trilist.SetStringSigAction(joinMap.InputNames + ioSlot, new Action <string>(s => { var inputCard = dmpsRouter.Dmps.SwitcherInputs[ioSlot] as DMInput; if (inputCard != null) { if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) && inputCard.NameFeedback.StringValue != s) { if (inputCard.Name != null) { inputCard.Name.StringValue = s; } } } })); if (dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot] != null) { dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); } } for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherOutputs; i++) { Debug.Console(2, dmpsRouter, "Linking Output Card {0}", i); var ioSlot = i; // Control trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action <ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video))); trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action <ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio))); trilist.SetStringSigAction(joinMap.OutputNames + ioSlot, new Action <string>(s => { var outputCard = dmpsRouter.Dmps.SwitcherOutputs[ioSlot] as DMOutput; //Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot); if (outputCard != null) { //Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType); if (!(outputCard is Crestron.SimplSharpPro.DM.Cards.Card.Dmps3CodecOutput) && outputCard.NameFeedback != null) { if (!string.IsNullOrEmpty(outputCard.NameFeedback.StringValue)) { //Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue); if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null) { outputCard.Name.StringValue = s; } } } } })); // Feedback if (dmpsRouter.VideoOutputFeedbacks[ioSlot] != null) { dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); } if (dmpsRouter.AudioOutputFeedbacks[ioSlot] != null) { dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); } if (dmpsRouter.OutputNameFeedbacks[ioSlot] != null) { dmpsRouter.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); } if (dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot] != null) { dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); } if (dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot] != null) { dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); } if (dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot] != null) { dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); } } }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var deviceJoinMap = new TesiraDspDeviceJoinMapAdvanced(joinStart); var dialerJoinMap = new TesiraDialerJoinMapAdvanced(joinStart); var faderJoinMap = new TesiraFaderJoinMapAdvanced(joinStart); var stateJoinMap = new TesiraStateJoinMapAdvanced(joinStart); var switcherJoinMap = new TesiraSwitcherJoinMapAdvanced(joinStart); var presetJoinMap = new TesiraPresetJoinMapAdvanced(joinStart); var meterJoinMap = new TesiraMeterJoinMapAdvanced(joinStart); var crosspointStateJoinMap = new TesiraCrosspointStateJoinMapAdvanced(joinStart); var roomCombinerJoinMap = new TesiraRoomCombinerJoinMapAdvanced(joinStart); if (bridge != null) { bridge.AddJoinMap(String.Format("{0}--DeviceInfoJoinMap", Key), deviceJoinMap); bridge.AddJoinMap(String.Format("{0}--DialerJoinMap", Key), dialerJoinMap); bridge.AddJoinMap(String.Format("{0}--FaderJoinMap", Key), faderJoinMap); bridge.AddJoinMap(String.Format("{0}--StateJoinMap", Key), stateJoinMap); bridge.AddJoinMap(String.Format("{0}--SwitcherJoinMap", Key), switcherJoinMap); bridge.AddJoinMap(String.Format("{0}--PresetsJoinMap", Key), presetJoinMap); bridge.AddJoinMap(String.Format("{0}--MeterJoinMap", Key), meterJoinMap); bridge.AddJoinMap(String.Format("{0}--CrosspointStateJoinMap", Key), crosspointStateJoinMap); bridge.AddJoinMap(String.Format("{0}--RoomCombinerJoinMap", Key), roomCombinerJoinMap); } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); //var comm = DspDevice as IBasicCommunication; CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[deviceJoinMap.IsOnline.JoinNumber]); CommandPassthruFeedback.LinkInputSig(trilist.StringInput[deviceJoinMap.CommandPassThru.JoinNumber]); trilist.SetStringSigAction(deviceJoinMap.DirectPreset.JoinNumber, RunPreset); trilist.SetStringSigAction(deviceJoinMap.CommandPassThru.JoinNumber, SendLineRaw); //Level and Mute Control Debug.Console(2, this, "There are {0} Level Control Points", Faders.Count()); foreach (var item in Faders) { var channel = item.Value; var data = channel.BridgeIndex; if (data == null) { continue; } var x = (uint)data; //var TesiraChannel = channel.Value as Tesira.DSP.EPI.TesiraDspLevelControl; Debug.Console(2, "TesiraChannel {0} connect", x); var genericChannel = channel as IBasicVolumeWithFeedback; if (!channel.Enabled) { continue; } Debug.Console(2, this, "TesiraChannel {0} Is Enabled", x); channel.NameFeedback.LinkInputSig(trilist.StringInput[faderJoinMap.Label.JoinNumber + x]); channel.TypeFeedback.LinkInputSig(trilist.UShortInput[faderJoinMap.Type.JoinNumber + x]); channel.ControlTypeFeedback.LinkInputSig(trilist.UShortInput[faderJoinMap.Status.JoinNumber + x]); channel.PermissionsFeedback.LinkInputSig(trilist.UShortInput[faderJoinMap.Permissions.JoinNumber + x]); channel.VisibleFeedback.LinkInputSig(trilist.BooleanInput[faderJoinMap.Visible.JoinNumber + x]); genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[faderJoinMap.MuteToggle.JoinNumber + x]); genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[faderJoinMap.MuteOn.JoinNumber + x]); genericChannel.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[faderJoinMap.MuteOff.JoinNumber + x]); genericChannel.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[faderJoinMap.Volume.JoinNumber + x]); trilist.SetSigTrueAction(faderJoinMap.MuteToggle.JoinNumber + x, genericChannel.MuteToggle); trilist.SetSigTrueAction(faderJoinMap.MuteOn.JoinNumber + x, genericChannel.MuteOn); trilist.SetSigTrueAction(faderJoinMap.MuteOff.JoinNumber + x, genericChannel.MuteOff); trilist.SetBoolSigAction(faderJoinMap.VolumeUp.JoinNumber + x, genericChannel.VolumeUp); trilist.SetBoolSigAction(faderJoinMap.VolumeDown.JoinNumber + x, genericChannel.VolumeDown); trilist.SetUShortSigAction(faderJoinMap.Volume.JoinNumber + x, u => { if (u > 0) { genericChannel.SetVolume(u); } }); //channel.Value.DoPoll(); } //states Debug.Console(2, this, "There are {0} State Control Points", States.Count()); foreach (var item in States) { var state = item.Value; var data = state.BridgeIndex; if (data == null) { continue; } var x = (uint)data - 1; Debug.Console(2, this, "Tesira State {0} connect to {1}", state.Key, x); if (!state.Enabled) { continue; } Debug.Console(2, this, "Tesira State {0} at {1} is Enabled", state.Key, x); state.StateFeedback.LinkInputSig(trilist.BooleanInput[stateJoinMap.Toggle.JoinNumber + x]); state.StateFeedback.LinkInputSig(trilist.BooleanInput[stateJoinMap.On.JoinNumber + x]); state.StateFeedback.LinkComplementInputSig(trilist.BooleanInput[stateJoinMap.Off.JoinNumber + x]); state.NameFeedback.LinkInputSig(trilist.StringInput[stateJoinMap.Label.JoinNumber + x]); trilist.SetSigTrueAction(stateJoinMap.Toggle.JoinNumber + x, state.StateToggle); trilist.SetSigTrueAction(stateJoinMap.On.JoinNumber + x, state.StateOn); trilist.SetSigTrueAction(stateJoinMap.Off.JoinNumber + x, state.StateOff); } //Source Selectors Debug.Console(2, this, "There are {0} SourceSelector Control Points", Switchers.Count()); foreach (var item in Switchers) { var switcher = item.Value; var data = switcher.BridgeIndex; if (data == null) { continue; } var y = (uint)data; var x = (ushort)(((y - 1) * 2) + 1); //3 switchers //((1 - 1) * 2) + 1 = 1 //((2 - 1) * 2) + 1 = 3 //((3 - 1) * 2) + 1 = 5 Debug.Console(2, this, "Tesira Switcher {0} connect to {1}", switcher.Key, y); if (!switcher.Enabled) { continue; } Debug.Console(2, this, "Tesira Switcher {0} is Enabled", x); var s = switcher as IRoutingWithFeedback; s.SourceIndexFeedback.LinkInputSig(trilist.UShortInput[switcherJoinMap.Index.JoinNumber + x]); trilist.SetUShortSigAction(switcherJoinMap.Index.JoinNumber + x, u => switcher.SetSource(u)); switcher.NameFeedback.LinkInputSig(trilist.StringInput[switcherJoinMap.Label.JoinNumber + x]); } //Presets trilist.SetStringSigAction(presetJoinMap.PresetName.JoinNumber, RunPreset); foreach (var preset in Presets) { var p = preset; var runPresetIndex = preset.Value.PresetIndex; var presetIndex = runPresetIndex - 1; trilist.StringInput[(uint)(presetJoinMap.PresetNameFeedback.JoinNumber + presetIndex)].StringValue = p.Value.Label; trilist.SetSigTrueAction((uint)(presetJoinMap.PresetSelection.JoinNumber + presetIndex), () => RunPresetNumber((ushort)runPresetIndex)); } // VoIP Dialer uint lineOffset = 0; foreach (var line in Dialers) { var dialer = line.Value; var bridgeIndex = dialer.BridgeIndex; if (bridgeIndex == null) { continue; } var x = (uint)bridgeIndex; var dialerLineOffset = lineOffset += 1; Debug.Console(2, "AddingDialerBRidge {0} {1} Offset", dialer.Key, dialerLineOffset); for (var i = 0; i < dialerJoinMap.KeyPadNumeric.JoinSpan; i++) { trilist.SetSigTrueAction((dialerJoinMap.KeyPadNumeric.JoinNumber + (uint)i + dialerLineOffset), () => dialer.SendKeypad(TesiraDspDialer.eKeypadKeys.Num0)); } trilist.SetSigTrueAction((dialerJoinMap.KeyPadStar.JoinNumber + dialerLineOffset), () => dialer.SendKeypad(TesiraDspDialer.eKeypadKeys.Star)); trilist.SetSigTrueAction((dialerJoinMap.KeyPadPound.JoinNumber + dialerLineOffset), () => dialer.SendKeypad(TesiraDspDialer.eKeypadKeys.Pound)); trilist.SetSigTrueAction((dialerJoinMap.KeyPadClear.JoinNumber + dialerLineOffset), () => dialer.SendKeypad(TesiraDspDialer.eKeypadKeys.Clear)); trilist.SetSigTrueAction((dialerJoinMap.KeyPadBackspace.JoinNumber + dialerLineOffset), () => dialer.SendKeypad(TesiraDspDialer.eKeypadKeys.Backspace)); trilist.SetSigTrueAction(dialerJoinMap.KeyPadDial.JoinNumber + dialerLineOffset, dialer.Dial); trilist.SetSigTrueAction(dialerJoinMap.DoNotDisturbToggle.JoinNumber + dialerLineOffset, dialer.DoNotDisturbToggle); trilist.SetSigTrueAction(dialerJoinMap.DoNotDisturbOn.JoinNumber + dialerLineOffset, dialer.DoNotDisturbOn); trilist.SetSigTrueAction(dialerJoinMap.DoNotDisturbOff.JoinNumber + dialerLineOffset, dialer.DoNotDisturbOff); trilist.SetSigTrueAction(dialerJoinMap.AutoAnswerToggle.JoinNumber + dialerLineOffset, dialer.AutoAnswerToggle); trilist.SetSigTrueAction(dialerJoinMap.AutoAnswerOn.JoinNumber + dialerLineOffset, dialer.AutoAnswerOn); trilist.SetSigTrueAction(dialerJoinMap.AutoAnswerOff.JoinNumber + dialerLineOffset, dialer.AutoAnswerOff); trilist.SetSigTrueAction(dialerJoinMap.Answer.JoinNumber + dialerLineOffset, dialer.Answer); trilist.SetSigTrueAction(dialerJoinMap.EndCall.JoinNumber + dialerLineOffset, dialer.EndAllCalls); trilist.SetSigTrueAction(dialerJoinMap.OnHook.JoinNumber + dialerLineOffset, dialer.OnHook); trilist.SetSigTrueAction(dialerJoinMap.OffHook.JoinNumber + dialerLineOffset, dialer.OffHook); trilist.SetStringSigAction(dialerJoinMap.DialString.JoinNumber + dialerLineOffset, dialer.SetDialString); dialer.DoNotDisturbFeedback.LinkInputSig(trilist.BooleanInput[dialerJoinMap.DoNotDisturbToggle.JoinNumber + dialerLineOffset]); dialer.DoNotDisturbFeedback.LinkInputSig(trilist.BooleanInput[dialerJoinMap.DoNotDisturbOn.JoinNumber + dialerLineOffset]); dialer.DoNotDisturbFeedback.LinkComplementInputSig(trilist.BooleanInput[dialerJoinMap.DoNotDisturbOff.JoinNumber + dialerLineOffset]); dialer.OffHookFeedback.LinkInputSig(trilist.BooleanInput[dialerJoinMap.KeyPadDial.JoinNumber + dialerLineOffset]); dialer.OffHookFeedback.LinkInputSig(trilist.BooleanInput[dialerJoinMap.OffHook.JoinNumber + dialerLineOffset]); dialer.OffHookFeedback.LinkComplementInputSig(trilist.BooleanInput[dialerJoinMap.OnHook.JoinNumber + dialerLineOffset]); dialer.IncomingCallFeedback.LinkInputSig(trilist.BooleanInput[dialerJoinMap.IncomingCall.JoinNumber + dialerLineOffset]); dialer.AutoAnswerFeedback.LinkInputSig(trilist.BooleanInput[dialerJoinMap.AutoAnswerToggle.JoinNumber + dialerLineOffset]); dialer.AutoAnswerFeedback.LinkInputSig(trilist.BooleanInput[dialerJoinMap.AutoAnswerOn.JoinNumber + dialerLineOffset]); dialer.AutoAnswerFeedback.LinkComplementInputSig(trilist.BooleanInput[dialerJoinMap.AutoAnswerOff.JoinNumber + dialerLineOffset]); dialer.NameFeedback.LinkInputSig(trilist.StringInput[dialerJoinMap.Label.JoinNumber + dialerLineOffset]); dialer.DisplayNumberFeedback.LinkInputSig(trilist.StringInput[dialerJoinMap.DisplayNumber.JoinNumber + dialerLineOffset]); dialer.DialStringFeedback.LinkInputSig(trilist.StringInput[dialerJoinMap.DialString.JoinNumber + dialerLineOffset]); dialer.CallerIdNumberFeedback.LinkInputSig(trilist.StringInput[dialerJoinMap.CallerIdNumberFb.JoinNumber + dialerLineOffset]); dialer.CallerIdNameFeedback.LinkInputSig(trilist.StringInput[dialerJoinMap.CallerIdNameFb.JoinNumber + dialerLineOffset]); dialer.LastDialedFeedback.LinkInputSig(trilist.StringInput[dialerJoinMap.LastNumberDialerFb.JoinNumber + dialerLineOffset]); dialer.CallStateFeedback.LinkInputSig(trilist.UShortInput[dialerJoinMap.CallState.JoinNumber + dialerLineOffset]); lineOffset += 50; } Debug.Console(2, this, "There are {0} Meter Control Points", Meters.Count); foreach (var item in Meters) { var meter = item.Value; var data = meter.BridgeIndex; if (data == null) { continue; } var x = (uint)(data - 1); Debug.Console(2, this, "AddingMeterBridge {0} | Join:{1}", meter.Key, meterJoinMap.Label.JoinNumber); meter.MeterFeedback.LinkInputSig(trilist.UShortInput[meterJoinMap.Meter.JoinNumber + x]); meter.NameFeedback.LinkInputSig(trilist.StringInput[meterJoinMap.Label.JoinNumber + x]); meter.SubscribedFeedback.LinkInputSig(trilist.BooleanInput[meterJoinMap.Subscribe.JoinNumber + x]); trilist.SetSigTrueAction(meterJoinMap.Subscribe.JoinNumber, meter.Subscribe); trilist.SetSigFalseAction(meterJoinMap.Subscribe.JoinNumber, meter.UnSubscribe); } Debug.Console(2, this, "There are {0} Crosspoint State Control Points", CrosspointStates.Count); foreach (var item in CrosspointStates) { var xpointState = item.Value; var data = xpointState.BridgeIndex; if (data == null) { continue; } var y = (uint)data; var x = y > 1 ? ((y - 1) * 3) : 0; Debug.Console(2, this, "Adding Crosspoint State ControlPoint {0} | JoinStart:{1}", xpointState.Key, crosspointStateJoinMap.Label.JoinNumber); xpointState.CrosspointStateFeedback.LinkInputSig(trilist.BooleanInput[crosspointStateJoinMap.Toggle.JoinNumber]); xpointState.CrosspointStateFeedback.LinkInputSig(trilist.BooleanInput[crosspointStateJoinMap.On.JoinNumber]); trilist.SetSigTrueAction(crosspointStateJoinMap.Toggle.JoinNumber, xpointState.StateToggle); trilist.SetSigTrueAction(crosspointStateJoinMap.On.JoinNumber, xpointState.StateOn); trilist.SetSigTrueAction(crosspointStateJoinMap.Off.JoinNumber, xpointState.StateOff); } Debug.Console(2, this, "There are {0} Room Combiner Control Points", RoomCombiners.Count); //x = 0; foreach (var item in RoomCombiners) { var roomCombiner = item.Value; var data = roomCombiner.BridgeIndex; if (data == null) { continue; } var y = (uint)data; var x = y > 1 ? ((y - 1) * 6) : 0; Debug.Console(2, "Tesira Room Combiner {0} connect", x); var genericChannel = roomCombiner as IBasicVolumeWithFeedback; if (!roomCombiner.Enabled) { continue; } Debug.Console(2, this, "TesiraChannel {0} Is Enabled", x); roomCombiner.NameFeedback.LinkInputSig(trilist.StringInput[roomCombinerJoinMap.Label.JoinNumber + x]); roomCombiner.VisibleFeedback.LinkInputSig(trilist.BooleanInput[roomCombinerJoinMap.Visible.JoinNumber + x]); roomCombiner.ControlTypeFeedback.LinkInputSig(trilist.UShortInput[roomCombinerJoinMap.Type.JoinNumber + x]); roomCombiner.PermissionsFeedback.LinkInputSig(trilist.UShortInput[roomCombinerJoinMap.Permissions.JoinNumber + x]); roomCombiner.RoomGroupFeedback.LinkInputSig(trilist.UShortInput[roomCombinerJoinMap.Group.JoinNumber + x]); genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[roomCombinerJoinMap.MuteToggle.JoinNumber + x]); genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[roomCombinerJoinMap.MuteOn.JoinNumber + x]); genericChannel.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[roomCombinerJoinMap.MuteOff.JoinNumber + x]); genericChannel.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[roomCombinerJoinMap.Volume.JoinNumber + x]); trilist.SetSigTrueAction(roomCombinerJoinMap.MuteToggle.JoinNumber + x, genericChannel.MuteToggle); trilist.SetSigTrueAction(roomCombinerJoinMap.MuteOn.JoinNumber + x, genericChannel.MuteOn); trilist.SetSigTrueAction(roomCombinerJoinMap.MuteOff.JoinNumber + x, genericChannel.MuteOff); trilist.SetBoolSigAction(roomCombinerJoinMap.VolumeUp.JoinNumber + x, genericChannel.VolumeUp); trilist.SetBoolSigAction(roomCombinerJoinMap.VolumeDown.JoinNumber + x, genericChannel.VolumeDown); trilist.SetUShortSigAction(roomCombinerJoinMap.Volume.JoinNumber + x, u => { if (u > 0) { genericChannel.SetVolume(u); } }); trilist.SetUShortSigAction(roomCombinerJoinMap.Group.JoinNumber + x, u => { if (u > 0) { roomCombiner.SetRoomGroup(u); } }); } trilist.OnlineStatusChange += (d, args) => { if (!args.DeviceOnLine) { return; } foreach (var feedback in Feedbacks) { feedback.FireUpdate(); } }; }
protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <GlsOccupancySensorBaseJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); #region Single and Dual Sensor Stuff occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; trilist.OnlineStatusChange += (d, args) => { if (args.DeviceOnLine) { trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; } }; // Occupied status trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied); trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant); occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates); // Timouts trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout); occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); // LED Flash trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true)); trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false)); occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); // Short Timeout trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true)); trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false)); occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); // PIR Sensor trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true)); trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false)); occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); // PIR Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, occController.IncrementPirSensitivityInOccupiedState); trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, occController.DecrementPirSensitivityInOccupiedState); occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); // PIR Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, occController.IncrementPirSensitivityInVacantState); trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, occController.DecrementPirSensitivityInVacantState); occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); #endregion #region Dual Technology Sensor Stuff var odtOccController = occController as GlsOdtOccupancySensorController; if (odtOccController == null) { return; } // OR When Vacated trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState); odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); // AND When Vacated trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState); odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); // Ultrasonic A Sensor trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true)); trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false)); odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); // Ultrasonic B Sensor trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true)); trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false)); odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); // US Sensitivity in Occupied State trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, odtOccController.IncrementUsSensitivityInOccupiedState); trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, odtOccController.DecrementUsSensitivityInOccupiedState); odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); // US Sensitivity in Vacant State trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, odtOccController.IncrementUsSensitivityInVacantState); trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, odtOccController.DecrementUsSensitivityInVacantState); odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); //Sensor Raw States odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); #endregion }
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var inputNumber = 0; var inputKeys = new List <string>(); var joinMap = new DisplayControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DisplayControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; var commMonitor = displayDevice as ICommunicationMonitor; if (commMonitor != null) { commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); } var inputNumberFeedback = new IntFeedback(() => inputNumber); // Two way feedbacks var twoWayDisplay = displayDevice as TwoWayDisplayBase; if (twoWayDisplay != null) { trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); } // Power Off trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => { inputNumber = 102; inputNumberFeedback.FireUpdate(); displayDevice.PowerOff(); }); displayDevice.PowerIsOnFeedback.OutputChange += (o, a) => { if (!a.BoolValue) { inputNumber = 102; inputNumberFeedback.FireUpdate(); } else { inputNumber = 0; inputNumberFeedback.FireUpdate(); } }; displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); // PowerOn trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => { inputNumber = 0; inputNumberFeedback.FireUpdate(); displayDevice.PowerOn(); }); displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); for (int i = 0; i < displayDevice.InputPorts.Count; i++) { if (i < joinMap.InputNamesOffset.JoinSpan) { inputKeys.Add(displayDevice.InputPorts[i].Key); var tempKey = inputKeys.ElementAt(i); trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString()); trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); } else { Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count); } } Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => { if (a == 0) { displayDevice.PowerOff(); inputNumber = 0; } else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) { displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); inputNumber = a; } else if (a == 102) { displayDevice.PowerToggle(); } if (twoWayDisplay != null) { inputNumberFeedback.FireUpdate(); } }); var volumeDisplay = displayDevice as IBasicVolumeControls; if (volumeDisplay == null) { return; } trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp); trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown); trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; if (volumeDisplayWithFeedback == null) { return; } trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn); trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff); trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume); volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]); volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]); volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]); volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); }