diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasParticipants.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasParticipants.cs index f03c1984..f6d32149 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasParticipants.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasParticipants.cs @@ -90,5 +90,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces public bool HandIsRaisedFb { get; set; } public bool IsPinnedFb { get; set; } public int ScreenIndexIsPinnedToFb { get; set; } + + public Participant() + { + // Initialize to -1 (no screen) + ScreenIndexIsPinnedToFb = -1; + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index 38ae0295..fc38a647 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs @@ -530,28 +530,43 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec private void LinkVideoCodecParticipantsToApi(IHasParticipants codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap) { + // make sure to update the values when the EISC comes online + trilist.OnlineStatusChange += (sender, args) => + { + if (sender.IsOnline) + { + UpdateParticipantsXSig(codec, trilist, joinMap); + } + }; + + // set actions and update the values when the list changes codec.Participants.ParticipantsListHasChanged += (sender, args) => { - string participantsXSig; - - if (codec.Participants.CurrentParticipants.Count == 0) - { - participantsXSig = Encoding.GetEncoding(XSigEncoding).GetString(_clearBytes, 0, _clearBytes.Length); - trilist.SetString(joinMap.CurrentParticipants.JoinNumber, participantsXSig); - trilist.SetUshort(joinMap.ParticipantCount.JoinNumber, (ushort)codec.Participants.CurrentParticipants.Count); - return; - } - SetParticipantActions(trilist, joinMap, codec.Participants.CurrentParticipants); - participantsXSig = UpdateParticipantsXSig(codec.Participants.CurrentParticipants); - - trilist.SetString(joinMap.CurrentParticipants.JoinNumber, participantsXSig); - - trilist.SetUshort(joinMap.ParticipantCount.JoinNumber, (ushort)codec.Participants.CurrentParticipants.Count); + UpdateParticipantsXSig(codec, trilist, joinMap); }; } + private void UpdateParticipantsXSig(IHasParticipants codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap) + { + string participantsXSig; + + if (codec.Participants.CurrentParticipants.Count == 0) + { + participantsXSig = Encoding.GetEncoding(XSigEncoding).GetString(_clearBytes, 0, _clearBytes.Length); + trilist.SetString(joinMap.CurrentParticipants.JoinNumber, participantsXSig); + trilist.SetUshort(joinMap.ParticipantCount.JoinNumber, (ushort)codec.Participants.CurrentParticipants.Count); + return; + } + + participantsXSig = UpdateParticipantsXSig(codec.Participants.CurrentParticipants); + + trilist.SetString(joinMap.CurrentParticipants.JoinNumber, participantsXSig); + + trilist.SetUshort(joinMap.ParticipantCount.JoinNumber, (ushort)codec.Participants.CurrentParticipants.Count); + } + /// /// Sets the actions for each participant in the list /// @@ -615,19 +630,21 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec Debug.Console(2, this, @"Updating Participant on xsig: -Name: {0} (s{8}) -AudioMute: {1} (d{9}) -VideoMute: {2} (d{10}) -CanMuteVideo: {3} ({d11}) -IsHost: {4} (d{12}) -HandIsRaised: {5} (d{13}) -IsPinned: {6} (d{14}) -ScreenIndexIsPinnedTo: {7} (a{15}) +Name: {0} (s{9}) +AudioMute: {1} (d{10}) +VideoMute: {2} (d{11}) +CanMuteVideo: {3} (d{12}) +CanUMuteVideo: {4} (d{13}) +IsHost: {5} (d{14}) +HandIsRaised: {6} (d{15}) +IsPinned: {7} (d{16}) +ScreenIndexIsPinnedTo: {8} (a{17}) ", participant.Name, participant.AudioMuteFb, participant.VideoMuteFb, participant.CanMuteVideo, + participant.CanUnmuteVideo, participant.IsHost, participant.HandIsRaisedFb, participant.IsPinnedFb, @@ -653,6 +670,8 @@ ScreenIndexIsPinnedTo: {7} (a{15}) tokenArray[digitalIndex + 5] = new XSigDigitalToken(digitalIndex + 6, participant.HandIsRaisedFb); tokenArray[digitalIndex + 6] = new XSigDigitalToken(digitalIndex + 7, participant.IsPinnedFb); + Debug.Console(2, this, "Index: {0} byte value: {1}", digitalIndex + 7, ComTextHelper.GetEscapedText(tokenArray[digitalIndex + 6].GetBytes())); + //serials tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, participant.Name); @@ -688,7 +707,12 @@ ScreenIndexIsPinnedTo: {7} (a{15}) analogIndex += maxAnalogs; } - return GetXSigString(tokenArray); + var returnString = GetXSigString(tokenArray); + + //Debug.Console(2, this, "{0}", ComTextHelper.GetEscapedText(Encoding.GetEncoding(28591).GetBytes(returnString))); + + + return returnString; } private void LinkVideoCodecContentSharingToApi(BasicTriList trilist, VideoCodecControllerJoinMap joinMap)