LCOV - code coverage report
Current view: top level - lib/src/voip/utils - types.dart (source / functions) Coverage Total Hit
Test: merged.info Lines: 0.0 % 6 0
Test Date: 2025-01-14 13:39:53 Functions: - 0 0

            Line data    Source code
       1              : // ignore_for_file: constant_identifier_names
       2              : 
       3              : enum EncryptionKeyTypes { remote, local }
       4              : 
       5              : // Call state
       6              : enum CallState {
       7              :   /// The call is inilalized but not yet started
       8              :   kFledgling,
       9              : 
      10              :   /// The first time an invite is sent, the local has createdOffer
      11              :   kInviteSent,
      12              : 
      13              :   /// getUserMedia or getDisplayMedia has been called,
      14              :   /// but MediaStream has not yet been returned
      15              :   kWaitLocalMedia,
      16              : 
      17              :   /// The local has createdOffer
      18              :   kCreateOffer,
      19              : 
      20              :   /// Received a remote offer message and created a local Answer
      21              :   kCreateAnswer,
      22              : 
      23              :   /// Answer sdp is set, but ice is not connected
      24              :   kConnecting,
      25              : 
      26              :   /// WebRTC media stream is connected
      27              :   kConnected,
      28              : 
      29              :   /// The call was received, but no processing has been done yet.
      30              :   kRinging,
      31              : 
      32              :   /// Ending a call
      33              :   kEnding,
      34              : 
      35              :   /// End of call
      36              :   kEnded,
      37              : }
      38              : 
      39              : enum CallErrorCode {
      40              :   /// The user chose to end the call
      41              :   userHangup('user_hangup'),
      42              : 
      43              :   /// An error code when the local client failed to create an offer.
      44              :   localOfferFailed('local_offer_failed'),
      45              : 
      46              :   /// An error code when there is no local mic/camera to use. This may be because
      47              :   /// the hardware isn't plugged in, or the user has explicitly denied access.
      48              :   userMediaFailed('user_media_failed'),
      49              : 
      50              :   /// Error code used when a call event failed to send
      51              :   /// because unknown devices were present in the room
      52              :   unknownDevice('unknown_device'),
      53              : 
      54              :   /// An answer could not be created
      55              :   createAnswer('create_answer'),
      56              : 
      57              :   /// The session description from the other side could not be set
      58              : 
      59              :   setRemoteDescription('set_remote_description'),
      60              : 
      61              :   /// The session description from this side could not be set
      62              :   setLocalDescription('set_local_description'),
      63              : 
      64              :   /// A different device answered the call
      65              :   answeredElsewhere('answered_elsewhere'),
      66              : 
      67              :   /// No media connection could be established to the other party
      68              :   iceFailed('ice_failed'),
      69              : 
      70              :   /// The invite timed out whilst waiting for an answer
      71              :   inviteTimeout('invite_timeout'),
      72              : 
      73              :   /// The call was replaced by another call
      74              :   replaced('replaced'),
      75              : 
      76              :   /// Signalling for the call could not be sent (other than the initial invite)
      77              :   iceTimeout('ice_timeout'),
      78              : 
      79              :   /// The remote party is busy
      80              :   userBusy('user_busy'),
      81              : 
      82              :   /// We transferred the call off to somewhere else
      83              :   transferred('transferred'),
      84              : 
      85              :   /// Some other failure occurred that meant the client was unable to continue
      86              :   /// the call rather than the user choosing to end it.
      87              :   unknownError('unknown_error');
      88              : 
      89              :   final String reason;
      90              : 
      91              :   const CallErrorCode(this.reason);
      92              : }
      93              : 
      94              : class CallError extends Error {
      95              :   final CallErrorCode code;
      96              :   final String msg;
      97              :   final dynamic err;
      98            0 :   CallError(this.code, this.msg, this.err);
      99              : 
     100            0 :   @override
     101              :   String toString() {
     102            0 :     return '[$code] $msg, err: ${err.toString()}';
     103              :   }
     104              : }
     105              : 
     106              : enum CallStateChange {
     107              :   /// The call was hangup by the local|remote user.
     108              :   kHangup,
     109              : 
     110              :   /// The call state has changed
     111              :   kState,
     112              : 
     113              :   /// The call got some error.
     114              :   kError,
     115              : 
     116              :   /// Call transfer
     117              :   kReplaced,
     118              : 
     119              :   /// The value of isLocalOnHold() has changed
     120              :   kLocalHoldUnhold,
     121              : 
     122              :   /// The value of isRemoteOnHold() has changed
     123              :   kRemoteHoldUnhold,
     124              : 
     125              :   /// Feeds have changed
     126              :   kFeedsChanged,
     127              : 
     128              :   /// For sip calls. support in the future.
     129              :   kAssertedIdentityChanged,
     130              : }
     131              : 
     132              : enum CallType { kVoice, kVideo }
     133              : 
     134              : enum CallDirection { kIncoming, kOutgoing }
     135              : 
     136              : enum CallParty { kLocal, kRemote }
     137              : 
     138              : enum MediaInputKind { videoinput, audioinput }
     139              : 
     140              : enum MediaKind { video, audio }
     141              : 
     142              : enum GroupCallErrorCode {
     143              :   /// An error code when there is no local mic/camera to use. This may be because
     144              :   /// the hardware isn't plugged in, or the user has explicitly denied access.
     145              :   userMediaFailed('user_media_failed'),
     146              : 
     147              :   /// Some other failure occurred that meant the client was unable to continue
     148              :   /// the call rather than the user choosing to end it.
     149              :   unknownError('unknownError');
     150              : 
     151              :   final String reason;
     152              : 
     153              :   const GroupCallErrorCode(this.reason);
     154              : }
     155              : 
     156              : class GroupCallError extends Error {
     157              :   final GroupCallErrorCode code;
     158              :   final String msg;
     159              :   final dynamic err;
     160            0 :   GroupCallError(this.code, this.msg, this.err);
     161              : 
     162            0 :   @override
     163              :   String toString() {
     164            0 :     return 'Group Call Error: [$code] $msg, err: ${err.toString()}';
     165              :   }
     166              : }
     167              : 
     168              : enum GroupCallStateChange {
     169              :   groupCallStateChanged,
     170              :   activeSpeakerChanged,
     171              :   callsChanged,
     172              :   userMediaStreamsChanged,
     173              :   screenshareStreamsChanged,
     174              :   localScreenshareStateChanged,
     175              :   localMuteStateChanged,
     176              :   participantsChanged,
     177              :   error
     178              : }
     179              : 
     180              : enum GroupCallState {
     181              :   localCallFeedUninitialized,
     182              :   initializingLocalCallFeed,
     183              :   localCallFeedInitialized,
     184              :   entering,
     185              :   entered,
     186              :   ended
     187              : }
        

Generated by: LCOV version 2.0-1