199da06d0Sopenharmony_ci/**
299da06d0Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
399da06d0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
499da06d0Sopenharmony_ci * you may not use this file except in compliance with the License.
599da06d0Sopenharmony_ci * You may obtain a copy of the License at
699da06d0Sopenharmony_ci *
799da06d0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
899da06d0Sopenharmony_ci *
999da06d0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1099da06d0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1199da06d0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1299da06d0Sopenharmony_ci * See the License for the specific language governing permissions and
1399da06d0Sopenharmony_ci * limitations under the License.
1499da06d0Sopenharmony_ci */
1599da06d0Sopenharmony_ci
1699da06d0Sopenharmony_ci/**
1799da06d0Sopenharmony_ci * @file: Call status
1899da06d0Sopenharmony_ci */
1999da06d0Sopenharmony_ciconst callStateTxtList = ['calling', 'callHold', 'dialing', 'partyIsRinging', '', 'thirdPartyCalls', 'hangUpCompleted',
2099da06d0Sopenharmony_ci  'hangingUp', 'callIdle'];
2199da06d0Sopenharmony_ci
2299da06d0Sopenharmony_ciexport default class CallStateConst {
2399da06d0Sopenharmony_ci  // calling
2499da06d0Sopenharmony_ci  public static CALL_STATUS_ACTIVE: number = 0;
2599da06d0Sopenharmony_ci
2699da06d0Sopenharmony_ci  // State keeping
2799da06d0Sopenharmony_ci  public static CALL_STATUS_HOLDING: number = 1;
2899da06d0Sopenharmony_ci
2999da06d0Sopenharmony_ci  // Dialing
3099da06d0Sopenharmony_ci  public static CALL_STATUS_DIALING: number = 2;
3199da06d0Sopenharmony_ci
3299da06d0Sopenharmony_ci  // The other party is ringing
3399da06d0Sopenharmony_ci  public static CALL_STATUS_ALERTING: number = 3;
3499da06d0Sopenharmony_ci
3599da06d0Sopenharmony_ci  // Call from the other party
3699da06d0Sopenharmony_ci  public static CALL_STATUS_INCOMING: number = 4;
3799da06d0Sopenharmony_ci
3899da06d0Sopenharmony_ci  // Waiting for third-party calls
3999da06d0Sopenharmony_ci  public static CALL_STATUS_WAITING: number = 5;
4099da06d0Sopenharmony_ci
4199da06d0Sopenharmony_ci  // Hung up
4299da06d0Sopenharmony_ci  public static CALL_STATUS_DISCONNECTED: number = 6;
4399da06d0Sopenharmony_ci
4499da06d0Sopenharmony_ci  // Hanging up
4599da06d0Sopenharmony_ci  public static CALL_STATUS_DISCONNECTING: number = 7;
4699da06d0Sopenharmony_ci
4799da06d0Sopenharmony_ci  // Idle state
4899da06d0Sopenharmony_ci  public static CALL_STATUS_IDLE: number = 8;
4999da06d0Sopenharmony_ci  public static callStateObj = {
5099da06d0Sopenharmony_ci    CALL_STATUS_ACTIVE: CallStateConst.CALL_STATUS_ACTIVE,
5199da06d0Sopenharmony_ci    CALL_STATUS_HOLDING: CallStateConst.CALL_STATUS_HOLDING,
5299da06d0Sopenharmony_ci    CALL_STATUS_DIALING: CallStateConst.CALL_STATUS_DIALING,
5399da06d0Sopenharmony_ci    CALL_STATUS_ALERTING: CallStateConst.CALL_STATUS_ALERTING,
5499da06d0Sopenharmony_ci    CALL_STATUS_INCOMING: CallStateConst.CALL_STATUS_INCOMING,
5599da06d0Sopenharmony_ci    CALL_STATUS_WAITING: CallStateConst.CALL_STATUS_WAITING,
5699da06d0Sopenharmony_ci    CALL_STATUS_DISCONNECTED: CallStateConst.CALL_STATUS_DISCONNECTED,
5799da06d0Sopenharmony_ci    CALL_STATUS_DISCONNECTING: CallStateConst.CALL_STATUS_DISCONNECTING,
5899da06d0Sopenharmony_ci    CALL_STATUS_IDLE: CallStateConst.CALL_STATUS_IDLE
5999da06d0Sopenharmony_ci  };
6099da06d0Sopenharmony_ci
6199da06d0Sopenharmony_ci  public static callStateTextMap = {
6299da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_ACTIVE]: '',
6399da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_HOLDING]: $r('app.string.callHold'),
6499da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_DIALING]: $r('app.string.dialing'),
6599da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_ALERTING]: $r('app.string.partyIsRinging'),
6699da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_INCOMING]: '',
6799da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_WAITING]: '',
6899da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_DISCONNECTED]: $r('app.string.hangUpCompleted'),
6999da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_DISCONNECTING]: $r('app.string.hangingUp'),
7099da06d0Sopenharmony_ci    [CallStateConst.CALL_STATUS_IDLE]: ''
7199da06d0Sopenharmony_ci  };
7299da06d0Sopenharmony_ci
7399da06d0Sopenharmony_ci  public static defaultCallData = {
7499da06d0Sopenharmony_ci    callId: 0,
7599da06d0Sopenharmony_ci    callState: CallStateConst.CALL_STATUS_IDLE,
7699da06d0Sopenharmony_ci    accountNumber: '',
7799da06d0Sopenharmony_ci    videoState: 0,
7899da06d0Sopenharmony_ci    callType: 0,
7999da06d0Sopenharmony_ci    conferenceState: 0
8099da06d0Sopenharmony_ci  };
8199da06d0Sopenharmony_ci
8299da06d0Sopenharmony_ci  public getCallStateText = (state) => callStateTxtList[state] !== undefined ? callStateTxtList[state] : '';
8399da06d0Sopenharmony_ci}