public override bool CustomActivate() { // Create EiscApis if (Properties.Eiscs != null) { foreach (var eisc in Properties.Eiscs) { var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname); } } foreach (var deviceKey in Properties.CommDevices) { var device = DeviceManager.GetDeviceForKey(deviceKey); if (device != null) { Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key); CommDevices.Add(device as IBasicCommunication); } else { Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey); } } // Iterate through all the CommDevices and link up their Actions and Feedbacks Debug.Console(0, "Bridge {0} Activated", this.Name); return(true); }
public EssentialComm(string key, string name, JToken properties) : base(key, name) { Properties = JsonConvert.DeserializeObject <EssentialCommConfig>(properties.ToString()); CommFeedbacks = new Dictionary <string, StringFeedback>(); CommDictionary = new Dictionary <uint, EssentialCommsPort>(); Apis = new List <BridgeApiEisc>(); int commNumber = 1; foreach (var commConfig in Properties.CommConnections) { var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", this.Key, commConfig.joinNumber)); CommDictionary.Add(commConfig.joinNumber, commPort); commNumber++; } foreach (var Ipid in Properties.EiscApiIpids) { var ApiEisc = new BridgeApiEisc(Ipid); Apis.Add(ApiEisc); foreach (var commConnection in CommDictionary) { Debug.Console(2, "Joining Api{0} to comm {1}", Ipid, commConnection.Key); var tempComm = commConnection.Value; var tempJoin = (uint)commConnection.Key; EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin); tempComm.Outputs.Add(ApiMap); // Check for ApiMap Overide Values here ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => { if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); } }); ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s)); tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]); tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]); } ApiEisc.Eisc.Register(); } }
public override bool CustomActivate() { int commNumber = 1; foreach (var commConfig in Properties.CommConnections) { var commPort = new EssentialCommsPort(commConfig.control, string.Format("{0}-{1}", Key, commConfig.joinNumber)); CommDictionary.Add(commConfig.joinNumber, commPort); commNumber++; } foreach (var Ipid in Properties.EiscApiIpids) { var ApiEisc = new BridgeApiEisc(Ipid); Apis.Add(ApiEisc); foreach (var commConnection in CommDictionary) { Debug.Console(0, "Joining Api{0} to comm {1}", Ipid, commConnection.Key); var tempComm = commConnection.Value; var tempJoin = (uint)commConnection.Key; EssentialComApiMap ApiMap = new EssentialComApiMap(ApiEisc, (uint)tempJoin); tempComm.Outputs.Add(ApiMap); // Check for ApiMap Overide Values here ApiEisc.Eisc.SetBoolSigAction(tempJoin, b => { if (b) { tempComm.Comm.Connect(); } else { tempComm.Comm.Disconnect(); } }); ApiEisc.Eisc.SetStringSigAction(tempJoin, s => tempComm.Comm.SendText(s)); tempComm.StatusFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[tempJoin]); tempComm.ConnectedFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[tempJoin]); } } return(true); }
public override bool CustomActivate() { // Create EiscApis try { foreach (var device in DeviceManager.AllDevices) { if (device.Key == this.Properties.connectionDeviceKey) { Debug.Console(2, "deviceKey {0} Matches", device.Key); TVOneCorio = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.TVOneCorio; break; } else { Debug.Console(2, "deviceKey {0} doesn't match", device.Key); } } if (Properties.EiscApiIpids != null && TVOneCorio != null) { foreach (string Ipid in Properties.EiscApiIpids) { var ApiEisc = new BridgeApiEisc(Ipid); Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, TVOneCorio.Name); ushort x = 1; TVOneCorio.OnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]); ApiEisc.Eisc.SetUShortSigAction(ApiMap.CallPreset, u => TVOneCorio.CallPreset(u)); TVOneCorio.PresetFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.PresetFeedback]); } } Debug.Console(2, "Name {0} Activated", this.Name); return(true); } catch (Exception e) { Debug.Console(0, "Bridge {0}", e); return(false); } }
public EssentialComApiMap(BridgeApiEisc api, uint join) { Join = join; Api = api; }
public override bool CustomActivate() { // Create EiscApis try { foreach (var device in DeviceManager.AllDevices) { if (device.Key == this.Properties.connectionDeviceKey) { Debug.Console(2, "deviceKey {0} Matches", device.Key); DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController; } else { Debug.Console(2, "deviceKey {0} doesn't match", device.Key); } } if (Properties.EiscApiIpids != null) { foreach (string Ipid in Properties.EiscApiIpids) { var ApiEisc = new BridgeApiEisc(Ipid); for (uint x = 1; x <= DmSwitch.Chassis.NumberOfInputs; x++) { uint tempX = x; Debug.Console(2, "Creating EiscActions {0}", tempX); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[tempX], u => DmSwitch.ExecuteSwitch(u, tempX, eRoutingSignalType.Audio)); if (DmSwitch.TxDictionary.ContainsKey(tempX)) { Debug.Console(2, "Creating Tx Feedbacks {0}", tempX); var TxKey = DmSwitch.TxDictionary[tempX]; var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase; TxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxOnlineStatus[tempX]]); TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]); ApiEisc.Eisc.SetUShortSigAction((ApiMap.HdcpSupport[tempX]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u))); TxDevice.HdcpSupportAllFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupport[tempX]]); ApiEisc.Eisc.UShortInput[ApiMap.HdcpSupportCapability[tempX]].UShortValue = TxDevice.HdcpSupportCapability; } else { DmSwitch.VideoInputSyncFeedbacks[tempX].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.TxVideoSyncStatus[tempX]]); } if (DmSwitch.RxDictionary.ContainsKey(tempX)) { Debug.Console(2, "Creating Rx Feedbacks {0}", tempX); var RxKey = DmSwitch.RxDictionary[tempX]; var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase; RxDevice.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.RxOnlineStatus[tempX]]); } // DmSwitch.InputEndpointOnlineFeedbacks[(ushort)tempOutputNum].LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.OutputVideoRoutes[tempOutputNum]]); DmSwitch.VideoOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[tempX]]); DmSwitch.AudioOutputFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputAudioRoutes[tempX]]); DmSwitch.InputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.InputNames[tempX]]); DmSwitch.OutputNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputNames[tempX]]); DmSwitch.OutputRouteNameFeedbacks[(ushort)tempX].LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.OutputRouteNames[tempX]]); } DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]); ApiEisc.Eisc.Register(); } } Debug.Console(2, "Name {0} Activated", this.Name); return(true); } catch (Exception e) { Debug.Console(2, "BRidge {0}", e); return(false); } }
public override bool CustomActivate() { // Create EiscApis try { ICommunicationMonitor comm = null; foreach (var device in DeviceManager.AllDevices) { if (device.Key == this.Properties.connectionDeviceKey) { if (!(device is ICommunicationMonitor)) { comm = device as ICommunicationMonitor; } Debug.Console(2, "deviceKey {0} Matches", device.Key); Dsp = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Devices.Common.DSP.QscDsp; break; } else { Debug.Console(2, "deviceKey {0} doesn't match", device.Key); } } if (Properties.EiscApiIpids != null && Dsp != null) { foreach (string Ipid in Properties.EiscApiIpids) { var ApiEisc = new BridgeApiEisc(Ipid); Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, Dsp.Name); ushort x = 1; if (comm != null) { comm.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]); } foreach (var channel in Dsp.LevelControlPoints) { //var QscChannel = channel.Value as PepperDash.Essentials.Devices.Common.DSP.QscDspLevelControl; Debug.Console(2, "QscChannel {0} connect", x); var genericChannel = channel.Value as IBasicVolumeWithFeedback; if (channel.Value.Enabled) { ApiEisc.Eisc.StringInput[ApiMap.channelName[x]].StringValue = channel.Value.LevelCustomName; ApiEisc.Eisc.UShortInput[ApiMap.channelType[x]].UShortValue = (ushort)channel.Value.Type; genericChannel.MuteFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.channelMuteToggle[x]]); genericChannel.VolumeLevelFeedback.LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.channelVolume[x]]); ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteToggle[x], () => genericChannel.MuteToggle()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOn[x], () => genericChannel.MuteOn()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.channelMuteOff[x], () => genericChannel.MuteOff()); ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeUp[x], b => genericChannel.VolumeUp(b)); ApiEisc.Eisc.SetBoolSigAction(ApiMap.channelVolumeDown[x], b => genericChannel.VolumeDown(b)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.channelVolume[x], u => genericChannel.SetVolume(u)); ApiEisc.Eisc.SetStringSigAction(ApiMap.presetString, s => Dsp.RunPreset(s)); } x++; } x = 1; foreach (var preset in Dsp.PresetList) { ApiEisc.Eisc.StringInput[ApiMap.presets[x]].StringValue = preset.label; ApiEisc.Eisc.SetSigTrueAction(ApiMap.presets[x], () => Dsp.RunPresetNumber(x)); x++; } foreach (var dialer in Dsp.Dialers) { ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad0, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num0)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad1, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num1)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad2, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num2)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad3, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num3)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad4, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num4)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad5, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num5)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad6, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num6)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad7, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num7)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad8, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num8)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Keypad9, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Num9)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadStar, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Star)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadPound, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Pound)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadClear, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Clear)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.KeypadBackspace, () => dialer.Value.SendKeypad(PepperDash.Essentials.Devices.Common.DSP.QscDspDialer.eKeypadKeys.Backspace)); ApiEisc.Eisc.SetSigTrueAction(ApiMap.Dial, () => dialer.Value.Dial()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbToggle, () => dialer.Value.DoNotDisturbToggle()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOn, () => dialer.Value.DoNotDisturbOn()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.DoNotDisturbOff, () => dialer.Value.DoNotDisturbOff()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerToggle, () => dialer.Value.AutoAnswerToggle()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOn, () => dialer.Value.AutoAnswerOn()); ApiEisc.Eisc.SetSigTrueAction(ApiMap.AutoAnswerOff, () => dialer.Value.AutoAnswerOff()); dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbToggle]); dialer.Value.DoNotDisturbFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOn]); dialer.Value.DoNotDisturbFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.DoNotDisturbOff]); dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerToggle]); dialer.Value.AutoAnswerFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOn]); dialer.Value.AutoAnswerFeedback.LinkComplementInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.AutoAnswerOff]); dialer.Value.OffHookFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Dial]); dialer.Value.DialStringFeedback.LinkInputSig(ApiEisc.Eisc.StringInput[ApiMap.DialString]); } } } Debug.Console(2, "Name {0} Activated", this.Name); return(true); } catch (Exception e) { Debug.Console(0, "Bridge {0}", e); return(false); } }
public override bool CustomActivate() { // Create EiscApis try { foreach (var device in DeviceManager.AllDevices) { if (device.Key == this.Properties.connectionDeviceKey) { Debug.Console(0, "deviceKey {0} Matches", device.Key); DmSwitch = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.DM.DmChassisController; } else { Debug.Console(0, "deviceKey {0} doesn't match", device.Key); } } if (Properties.EiscApiIpids != null) { foreach (string Ipid in Properties.EiscApiIpids) { var ApiEisc = new BridgeApiEisc(Ipid); // BridgeApiEiscs.Add(ApiEisc); //Essentials.Core.CommFactory.CreateCommForConfig(); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[1], u => DmSwitch.ExecuteSwitch(u, 1, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[2], u => DmSwitch.ExecuteSwitch(u, 2, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[3], u => DmSwitch.ExecuteSwitch(u, 3, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[4], u => DmSwitch.ExecuteSwitch(u, 4, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[5], u => DmSwitch.ExecuteSwitch(u, 5, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[6], u => DmSwitch.ExecuteSwitch(u, 6, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[7], u => DmSwitch.ExecuteSwitch(u, 7, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputVideoRoutes[8], u => DmSwitch.ExecuteSwitch(u, 8, eRoutingSignalType.Video)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[1], u => DmSwitch.ExecuteSwitch(u, 1, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[2], u => DmSwitch.ExecuteSwitch(u, 2, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[3], u => DmSwitch.ExecuteSwitch(u, 3, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[4], u => DmSwitch.ExecuteSwitch(u, 4, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[5], u => DmSwitch.ExecuteSwitch(u, 5, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[6], u => DmSwitch.ExecuteSwitch(u, 6, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[7], u => DmSwitch.ExecuteSwitch(u, 7, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction(ApiMap.OutputAudioRoutes[8], u => DmSwitch.ExecuteSwitch(u, 8, eRoutingSignalType.Audio)); foreach (var output in DmSwitch.Chassis.Outputs) { Debug.Console(0, "Creating EiscActions {0}", output.Number); DmSwitch.InputEndpointOnlineFeedbacks[(ushort)output.Number].LinkInputSig(ApiEisc.Eisc.BooleanInput[(ushort)(output.Number + 300)]); /* This wont work...routes to 8 every time i tried for loops, forweach. For some reason the test number keeps going to max value of the loop * always routing testNum to MaxLoopValue, the above works though.*/ for (uint testNum = 1; testNum < 8; testNum++) { uint num = testNum; ApiEisc.Eisc.SetUShortSigAction((ushort)(output.Number + 300), u => DmSwitch.ExecuteSwitch(u, num, eRoutingSignalType.Audio)); ApiEisc.Eisc.SetUShortSigAction((ushort)(output.Number + 100), u => DmSwitch.ExecuteSwitch(u, num, eRoutingSignalType.Video)); } DmSwitch.OutputRouteFeedbacks[(ushort)output.Number].LinkInputSig(ApiEisc.Eisc.UShortInput[ApiMap.OutputVideoRoutes[(int)output.Number]]); } DmSwitch.IsOnline.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.ChassisOnline]); ApiEisc.Eisc.Register(); } } Debug.Console(0, "Name {0} Activated", this.Name); return(true); } catch (Exception e) { Debug.Console(0, "BRidge {0}", e); return(false); } }