MutableCallParticipantModel.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Nextcloud Talk application
  3. *
  4. * @author Daniel Calviño Sánchez
  5. * Copyright (C) 2022 Daniel Calviño Sánchez <danxuliu@gmail.com>
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. package com.nextcloud.talk.call;
  21. import org.webrtc.MediaStream;
  22. import org.webrtc.PeerConnection;
  23. /**
  24. * Mutable data model for (remote) call participants.
  25. *
  26. * There is no synchronization when setting the values; if needed, it should be handled by the clients of the model.
  27. */
  28. public class MutableCallParticipantModel extends CallParticipantModel {
  29. public MutableCallParticipantModel(String sessionId) {
  30. super(sessionId);
  31. }
  32. public void setUserId(String userId) {
  33. this.userId.setValue(userId);
  34. }
  35. public void setNick(String nick) {
  36. this.nick.setValue(nick);
  37. }
  38. public void setInternal(Boolean internal) {
  39. this.internal.setValue(internal);
  40. }
  41. public void setRaisedHand(boolean state, long timestamp) {
  42. this.raisedHand.setValue(new RaisedHand(state, timestamp));
  43. }
  44. public void setIceConnectionState(PeerConnection.IceConnectionState iceConnectionState) {
  45. this.iceConnectionState.setValue(iceConnectionState);
  46. }
  47. public void setMediaStream(MediaStream mediaStream) {
  48. this.mediaStream.setValue(mediaStream);
  49. }
  50. public void setAudioAvailable(Boolean audioAvailable) {
  51. this.audioAvailable.setValue(audioAvailable);
  52. }
  53. public void setVideoAvailable(Boolean videoAvailable) {
  54. this.videoAvailable.setValue(videoAvailable);
  55. }
  56. public void setScreenIceConnectionState(PeerConnection.IceConnectionState screenIceConnectionState) {
  57. this.screenIceConnectionState.setValue(screenIceConnectionState);
  58. }
  59. public void setScreenMediaStream(MediaStream screenMediaStream) {
  60. this.screenMediaStream.setValue(screenMediaStream);
  61. }
  62. public void emitReaction(String reaction) {
  63. this.callParticipantModelNotifier.notifyReaction(reaction);
  64. }
  65. }