void OnInputPinProbeData(InputPin origin, string request) { if (origin.GetType().Name == _inputPinName && InputPinData != null) { InputPinData(origin, request); } }
public void ProcessRequest(InputPin origin, string request) { string originName = origin.GetType().Name; Logger.LogInfo("Received a remote control command from {0} ... message = {1}", originName, request); if (_trainMode) { Logger.LogInfo("RCC Manager is started. All received commands will be sent to the RCC Manager instead of output pins."); // Send command to the RCC Manager RaiseInputPinDataEvent(origin, request); return; } foreach (RCCServiceConfig.RemoteControlRow row in _config.RemoteControl.Rows) { if (row.InputPinName == originName && row.InputPinCfgData == origin.CfgData) { // Have found the origin input pin. // But is it enabled ? if (row.Enabled) { // See if we have an output to send the command to ... if (_outputPins.ContainsKey(row.OutputPinName + row.OutputPinCfgData)) { // There is a valid output pin. // If the destination is ProTONE Player ... is this configured to be controlled remotely ? if (row.OutputPinName == typeof(ProTONEOutputPin).Name && !ProTONERemoteConfig.EnableRemoteControl) { // ProTONE player can't accept remoting comands. // so discard the command Logger.LogInfo("ProTONE has EnableRemoteControl set to False. Discarding command."); return; } // No restrictions. OutputPin destination = _outputPins[row.OutputPinName + row.OutputPinCfgData]; if (destination != null) { bool canDispatch = false; RCCServiceConfig.RemoteButtonsRow button = null; if (origin is RemotingInputPin && destination is ProTONEOutputPin) { // This pin combination is always allowed to pass. canDispatch = true; } else { canDispatch = DispatchToOutputPin(row.RemoteName, request, out button); } if (canDispatch) { destination.SendRequest(request, button); } return; } } } else { Logger.LogInfo("Although an input pin was found, can't dispatch command. The origin remote control: {0} seems to be disabled.", row.RemoteName); return; } // No chance for a valid output pin ... break; } } Logger.LogInfo("There is no valid output pin connected to input pin {0}. Check the service configuration ...", originName); }
public void ProcessRequest(InputPin origin, string request) { string originName = origin.GetType().Name; Logger.LogInfo("Received a remote control command from {0} ... message = {1}", originName, request); if (_trainMode) { Logger.LogInfo("RCC Manager is started. All received commands will be sent to the RCC Manager instead of output pins."); // Send command to the RCC Manager RaiseInputPinDataEvent(origin, request); return; } foreach (RCCServiceConfig.RemoteControlRow row in _config.RemoteControl.Rows) { if (row.InputPinName == originName && row.InputPinCfgData == origin.CfgData) { // Have found the origin input pin. // But is it enabled ? if (row.Enabled) { // See if we have an output to send the command to ... if (_outputPins.ContainsKey(row.OutputPinName + row.OutputPinCfgData)) { // There is a valid output pin. // If the destination is ProTONE Player ... is this configured to be controlled remotely ? if (row.OutputPinName == typeof(ProTONEOutputPin).Name && !ProTONERemoteConfig.EnableRemoteControl) { // ProTONE player can't accept remoting comands. // so discard the command Logger.LogInfo("ProTONE has EnableRemoteControl set to False. Discarding command."); return; } // No restrictions. OutputPin destination = _outputPins[row.OutputPinName + row.OutputPinCfgData]; if (destination != null) { bool canDispatch = false; RCCServiceConfig.RemoteButtonsRow button = null; if (origin is RemotingInputPin && destination is ProTONEOutputPin) { // This pin combination is always allowed to pass. canDispatch = true; } else { canDispatch = DispatchToOutputPin(row.RemoteName, request, out button); } if (canDispatch) destination.SendRequest(request, button); return; } } } else { Logger.LogInfo("Although an input pin was found, can't dispatch command. The origin remote control: {0} seems to be disabled.", row.RemoteName); return; } // No chance for a valid output pin ... break; } } Logger.LogInfo("There is no valid output pin connected to input pin {0}. Check the service configuration ...", originName); }