mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-17 05:35:03 +00:00
ResponseObject.cs updates: Added and tested SortParticipantListtByHandStatus method. Found an issue with HandStatus response, property names include ': ', updated JsonProperty definitions to account for issues with expected returns vs. actual returns.
This commit is contained in:
@@ -848,7 +848,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
private bool _offHook;
|
||||
|
||||
public string CallId { get; set; }
|
||||
public bool IsIncomingCall {
|
||||
public bool IsIncomingCall
|
||||
{
|
||||
get { return _isIncomingCall; }
|
||||
set
|
||||
{
|
||||
@@ -856,7 +857,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
|
||||
_isIncomingCall = value;
|
||||
NotifyPropertyChanged("IsIncomingCall");
|
||||
} }
|
||||
}
|
||||
}
|
||||
|
||||
public string PeerDisplayName
|
||||
{
|
||||
@@ -1180,7 +1182,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
private string _selectedId;
|
||||
|
||||
[JsonProperty("selectedId")]
|
||||
public string SelectedId {
|
||||
public string SelectedId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedId;
|
||||
@@ -1325,14 +1328,27 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
|
||||
public class HandStatus
|
||||
{
|
||||
[JsonProperty("is_raise_hand")]
|
||||
// example return of the "hand_status" object
|
||||
// !!!! Note the properties contain ': ' within the property name !!!
|
||||
//"hand_status": {
|
||||
// "is_raise_hand: ": false,
|
||||
// "is_valid: ": "on",
|
||||
// "time_stamp: ": "11825083"
|
||||
//},
|
||||
[JsonProperty("is_raise_hand: ")]
|
||||
public bool IsRaiseHand { get; set; }
|
||||
[JsonProperty("is_valid")]
|
||||
public bool IsValid { get; set; }
|
||||
[JsonProperty("time_stamp")]
|
||||
[JsonProperty("is_valid: ")]
|
||||
public string IsValid { get; set; }
|
||||
[JsonProperty("time_stamp: ")]
|
||||
public string TimeStamp { get; set; }
|
||||
/// <summary>
|
||||
/// Retuns a boolean value if the participant hand state is raised and is valid (both need to be true)
|
||||
/// </summary>
|
||||
public bool HandIsRaisedAndValid
|
||||
{
|
||||
get { return IsValid != null && IsValid == "on" && IsRaiseHand; }
|
||||
}
|
||||
}
|
||||
|
||||
public class ListParticipant
|
||||
{
|
||||
[JsonProperty("audio_status state")]
|
||||
@@ -1395,13 +1411,28 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
HandStatus = new HandStatus();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts ZoomRoom pariticpant list response to an Essentials participant list
|
||||
/// </summary>
|
||||
/// <param name="participants"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Participant> GetGenericParticipantListFromParticipantsResult(
|
||||
List<ListParticipant> participants)
|
||||
{
|
||||
return
|
||||
participants.Select(
|
||||
p =>
|
||||
new Participant
|
||||
//return participants.Select(p => new Participant
|
||||
// {
|
||||
// UserId = p.UserId,
|
||||
// Name = p.UserName,
|
||||
// IsHost = p.IsHost,
|
||||
// CanMuteVideo = p.IsVideoCanMuteByHost,
|
||||
// CanUnmuteVideo = p.IsVideoCanUnmuteByHost,
|
||||
// AudioMuteFb = p.AudioStatusState == "AUDIO_MUTED",
|
||||
// VideoMuteFb = p.VideoStatusIsSending,
|
||||
// HandIsRaisedFb = p.HandStatus.HandIsRaisedAndValid,
|
||||
// }).ToList();
|
||||
|
||||
var sortedParticipants = SortParticipantListByHandStatus(participants);
|
||||
return sortedParticipants.Select(p => new Participant
|
||||
{
|
||||
UserId = p.UserId,
|
||||
Name = p.UserName,
|
||||
@@ -1410,9 +1441,57 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
CanUnmuteVideo = p.IsVideoCanUnmuteByHost,
|
||||
AudioMuteFb = p.AudioStatusState == "AUDIO_MUTED",
|
||||
VideoMuteFb = p.VideoStatusIsSending,
|
||||
HandIsRaisedFb = p.HandStatus.IsValid && p.HandStatus.IsRaiseHand,
|
||||
HandIsRaisedFb = p.HandStatus.HandIsRaisedAndValid,
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will sort by hand-raise status and then alphabetically
|
||||
/// </summary>
|
||||
/// <param name="participants">Zoom Room response list of participants</param>
|
||||
/// <returns>List</returns>
|
||||
public static List<ListParticipant> SortParticipantListByHandStatus(List<ListParticipant> participants)
|
||||
{
|
||||
if (participants == null)
|
||||
{
|
||||
Debug.Console(1, "SortParticiapntListByHandStatu(participants == null)");
|
||||
return null;
|
||||
}
|
||||
|
||||
// debug testing
|
||||
foreach (ListParticipant participant in participants)
|
||||
{
|
||||
Debug.Console(1, "{0} | IsValid: {1} | IsRaiseHand: {2} | HandIsRaisedAndValid: {3}",
|
||||
participant.UserName, participant.HandStatus.IsValid, participant.HandStatus.IsRaiseHand.ToString(), participant.HandStatus.HandIsRaisedAndValid.ToString());
|
||||
}
|
||||
|
||||
List<ListParticipant> handRaisedParticipantsList = participants.Where(p => p.HandStatus.HandIsRaisedAndValid).ToList();
|
||||
|
||||
if (handRaisedParticipantsList != null)
|
||||
{
|
||||
IOrderedEnumerable<ListParticipant> orderByDescending = handRaisedParticipantsList.OrderByDescending(p => p.HandStatus.TimeStamp);
|
||||
|
||||
foreach (var participant in handRaisedParticipantsList)
|
||||
Debug.Console(1, "handRaisedParticipantList: {0} | {1}", participant.UserName, participant.UserId);
|
||||
}
|
||||
|
||||
List<ListParticipant> allOtherParticipantsList = participants.Where(p => !p.HandStatus.HandIsRaisedAndValid).ToList();
|
||||
|
||||
if (allOtherParticipantsList != null)
|
||||
{
|
||||
allOtherParticipantsList.OrderBy(p => p.UserName);
|
||||
|
||||
foreach (var participant in allOtherParticipantsList)
|
||||
Debug.Console(1, "allOtherParticipantsList: {0} | {1}", participant.UserName, participant.UserId);
|
||||
}
|
||||
|
||||
// merge the lists
|
||||
List<ListParticipant> sortedList = handRaisedParticipantsList.Union(allOtherParticipantsList).ToList();
|
||||
|
||||
// return the sorted list
|
||||
return sortedList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CallinCountryList
|
||||
|
||||
Reference in New Issue
Block a user