public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new SystemMonitorJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <SystemMonitorJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(2, this, "Linking API starting at join: {0}", joinStart); TimeZoneFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeZone.JoinNumber]); TimeZoneTextFeedback.LinkInputSig(trilist.StringInput[joinMap.TimeZoneName.JoinNumber]); IoControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.IOControllerVersion.JoinNumber]); SnmpVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.SnmpAppVersion.JoinNumber]); BaCnetAppVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.BACnetAppVersion.JoinNumber]); ControllerVersionFeedback.LinkInputSig(trilist.StringInput[joinMap.ControllerVersion.JoinNumber]); SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumber.JoinNumber]); ModelFeedback.LinkInputSig(trilist.StringInput[joinMap.Model.JoinNumber]); UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime.JoinNumber]); LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot.JoinNumber]); // iterate the program status feedback collection and map all the joins LinkProgramInfoJoins(this, trilist, joinMap); LinkEthernetInfoJoins(this, trilist, joinMap); }
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]); }
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 override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new C2nRthsControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <C2nRthsControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); trilist.SetBoolSigAction(joinMap.TemperatureFormat.JoinNumber, SetTemperatureFormat); IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature.JoinNumber]); HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmpsAudioOutputControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DmpsAudioOutputControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); if (MasterVolumeLevel != null) { SetUpDmpsAudioOutputJoins(trilist, MasterVolumeLevel, joinMap.MasterVolumeLevel.JoinNumber); } if (SourceVolumeLevel != null) { SetUpDmpsAudioOutputJoins(trilist, SourceVolumeLevel, joinMap.SourceVolumeLevel.JoinNumber); } if (Codec1VolumeLevel != null) { SetUpDmpsAudioOutputJoins(trilist, Codec1VolumeLevel, joinMap.Codec1VolumeLevel.JoinNumber); } if (Codec2VolumeLevel != null) { SetUpDmpsAudioOutputJoins(trilist, Codec2VolumeLevel, joinMap.Codec2VolumeLevel.JoinNumber); } }
/// <summary> /// This method gets called by the EiscApi bridge and calls your bridge extension method /// </summary> /// <param name="trilist"></param> /// <param name="joinStart"></param> /// <param name="joinMapKey"></param> public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { // Construct the default join map var joinMap = new MockOccupancyDetectorBridgeJoinMap(joinStart); // Attempt to get a custom join map if specified in config var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); // If we find a custom join map, deserialize it if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <MockOccupancyDetectorBridgeJoinMap>(joinMapSerialized); } //Checking if the bridge is null allows for backwards compatability with configurations that use EiscApi instead of EiscApiAdvanced if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } // Set all your join actions here // Link all your feedbacks to joins here }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new IDigitalInputJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <IDigitalInputJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); try { Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // Link feedback for input state InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]); } catch (Exception e) { Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key); Debug.Console(1, this, "Error: {0}", e); } }
/// <summary> /// Links the plugin device to the EISC bridge /// </summary> /// <param name="trilist"></param> /// <param name="joinStart"></param> /// <param name="joinMapKey"></param> /// <param name="bridge"></param> public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new EssentialsPluginBridgeJoinMapTemplate(joinStart); // This adds the join map to the collection on the bridge if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); if (customJoins != null) { joinMap.SetCustomJoinData(customJoins); } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); // TODO [ ] Implement bridge links as needed // links to bridge trilist.SetString(joinMap.DeviceName.JoinNumber, Name); trilist.OnlineStatusChange += (o, a) => { if (!a.DeviceOnLine) { return; } trilist.SetString(joinMap.DeviceName.JoinNumber, Name); }; }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new IBasicCommunicationJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <IBasicCommunicationJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); if (CommPort == null) { Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key); return; } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // this is a permanent event handler. This cannot be -= from event CommPort.TextReceived += (s, a) => { Debug.Console(2, this, "RX: {0}", a.Text); trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text); }; trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s)); trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig); var sComm = CommPort as ISocketStatus; if (sComm == null) { return; } sComm.ConnectionChange += (s, a) => { trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)(a.Client.ClientStatus)); trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus == SocketStatus.SOCKET_STATUS_CONNECTED); }; trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, b => { if (b) { sComm.Connect(); } else { sComm.Disconnect(); } }); }
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)); }
/// <summary> /// Links the plugin device to the EISC bridge /// </summary> /// <param name="trilist"></param> /// <param name="joinStart"></param> /// <param name="joinMapKey"></param> /// <param name="bridge"></param> public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new RVCDisplayBridgeJoinMap(joinStart); // This adds the join map to the collection on the bridge if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } // TODO: figure out how best way to handle base and override class maps and ranges LinkDisplayToApi(this, trilist, joinStart, joinMapKey, null); var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); if (customJoins != null) { joinMap.SetCustomJoinData(customJoins); } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); // links to bridge /// eJoinCapabilities.ToFromSIMPL - FromSIMPL action //trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, sig => Connect = sig); /// eJoinCapabilities.ToFromSIMPL - ToSIMPL subscription //ConnectFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Connect.JoinNumber]); /// eJoinCapabilities.ToFromSIMPL - ToSIMPL subscription StatusFeedback.LinkInputSig(trilist.UShortInput[joinMap.Status.JoinNumber]); /// eJoinCapabilities.ToSIMPL - set string once as this is not changeble info trilist.SetString(joinMap.Driver.JoinNumber, _display.GetType().AssemblyQualifiedName); UpdateFeedbacks(); /// Propagate String/Serial values through eisc when it becomes online trilist.OnlineStatusChange += (o, a) => { if (!a.DeviceOnLine) { return; } trilist.SetString(joinMap.Driver.JoinNumber, _display.GetType().AssemblyQualifiedName); UpdateFeedbacks(); }; }
// 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 override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new TesiraCrosspointStateJoinMapAdvancedStandalone(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <TesiraCrosspointStateJoinMapAdvancedStandalone>(joinMapSerialized); } if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(2, "Tesira Crosspoint State {0} connect", Key); if (!Enabled) { return; } Debug.Console(2, this, "Adding Crosspoint State ControlPoint {0} | JoinStart:{1}", Key, joinMap.Label.JoinNumber); CrosspointStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Toggle.JoinNumber]); CrosspointStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.On.JoinNumber]); trilist.SetSigTrueAction(joinMap.Toggle.JoinNumber, StateToggle); trilist.SetSigTrueAction(joinMap.On.JoinNumber, StateOn); trilist.SetSigTrueAction(joinMap.Off.JoinNumber, StateOff); trilist.OnlineStatusChange += (d, args) => { if (!args.DeviceOnLine) { return; } foreach (var feedback in Feedbacks) { feedback.FireUpdate(); } }; }
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(); } }; }
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]); }
/// <summary> /// Links the plugin device to the EISC bridge /// </summary> /// <param name="trilist"></param> /// <param name="joinStart"></param> /// <param name="joinMapKey"></param> /// <param name="bridge"></param> public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new MockOccupancyDetectorPluginBridgeJoinMap(joinStart); // This adds the join map to the collection on the bridge if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); if (customJoins != null) { joinMap.SetCustomJoinData(customJoins); } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); // TODO [ ] Implement bridge links as needed // links to bridge trilist.SetString(joinMap.DeviceName.JoinNumber, Name); //trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, sig => Connect = sig); //ConnectFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Connect.JoinNumber]); //StatusFeedback.LinkInputSig(trilist.UShortInput[joinMap.Status.JoinNumber]); //OnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); //UpdateFeedbacks(); //trilist.OnlineStatusChange += (o, a) => //{ // if (!a.DeviceOnLine) return; // trilist.SetString(joinMap.DeviceName.JoinNumber, Name); // UpdateFeedbacks(); //}; }
/// <summary> /// Links the plugin device to the EISC bridge /// </summary> /// <param name="trilist"></param> /// <param name="joinStart"></param> /// <param name="joinMapKey"></param> /// <param name="bridge"></param> public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new ClearOneDSPBridgeJoinMap(joinStart); // This adds the join map to the collection on the bridge if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); if (customJoins != null) { joinMap.SetCustomJoinData(customJoins); } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); // links to bridge /// eJoinCapabilities.ToFromSIMPL - ToSIMPL subscription StatusFeedback.LinkInputSig(trilist.UShortInput[joinMap.Status.JoinNumber]); UpdateFeedbacks(); /// Propagate String/Serial values through eisc when it becomes online trilist.OnlineStatusChange += (o, a) => { if (!a.DeviceOnLine) { return; } //trilist.SetString(joinMap.Driver.JoinNumber, _display.GetType().AssemblyQualifiedName); UpdateFeedbacks(); }; }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new TesiraMeterJoinMapAdvancedStandalone(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <TesiraMeterJoinMapAdvancedStandalone>(joinMapSerialized); } if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } Debug.Console(2, this, "AddingMeterBridge {0} | Join:{1}", Key, joinMap.Label.JoinNumber); MeterFeedback.LinkInputSig(trilist.UShortInput[joinMap.Meter.JoinNumber]); NameFeedback.LinkInputSig(trilist.StringInput[joinMap.Label.JoinNumber]); SubscribedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Subscribe.JoinNumber]); trilist.SetSigTrueAction(joinMap.Subscribe.JoinNumber, Subscribe); trilist.SetSigFalseAction(joinMap.Subscribe.JoinNumber, UnSubscribe); trilist.OnlineStatusChange += (d, args) => { if (!args.DeviceOnLine) { return; } foreach (var feedback in Feedbacks) { feedback.FireUpdate(); } }; }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GenericRelayControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <GenericRelayControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); if (RelayOutput == null) { Debug.Console(1, this, "Unable to link device '{0}'. Relay is null", Key); return; } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); trilist.SetBoolSigAction(joinMap.Relay.JoinNumber, b => { if (b) { CloseRelay(); } else { OpenRelay(); } }); // feedback for relay state OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new AppleTvJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <AppleTvJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name); trilist.SetBoolSigAction(joinMap.UpArrow.JoinNumber, Up); trilist.SetBoolSigAction(joinMap.DnArrow.JoinNumber, Down); trilist.SetBoolSigAction(joinMap.LeftArrow.JoinNumber, Left); trilist.SetBoolSigAction(joinMap.RightArrow.JoinNumber, Right); trilist.SetBoolSigAction(joinMap.Select.JoinNumber, Select); trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, Menu); trilist.SetBoolSigAction(joinMap.PlayPause.JoinNumber, Play); }
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); }; }
protected void LinkCameraToApi(CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { CameraControllerJoinMap joinMap = new CameraControllerJoinMap(joinStart); // Adds the join map to the bridge bridge.AddJoinMap(cameraDevice.Key, joinMap); var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); if (customJoins != null) { joinMap.SetCustomJoinData(customJoins); } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString()); var commMonitor = cameraDevice as ICommunicationMonitor; commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig( trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); var ptzCamera = cameraDevice as IHasCameraPtzControl; if (ptzCamera != null) { trilist.SetBoolSigAction(joinMap.PanLeft.JoinNumber, (b) => { if (b) { ptzCamera.PanLeft(); } else { ptzCamera.PanStop(); } }); trilist.SetBoolSigAction(joinMap.PanRight.JoinNumber, (b) => { if (b) { ptzCamera.PanRight(); } else { ptzCamera.PanStop(); } }); trilist.SetBoolSigAction(joinMap.TiltUp.JoinNumber, (b) => { if (b) { ptzCamera.TiltUp(); } else { ptzCamera.TiltStop(); } }); trilist.SetBoolSigAction(joinMap.TiltDown.JoinNumber, (b) => { if (b) { ptzCamera.TiltDown(); } else { ptzCamera.TiltStop(); } }); trilist.SetBoolSigAction(joinMap.ZoomIn.JoinNumber, (b) => { if (b) { ptzCamera.ZoomIn(); } else { ptzCamera.ZoomStop(); } }); trilist.SetBoolSigAction(joinMap.ZoomOut.JoinNumber, (b) => { if (b) { ptzCamera.ZoomOut(); } else { ptzCamera.ZoomStop(); } }); } if (cameraDevice is IPower) { var powerCamera = cameraDevice as IPower; trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => powerCamera.PowerOn()); trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => powerCamera.PowerOff()); powerCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); powerCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); } if (cameraDevice is ICommunicationMonitor) { var monitoredCamera = cameraDevice as ICommunicationMonitor; monitoredCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig( trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); } if (cameraDevice is IHasCameraPresets) { // Set the preset lables when they change var presetsCamera = cameraDevice as IHasCameraPresets; presetsCamera.PresetsListHasChanged += new EventHandler <EventArgs>((o, a) => { for (int i = 1; i <= joinMap.NumberOfPresets.JoinNumber; i++) { int tempNum = i - 1; string label = ""; var preset = presetsCamera.Presets.FirstOrDefault(p => p.ID.Equals(i)); if (preset != null) { label = preset.Description; } trilist.SetString((ushort)(joinMap.PresetLabelStart.JoinNumber + tempNum), label); } }); for (int i = 0; i < joinMap.NumberOfPresets.JoinNumber; i++) { int tempNum = i; trilist.SetSigTrueAction((ushort)(joinMap.PresetRecallStart.JoinNumber + tempNum), () => { presetsCamera.PresetSelect(tempNum); }); trilist.SetSigTrueAction((ushort)(joinMap.PresetSaveStart.JoinNumber + tempNum), () => { var label = trilist.GetString((ushort)(joinMap.PresetLabelStart.JoinNumber + tempNum)); presetsCamera.PresetStore(tempNum, label); }); } } }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmpsRoutingControllerJoinMap(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <DmpsRoutingControllerJoinMap>(joinMapSerialized); } bridge.AddJoinMap(Key, joinMap); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // Link up outputs for (uint i = 1; i <= Dmps.NumberOfSwitcherInputs; i++) { Debug.Console(2, this, "Linking Input Card {0}", i); var ioSlot = i; var ioSlotJoin = ioSlot - 1; //if (TxDictionary.ContainsKey(ioSlot)) //{ // Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); // var TxKey = 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 (VideoInputSyncFeedbacks[ioSlot] != null) { VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]); } if (InputNameFeedbacks[ioSlot] != null) { InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]); } trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, new Action <string>(s => { var inputCard = 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 (InputEndpointOnlineFeedbacks[ioSlot] != null) { InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]); } } for (uint i = 1; i <= Dmps.NumberOfSwitcherOutputs; i++) { Debug.Console(2, this, "Linking Output Card {0}", i); var ioSlot = i; var ioSlotJoin = ioSlot - 1; // Control trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)); trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)); trilist.SetStringSigAction(joinMap.OutputNames.JoinNumber + ioSlotJoin, s => { var outputCard = 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 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 (VideoOutputFeedbacks[ioSlot] != null) { VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]); } if (AudioOutputFeedbacks[ioSlot] != null) { AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]); } if (OutputNameFeedbacks[ioSlot] != null) { OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]); } if (OutputVideoRouteNameFeedbacks[ioSlot] != null) { OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]); } if (OutputAudioRouteNameFeedbacks[ioSlot] != null) { OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]); } if (OutputEndpointOnlineFeedbacks[ioSlot] != null) { OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]); } } }
void IBridgeAdvanced.LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new TesiraDialerJoinMapAdvancedStandalone(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <TesiraDialerJoinMapAdvancedStandalone>(joinMapSerialized); } if (bridge != null) { bridge.AddJoinMap(Key, joinMap); } Debug.Console(2, "Adding Dialer {0}", Key); for (var i = 0; i < joinMap.KeyPadNumeric.JoinSpan; i++) { trilist.SetSigTrueAction((joinMap.KeyPadNumeric.JoinNumber + (uint)i), () => SendKeypad(eKeypadKeys.Num0)); } trilist.SetSigTrueAction((joinMap.KeyPadStar.JoinNumber), () => SendKeypad(eKeypadKeys.Star)); trilist.SetSigTrueAction((joinMap.KeyPadPound.JoinNumber), () => SendKeypad(eKeypadKeys.Pound)); trilist.SetSigTrueAction((joinMap.KeyPadClear.JoinNumber), () => SendKeypad(eKeypadKeys.Clear)); trilist.SetSigTrueAction((joinMap.KeyPadBackspace.JoinNumber), () => SendKeypad(eKeypadKeys.Backspace)); trilist.SetSigTrueAction(joinMap.KeyPadDial.JoinNumber, Dial); trilist.SetSigTrueAction(joinMap.DoNotDisturbToggle.JoinNumber, DoNotDisturbToggle); trilist.SetSigTrueAction(joinMap.DoNotDisturbOn.JoinNumber, DoNotDisturbOn); trilist.SetSigTrueAction(joinMap.DoNotDisturbOff.JoinNumber, DoNotDisturbOff); trilist.SetSigTrueAction(joinMap.AutoAnswerToggle.JoinNumber, AutoAnswerToggle); trilist.SetSigTrueAction(joinMap.AutoAnswerOn.JoinNumber, AutoAnswerOn); trilist.SetSigTrueAction(joinMap.AutoAnswerOff.JoinNumber, AutoAnswerOff); trilist.SetSigTrueAction(joinMap.Answer.JoinNumber, Answer); trilist.SetSigTrueAction(joinMap.EndCall.JoinNumber, EndAllCalls); trilist.SetSigTrueAction(joinMap.OnHook.JoinNumber, OnHook); trilist.SetSigTrueAction(joinMap.OffHook.JoinNumber, OffHook); trilist.SetStringSigAction(joinMap.DialString.JoinNumber, SetDialString); DisplayNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.DisplayNumber.JoinNumber]); NameFeedback.LinkInputSig(trilist.StringInput[joinMap.Label.JoinNumber]); DoNotDisturbFeedback.LinkInputSig(trilist.BooleanInput[joinMap.DoNotDisturbToggle.JoinNumber]); DoNotDisturbFeedback.LinkInputSig(trilist.BooleanInput[joinMap.DoNotDisturbOn.JoinNumber]); DoNotDisturbFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.DoNotDisturbOff.JoinNumber]); OffHookFeedback.LinkInputSig(trilist.BooleanInput[joinMap.KeyPadDial.JoinNumber]); OffHookFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OffHook.JoinNumber]); OffHookFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.OnHook.JoinNumber]); IncomingCallFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IncomingCall.JoinNumber]); AutoAnswerFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoAnswerToggle.JoinNumber]); AutoAnswerFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoAnswerOn.JoinNumber]); AutoAnswerFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.AutoAnswerOff.JoinNumber]); DialStringFeedback.LinkInputSig(trilist.StringInput[joinMap.DialString.JoinNumber]); CallerIdNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.CallerIdNumberFb.JoinNumber]); CallerIdNameFeedback.LinkInputSig(trilist.StringInput[joinMap.CallerIdNameFb.JoinNumber]); LastDialedFeedback.LinkInputSig(trilist.StringInput[joinMap.LastNumberDialerFb.JoinNumber]); CallStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.CallState.JoinNumber]); trilist.OnlineStatusChange += (d, args) => { if (!args.DeviceOnLine) { return; } foreach (var feedback in Feedbacks) { feedback.FireUpdate(); } }; }
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 }
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 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]); }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new TesiraDspDeviceJoinMapAdvancedStandalone(joinStart); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(joinMapSerialized)) { joinMap = JsonConvert.DeserializeObject <TesiraDspDeviceJoinMapAdvancedStandalone>(joinMapSerialized); } var presetJoinMap = new TesiraPresetJoinMapAdvancedStandalone(joinStart); var presetJoinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); if (!string.IsNullOrEmpty(presetJoinMapSerialized)) { presetJoinMap = JsonConvert.DeserializeObject <TesiraPresetJoinMapAdvancedStandalone>(presetJoinMapSerialized); } if (bridge != null) { bridge.AddJoinMap(Key, joinMap); bridge.AddJoinMap(Key, presetJoinMap); } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); //var comm = DspDevice as IBasicCommunication; trilist.SetStringSigAction(presetJoinMap.PresetName.JoinNumber, _parent.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), () => _parent.RunPresetNumber((ushort)runPresetIndex)); } _parent.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); _parent.CommandPassthruFeedback.LinkInputSig(trilist.StringInput[joinMap.CommandPassThru.JoinNumber]); NameFeedback.LinkInputSig((trilist.StringInput[joinMap.Name.JoinNumber])); trilist.SetStringSigAction(joinMap.CommandPassThru.JoinNumber, _parent.SendLineRaw); 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]); }