/// <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); }
/// <inheritdoc/> public bool UseForVideoRecording(ActivityId videoRecording) { if (videoRecording == null) { throw new ArgumentNullException(nameof(videoRecording)); } if (IsAvailable()) { return(AssumeRole(RoleInActivity.Recording(videoRecording))); } return(false); }
bool IsAudioRecording(ActivityId audioRecording) { return(IsInRole(RoleInActivity.Recording(audioRecording))); }
/// <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); }
/// <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();
/// <summary> /// Makes the device available. /// </summary> public void MakeAvailable() { currentRoleInActivity = RoleInActivity.None(); }