예제 #1
0
        /// <summary>
        /// Verifies if the device is in a role during an activity given by <paramref name="roleInActivty"/>.
        /// </summary>
        /// <param name="roleInActivty">
        /// The role in an activity the device playsmight be part of.
        /// </param>
        /// <returns>
        /// <see langword="true"/>, if the device is ain the role;
        /// <see langword="false"/> otherwise.
        /// </returns>
        public bool IsInRole(RoleInActivity roleInActivty)
        {
            if (roleInActivty == null)
            {
                throw new ArgumentNullException(nameof(roleInActivty));
            }

            return(currentRoleInActivity == roleInActivty);
        }
예제 #2
0
        /// <inheritdoc/>
        public bool UseForVideoRecording(ActivityId videoRecording)
        {
            if (videoRecording == null)
            {
                throw new ArgumentNullException(nameof(videoRecording));
            }

            if (IsAvailable())
            {
                return(AssumeRole(RoleInActivity.Recording(videoRecording)));
            }

            return(false);
        }
예제 #3
0
 bool IsAudioRecording(ActivityId audioRecording)
 {
     return(IsInRole(RoleInActivity.Recording(audioRecording)));
 }
예제 #4
0
 /// <summary>
 /// Attempts to assume a role in an activty given by <paramref name="roleInActivty"/>
 /// </summary>
 /// <param name="roleInActivty">
 /// The role in an activty the device should to assume.
 /// </param>
 /// <returns>
 /// <see langword="true"/>, if the device can assume the role; <see langword="false"/> otherwise.
 /// </returns>
 protected bool AssumeRole(RoleInActivity roleInActivty)
 {
     currentRoleInActivity = roleInActivty;
     return(true);
 }
예제 #5
0
 /// <summary>
 /// Verifies if the device is available.
 /// </summary>
 /// <returns>
 /// <see langword="true"/>, if the device is available; <see langword="false"/> otherwise.
 /// </returns>
 public bool IsAvailable() => currentRoleInActivity == RoleInActivity.None();
예제 #6
0
 /// <summary>
 /// Makes the device available.
 /// </summary>
 public void MakeAvailable()
 {
     currentRoleInActivity = RoleInActivity.None();
 }