/// <summary> /// /// </summary> /// <param name="devKey"></param> void SetupSourceFunctions(string devKey) { SourceDeviceMapDictionary sourceJoinMap = new SourceDeviceMapDictionary(); var prefix = string.Format("/device/{0}/", devKey); foreach (var item in sourceJoinMap) { var join = item.Value; Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(join, b))); } }
/// <summary> /// Setup the actions to take place on various incoming API calls /// </summary> void SetupFunctions() { Parent.AddAction(@"/room/room1/promptForCode", new Action(() => EISC.PulseBool(JoinMap.PromptForCode.JoinNumber))); Parent.AddAction(@"/room/room1/clientJoined", new Action(() => EISC.PulseBool(JoinMap.ClientJoined.JoinNumber))); Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus)); Parent.AddAction(@"/room/room1/source", new Action <SourceSelectMessageContent>(c => { EISC.SetString(JoinMap.CurrentSourceKey.JoinNumber, c.SourceListItem); EISC.PulseBool(JoinMap.SourceHasChanged.JoinNumber); })); Parent.AddAction(@"/room/room1/defaultsource", new Action(() => EISC.PulseBool(JoinMap.ActivityShare.JoinNumber))); Parent.AddAction(@"/room/room1/activityPhone", new Action(() => EISC.PulseBool(JoinMap.ActivityPhoneCall.JoinNumber))); Parent.AddAction(@"/room/room1/activityVideo", new Action(() => EISC.PulseBool(JoinMap.ActivityVideoCall.JoinNumber))); Parent.AddAction(@"/room/room1/volumes/master/level", new Action <ushort>(u => EISC.SetUshort(JoinMap.MasterVolume.JoinNumber, u))); Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() => EISC.PulseBool(JoinMap.MasterVolume.JoinNumber))); Parent.AddAction(@"/room/room1/volumes/master/privacyMuteToggle", new Action(() => EISC.PulseBool(JoinMap.PrivacyMute.JoinNumber))); // /xyzxyz/volumes/master/muteToggle ---> BoolInput[1] var volumeStart = JoinMap.VolumeJoinStart.JoinNumber; var volumeEnd = JoinMap.VolumeJoinStart.JoinNumber + JoinMap.VolumeJoinStart.JoinSpan; for (uint i = volumeStart; i <= volumeEnd; i++) { var index = i; Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/level", index), new Action <ushort>(u => EISC.SetUshort(index, u))); Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/muteToggle", index), new Action(() => EISC.PulseBool(index))); } Parent.AddAction(@"/room/room1/shutdownStart", new Action(() => EISC.PulseBool(JoinMap.ShutdownStart.JoinNumber))); Parent.AddAction(@"/room/room1/shutdownEnd", new Action(() => EISC.PulseBool(JoinMap.ShutdownEnd.JoinNumber))); Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() => EISC.PulseBool(JoinMap.ShutdownCancel.JoinNumber))); }
/// <summary> /// Setup the actions to take place on various incoming API calls /// </summary> void SetupFunctions() { Parent.AddAction(@"/room/room1/promptForCode", new Action(() => EISC.PulseBool(BoolJoin.PromptForCode))); Parent.AddAction(@"/room/room1/clientJoined", new Action(() => EISC.PulseBool(BoolJoin.ClientJoined))); Parent.AddAction(@"/room/room1/status", new Action(SendFullStatus)); Parent.AddAction(@"/room/room1/source", new Action <SourceSelectMessageContent>(c => { EISC.SetString(StringJoin.SelectedSourceKey, c.SourceListItem); EISC.PulseBool(BoolJoin.SourceHasChanged); })); Parent.AddAction(@"/room/room1/defaultsource", new Action(() => EISC.PulseBool(BoolJoin.ActivityShare))); Parent.AddAction(@"/room/room1/activityPhone", new Action(() => EISC.PulseBool(BoolJoin.ActivityPhoneCall))); Parent.AddAction(@"/room/room1/activityVideo", new Action(() => EISC.PulseBool(BoolJoin.ActivityVideoCall))); Parent.AddAction(@"/room/room1/volumes/master/level", new Action <ushort>(u => EISC.SetUshort(UshortJoin.MasterVolumeLevel, u))); Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() => EISC.PulseBool(BoolJoin.MasterVolumeIsMuted))); Parent.AddAction(@"/room/room1/volumes/master/privacyMuteToggle", new Action(() => EISC.PulseBool(BoolJoin.PrivacyMute))); // /xyzxyz/volumes/master/muteToggle ---> BoolInput[1] for (uint i = 2; i <= 7; i++) { var index = i; Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/level", index), new Action <ushort>(u => EISC.SetUshort(index, u))); Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/muteToggle", index), new Action(() => EISC.PulseBool(index))); } Parent.AddAction(@"/room/room1/shutdownStart", new Action(() => EISC.PulseBool(BoolJoin.ShutdownStart))); Parent.AddAction(@"/room/room1/shutdownEnd", new Action(() => EISC.PulseBool(BoolJoin.ShutdownEnd))); Parent.AddAction(@"/room/room1/shutdownCancel", new Action(() => EISC.PulseBool(BoolJoin.ShutdownCancel))); }
/// <summary> /// Override of base: calls base to add parent and then registers actions and events. /// </summary> /// <param name="parent"></param> public override void AddParent(MobileControlSystemController parent) { base.AddParent(parent); // we add actions to the messaging system with a path, and a related action. Custom action // content objects can be handled in the controller's LineReceived method - and perhaps other // sub-controller parsing could be attached to these classes, so that the systemController // doesn't need to know about everything. // Source Changes and room off Parent.AddAction(string.Format(@"/room/{0}/status", Room.Key), new Action(() => SendFullStatus(Room))); var routeRoom = Room as IRunRouteAction; if (routeRoom != null) { Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action <SourceSelectMessageContent>(c => routeRoom.RunRouteAction(c.SourceListItem))); } var defaultRoom = Room as IRunDefaultPresentRoute; if (defaultRoom != null) { Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(() => defaultRoom.RunDefaultPresentRoute())); } var volumeRoom = Room as IHasCurrentVolumeControls; if (volumeRoom != null) { Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action <ushort>(u => (volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u))); Parent.AddAction(string.Format(@"/room/{0}/volumes/master/muteToggle", Room.Key), new Action(() => volumeRoom.CurrentVolumeControls.MuteToggle())); volumeRoom.CurrentVolumeDeviceChange += new EventHandler <VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange); // Registers for initial volume events, if possible var currentVolumeDevice = volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback; if (currentVolumeDevice != null) { currentVolumeDevice.MuteFeedback.OutputChange += MuteFeedback_OutputChange; currentVolumeDevice.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange; } } var sscRoom = Room as IHasCurrentSourceInfoChange; if (sscRoom != null) { sscRoom.CurrentSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); } var vcRoom = Room as IHasVideoCodec; if (vcRoom != null && vcRoom.VideoCodec != null) { var codec = vcRoom.VideoCodec; var key = vcRoom.VideoCodec.Key + "-" + parent.Key; VCMessenger = new VideoCodecBaseMessenger(key, vcRoom.VideoCodec, "/device/videoCodec"); VCMessenger.RegisterWithAppServer(Parent); vcRoom.IsSharingFeedback.OutputChange += new EventHandler <FeedbackEventArgs>(IsSharingFeedback_OutputChange); } var acRoom = Room as IHasAudioCodec; if (acRoom != null && acRoom.AudioCodec != null) { var codec = acRoom.AudioCodec; var key = acRoom.AudioCodec.Key + "-" + parent.Key; ACMessenger = new AudioCodecBaseMessenger(key, acRoom.AudioCodec, "/device/audioCodec"); ACMessenger.RegisterWithAppServer(Parent); } var defCallRm = Room as IRunDefaultCallRoute; if (defCallRm != null) { Parent.AddAction(string.Format(@"/room/{0}/activityVideo", Room.Key), new Action(() => defCallRm.RunDefaultCallRoute())); } Parent.AddAction(string.Format(@"/room/{0}/shutdownStart", Room.Key), new Action(() => Room.StartShutdown(eShutdownType.Manual))); Parent.AddAction(string.Format(@"/room/{0}/shutdownEnd", Room.Key), new Action(() => Room.ShutdownPromptTimer.Finish())); Parent.AddAction(string.Format(@"/room/{0}/shutdownCancel", Room.Key), new Action(() => Room.ShutdownPromptTimer.Cancel())); Room.OnFeedback.OutputChange += OnFeedback_OutputChange; Room.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; Room.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange; Room.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted; Room.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished; Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; }