LCOV - code coverage report
Current view: top level - lib/src/voip/utils - types.dart (source / functions) Coverage Total Hit
Test: merged.info Lines: 16.7 % 6 1
Test Date: 2025-03-17 05:40:22 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 creating peer connection object fails locally.
      44              :   createPeerConnectionFailed('create_peer_connection_failed'),
      45              : 
      46              :   /// An error code when the local client failed to create an offer.
      47              :   localOfferFailed('local_offer_failed'),
      48              : 
      49              :   /// An error code when there is no local mic/camera to use. This may be because
      50              :   /// the hardware isn't plugged in, or the user has explicitly denied access.
      51              :   userMediaFailed('user_media_failed'),
      52              : 
      53              :   /// An error code when there is no local display to screenshare. This may be
      54              :   /// because the hardware isn't plugged in, or the user has explicitly denied
      55              :   /// access.
      56              :   displayMediaFailed('display_media_failed'),
      57              : 
      58              :   /// Error code used when a call event failed to send
      59              :   /// because unknown devices were present in the room
      60              :   unknownDevice('unknown_device'),
      61              : 
      62              :   /// An answer could not be created
      63              :   createAnswer('create_answer'),
      64              : 
      65              :   /// The session description from the other side could not be set
      66              : 
      67              :   setRemoteDescription('set_remote_description'),
      68              : 
      69              :   /// The session description from this side could not be set
      70              :   setLocalDescription('set_local_description'),
      71              : 
      72              :   /// A different device answered the call
      73              :   answeredElsewhere('answered_elsewhere'),
      74              : 
      75              :   /// No media connection could be established to the other party
      76              :   iceFailed('ice_failed'),
      77              : 
      78              :   /// The invite timed out whilst waiting for an answer
      79              :   inviteTimeout('invite_timeout'),
      80              : 
      81              :   /// The call was replaced by another call
      82              :   replaced('replaced'),
      83              : 
      84              :   /// Signalling for the call could not be sent (other than the initial invite)
      85              :   iceTimeout('ice_timeout'),
      86              : 
      87              :   /// The remote party is busy
      88              :   userBusy('user_busy'),
      89              : 
      90              :   /// We transferred the call off to somewhere else
      91              :   transferred('transferred'),
      92              : 
      93              :   /// Some other failure occurred that meant the client was unable to continue
      94              :   /// the call rather than the user choosing to end it.
      95              :   unknownError('unknown_error');
      96              : 
      97              :   final String reason;
      98              : 
      99              :   const CallErrorCode(this.reason);
     100              : }
     101              : 
     102              : class CallError extends Error {
     103              :   final CallErrorCode code;
     104              :   final String msg;
     105              :   final dynamic err;
     106            2 :   CallError(this.code, this.msg, this.err);
     107              : 
     108            0 :   @override
     109              :   String toString() {
     110            0 :     return '[$code] $msg, err: ${err.toString()}';
     111              :   }
     112              : }
     113              : 
     114              : enum CallStateChange {
     115              :   /// The call was hangup by the local|remote user.
     116              :   kHangup,
     117              : 
     118              :   /// The call state has changed
     119              :   kState,
     120              : 
     121              :   /// The call got some error.
     122              :   kError,
     123              : 
     124              :   /// Call transfer
     125              :   kReplaced,
     126              : 
     127              :   /// The value of isLocalOnHold() has changed
     128              :   kLocalHoldUnhold,
     129              : 
     130              :   /// The value of isRemoteOnHold() has changed
     131              :   kRemoteHoldUnhold,
     132              : 
     133              :   /// Feeds have changed
     134              :   kFeedsChanged,
     135              : 
     136              :   /// For sip calls. support in the future.
     137              :   kAssertedIdentityChanged,
     138              : }
     139              : 
     140              : enum CallType { kVoice, kVideo }
     141              : 
     142              : enum CallDirection { kIncoming, kOutgoing }
     143              : 
     144              : enum CallParty { kLocal, kRemote }
     145              : 
     146              : enum MediaInputKind { videoinput, audioinput }
     147              : 
     148              : enum MediaKind { video, audio }
     149              : 
     150              : enum GroupCallErrorCode {
     151              :   /// An error code when there is no local mic/camera to use. This may be because
     152              :   /// the hardware isn't plugged in, or the user has explicitly denied access.
     153              :   userMediaFailed('user_media_failed'),
     154              : 
     155              :   /// Some other failure occurred that meant the client was unable to continue
     156              :   /// the call rather than the user choosing to end it.
     157              :   unknownError('unknownError');
     158              : 
     159              :   final String reason;
     160              : 
     161              :   const GroupCallErrorCode(this.reason);
     162              : }
     163              : 
     164              : class GroupCallError extends Error {
     165              :   final GroupCallErrorCode code;
     166              :   final String msg;
     167              :   final dynamic err;
     168            0 :   GroupCallError(this.code, this.msg, this.err);
     169              : 
     170            0 :   @override
     171              :   String toString() {
     172            0 :     return 'Group Call Error: [$code] $msg, err: ${err.toString()}';
     173              :   }
     174              : }
     175              : 
     176              : enum GroupCallStateChange {
     177              :   groupCallStateChanged,
     178              :   activeSpeakerChanged,
     179              :   callsChanged,
     180              :   userMediaStreamsChanged,
     181              :   screenshareStreamsChanged,
     182              :   localScreenshareStateChanged,
     183              :   localMuteStateChanged,
     184              :   participantsChanged,
     185              :   error
     186              : }
     187              : 
     188              : enum GroupCallState {
     189              :   localCallFeedUninitialized,
     190              :   initializingLocalCallFeed,
     191              :   localCallFeedInitialized,
     192              :   entering,
     193              :   entered,
     194              :   ended
     195              : }
        

Generated by: LCOV version 2.0-1