Example #1
0
 public void SetPrivacyDevice(IPrivacy privacyDevice)
 {
     PrivacyDevice = privacyDevice;
 }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="props"></param>
        /// <param name="room"></param>
        /// <returns></returns>
        public static Core.Privacy.MicrophonePrivacyController GetMicrophonePrivacy(
            EssentialsRoomPropertiesConfig props, IPrivacy room)
        {
            var microphonePrivacy = props.MicrophonePrivacy;

            if (microphonePrivacy == null)
            {
                Debug.Console(0, "Cannot create microphone privacy with null properties");
                return(null);
            }
            // Get the MicrophonePrivacy device from the device manager
            var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as
                      Core.Privacy.MicrophonePrivacyController);

            // Set this room as the IPrivacy device
            if (mP == null)
            {
                Debug.Console(0, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey);
                return(null);
            }
            mP.SetPrivacyDevice(room);

            var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();

            if (behaviour == null)
            {
                Debug.Console(0, "WARNING: No behaviour defined for MicrophonePrivacyController");
                return(null);
            }
            if (behaviour == "trackroomstate")
            {
                // Tie LED enable to room power state
                var essRoom = room as EssentialsRoomBase;
                essRoom.OnFeedback.OutputChange += (o, a) =>
                {
                    if (essRoom.OnFeedback.BoolValue)
                    {
                        mP.EnableLeds = true;
                    }
                    else
                    {
                        mP.EnableLeds = false;
                    }
                };

                mP.EnableLeds = essRoom.OnFeedback.BoolValue;
            }
            else if (behaviour == "trackcallstate")
            {
                // Tie LED enable to room power state
                var inCallRoom = room as IHasInCallFeedback;
                inCallRoom.InCallFeedback.OutputChange += (o, a) =>
                {
                    if (inCallRoom.InCallFeedback.BoolValue)
                    {
                        mP.EnableLeds = true;
                    }
                    else
                    {
                        mP.EnableLeds = false;
                    }
                };

                mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue;
            }

            return(mP);
        }