• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { paramMock } from "../utils"
17export const ImsCallMode = {
18  CALL_MODE_AUDIO_ONLY: 0,
19  CALL_MODE_SEND_ONLY: 1,
20  CALL_MODE_RECEIVE_ONLY: 2,
21  CALL_MODE_SEND_RECEIVE: 3,
22  CALL_MODE_VIDEO_PAUSED: 4,
23}
24export const AudioDevice = {
25  DEVICE_MIC: "[PC Preview] unknow DEVICE_MIC",
26  DEVICE_SPEAKER: "[PC Preview] unknow DEVICE_SPEAKER",
27  DEVICE_WIRED_HEADSET: "[PC Preview] unknow DEVICE_WIRED_HEADSET",
28  DEVICE_BLUETOOTH_SCO: "[PC Preview] unknow DEVICE_BLUETOOTH_SCO",
29}
30export const CallRestrictionType = {
31  RESTRICTION_TYPE_ALL_INCOMING: 0,
32  RESTRICTION_TYPE_ALL_OUTGOING: 1,
33  RESTRICTION_TYPE_INTERNATIONAL: 2,
34  RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME: 3,
35  RESTRICTION_TYPE_ROAMING_INCOMING: 4,
36  RESTRICTION_TYPE_ALL_CALLS: 5,
37  RESTRICTION_TYPE_OUTGOING_SERVICES: 6,
38  RESTRICTION_TYPE_INCOMING_SERVICES: 7,
39}
40export const CallTransferInfo = {
41  transferNum: "[PC Preview] unknow transferNum",
42  type: CallTransferType,
43  settingType: CallTransferSettingType,
44}
45export const CallTransferSettingType = {
46  CALL_TRANSFER_DISABLE: 0,
47  CALL_TRANSFER_ENABLE: 1,
48  CALL_TRANSFER_REGISTRATION: 3,
49  CALL_TRANSFER_ERASURE: 4,
50}
51export const CallTransferType = {
52  TRANSFER_TYPE_UNCONDITIONAL: 0,
53  TRANSFER_TYPE_BUSY: 1,
54  TRANSFER_TYPE_NO_REPLY: 2,
55  TRANSFER_TYPE_NOT_REACHABLE: 3,
56}
57export const ConferenceState = {
58  TEL_CONFERENCE_IDLE: 0,
59  TEL_CONFERENCE_ACTIVE: 1,
60  TEL_CONFERENCE_DISCONNECTING: 2,
61  TEL_CONFERENCE_DISCONNECTED: 3,
62};
63export const CallType = {
64  TYPE_CS: 0,
65  TYPE_IMS: 1,
66  TYPE_OTT: 2,
67  TYPE_ERR_CALL: 3,
68}
69export const VideoStateType = {
70  TYPE_VOICE: 0,
71  TYPE_VIDEO: 1,
72}
73export const DetailedCallState = {
74  CALL_STATUS_ACTIVE: 0,
75  CALL_STATUS_HOLDING: 1,
76  CALL_STATUS_DIALING: 2,
77  CALL_STATUS_ALERTING: 3,
78  CALL_STATUS_INCOMING: 4,
79  CALL_STATUS_WAITING: 5,
80  CALL_STATUS_DISCONNECTED: 6,
81  CALL_STATUS_DISCONNECTING: 7,
82  CALL_STATUS_IDLE: 8,
83}
84export const CallState = {
85  CALL_STATE_UNKNOWN: -1,
86  CALL_STATE_IDLE: 0,
87  CALL_STATE_RINGING: 1,
88  CALL_STATE_OFFHOOK: 2,
89}
90export const CallRestrictionInfo = {
91  type: CallRestrictionType,
92  password: "[PC Preview] unknow password",
93  mode: CallRestrictionMode,
94}
95export const DialOptions = {
96  extras: "[PC Preview] unknow extras",
97  accountId: "[PC Preview] unknow accountId",
98  videoState: VideoStateType,
99  dialScene: DialScene,
100  dialType: DialType,
101}
102export const DialScene = {
103  CALL_NORMAL: 0,
104  CALL_PRIVILEGED: 1,
105  CALL_EMERGENCY: 2,
106}
107export const DialType = {
108  DIAL_CARRIER_TYPE: 0,
109  DIAL_VOICE_MAIL_TYPE: 1,
110  DIAL_OTT_TYPE: 2,
111}
112export const CallRestrictionMode = {
113  RESTRICTION_MODE_DEACTIVATION: 0,
114  RESTRICTION_MODE_ACTIVATION: 1,
115}
116export const CallEventOptions = {
117  eventId: CallAbilityEventId
118}
119export const NumberFormatOptions = {
120  countryCode: "[PC Preview] unknow countryCode"
121}
122export const CallAbilityEventId = {
123  EVENT_DIAL_NO_CARRIER: 1,
124  EVENT_INVALID_FDN_NUMBER: 2,
125}
126export const RejectMessageOptions = {
127  messageContent: "[PC Preview] unknow messageContent"
128}
129export const CallWaitingStatus = {
130  CALL_WAITING_DISABLE: 0,
131  CALL_WAITING_ENABLE: 1,
132};
133export const RestrictionStatus = {
134  RESTRICTION_DISABLE: 0,
135  RESTRICTION_ENABLE: 1,
136};
137export const TransferStatus = {
138  TRANSFER_DISABLE: 0,
139  TRANSFER_ENABLE: 1,
140};
141export const CallAttributeOptions = {
142  accountNumber: "[PC Preview] unknow accountNumber",
143  speakerphoneOn: "[PC Preview] unknow speakerphoneOn",
144  accountId: "[PC Preview] unknow accountId",
145  videoState: VideoStateType,
146  startTime: "[PC Preview] unknow startTime",
147  isEcc: "[PC Preview] unknow isEcc",
148  callType: CallType,
149  callId: "[PC Preview] unknow callId",
150  callState: DetailedCallState,
151  conferenceState: ConferenceState,
152  status: "[PC Preview] unknow status",
153  number: "[PC Preview] unknow number",
154}
155export const EmergencyNumberOptions = {
156  slotId: "[PC Preview] unknow slotId"
157}
158export const CallTransferResult = {
159  status: "[PC Preview] unknow status",
160  number: "[PC Preview] unknow number",
161}
162export const DisconnectedDetails = {
163  UNASSIGNED_NUMBER: 1,
164  NO_ROUTE_TO_DESTINATION: 3,
165  CHANNEL_UNACCEPTABLE: 6,
166  OPERATOR_DETERMINED_BARRING: 8,
167  NORMAL_CALL_CLEARING: 16,
168  USER_BUSY: 17,
169  NO_USER_RESPONDING: 18,
170  USER_ALERTING_NO_ANSWER: 19,
171  CALL_REJECTED: 21,
172  NUMBER_CHANGED: 22,
173  DESTINATION_OUT_OF_ORDER: 27,
174  INVALID_NUMBER_FORMAT: 28,
175  NETWORK_OUT_OF_ORDER: 38,
176  TEMPORARY_FAILURE: 41,
177  INVALID_PARAMETER: 1025,
178  SIM_NOT_EXIT: 1026,
179  SIM_PIN_NEED: 1027,
180  CALL_NOT_ALLOW: 1029,
181  SIM_INVALID: 1045,
182  UNKNOWN: 1279,
183};
184export function mockCall() {
185  const call = {
186    ImsCallMode,
187    AudioDevice,
188    CallRestrictionType,
189    TransferStatus,
190    CallTransferSettingType,
191    CallWaitingStatus,
192    CallTransferType,
193    ConferenceState,
194    DisconnectedDetails,
195    CallAbilityEventId,
196    CallType,
197    VideoStateType,
198    DetailedCallState,
199    CallState,
200    DialScene,
201    RestrictionStatus,
202    CallTransferResult,
203    DialType,
204    CallRestrictionMode,
205    dial: function (...args) {
206      console.warn("telephony.call.dial interface mocked in the Previewer. How this interface works on the Previewer may" +
207        " be different from that on a real device.")
208      const len = args.length
209      if (typeof args[len - 1] === 'function') {
210        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
211      } else {
212        return new Promise((resolve, reject) => {
213          resolve(paramMock.paramBooleanMock);
214        })
215      }
216    },
217    makeCall: function (...args) {
218      console.warn("telephony.call.makeCall interface mocked in the Previewer. How this interface works on the Previewer may" +
219        " be different from that on a real device.")
220      const len = args.length
221      if (typeof args[len - 1] === 'function') {
222        args[len - 1].call(this, paramMock.businessErrorMock);
223      } else {
224        return new Promise((resolve, reject) => {
225          resolve();
226        })
227      }
228    },
229    hasCall: function (...args) {
230      console.warn("telephony.call.hasCall interface mocked in the Previewer. How this interface works on the Previewer may" +
231        " be different from that on a real device.")
232      const len = args.length
233      if (typeof args[len - 1] === 'function') {
234        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
235      } else {
236        return new Promise((resolve, reject) => {
237          resolve(paramMock.paramBooleanMock);
238        })
239      }
240    },
241    getCallState: function (...args) {
242      console.warn("telephony.call.getCallState interface mocked in the Previewer. How this interface works on the Previewer may" +
243        " be different from that on a real device.")
244      const len = args.length
245      if (typeof args[len - 1] === 'function') {
246        args[len - 1].call(this, paramMock.businessErrorMock, CallState);
247      } else {
248        return new Promise((resolve, reject) => {
249          resolve(CallState);
250        })
251      }
252    },
253    displayCallScreen: function (...args) {
254      console.warn("telephony.call.displayCallScreen interface mocked in the Previewer. How this interface works on the Previewer may" +
255        " be different from that on a real device.")
256      const len = args.length
257      if (typeof args[len - 1] === 'function') {
258        args[len - 1].call(this, paramMock.businessErrorMock);
259      } else {
260        return new Promise((resolve, reject) => {
261          resolve();
262        })
263      }
264    },
265    muteRinger: function (...args) {
266      console.warn("telephony.call.muteRinger interface mocked in the Previewer. How this interface works on the Previewer may" +
267        " be different from that on a real device.")
268      const len = args.length
269      if (typeof args[len - 1] === 'function') {
270        args[len - 1].call(this, paramMock.businessErrorMock);
271      } else {
272        return new Promise((resolve, reject) => {
273          resolve();
274        })
275      }
276    },
277    hasVoiceCapability: function () {
278      console.warn("telephony.call.hasVoiceCapability interface mocked in the Previewer. How this interface works on the Previewer may" +
279        " be different from that on a real device.")
280      return paramMock.paramBooleanMock;
281    },
282    isVideoCallingEnabled: function (...args) {
283      console.warn("telephony.call.isVideoCallingEnabled interface mocked in the Previewer. How this interface works on the Previewer may" +
284        " be different from that on a real device.")
285      const len = args.length
286      if (typeof args[len - 1] === 'function') {
287        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
288      } else {
289        return new Promise((resolve, reject) => {
290          resolve(paramMock.paramBooleanMock);
291        })
292      }
293    },
294    inputDialerSpecialCode: function (...args) {
295      console.warn("telephony.call.inputDialerSpecialCode interface mocked in the Previewer. How this interface works on the Previewer may" +
296        " be different from that on a real device.")
297      const len = args.length
298      if (typeof args[len - 1] === 'function') {
299        args[len - 1].call(this, paramMock.businessErrorMock);
300      } else {
301        return new Promise((resolve, reject) => {
302          resolve();
303        })
304      }
305    },
306    isHacEnabled: function (...args) {
307      console.warn("telephony.call.isHacEnabled interface mocked in the Previewer. How this interface works on the Previewer may" +
308        " be different from that on a real device.")
309      const len = args.length
310      if (typeof args[len - 1] === 'function') {
311        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
312      } else {
313        return new Promise((resolve, reject) => {
314          resolve(paramMock.paramBooleanMock);
315        })
316      }
317    },
318    isEmergencyPhoneNumber: function (...args) {
319      console.warn("telephony.call.isEmergencyPhoneNumber interface mocked in the Previewer. How this interface works on the Previewer may" +
320        " be different from that on a real device.")
321      const len = args.length
322      if (typeof args[len - 1] === 'function') {
323        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
324      } else {
325        return new Promise((resolve, reject) => {
326          resolve(paramMock.paramBooleanMock);
327        })
328      }
329    },
330    formatPhoneNumber: function (...args) {
331      console.warn("telephony.call.formatPhoneNumber interface mocked in the Previewer. How this interface works on the Previewer may" +
332        " be different from that on a real device.")
333      const len = args.length
334      if (typeof args[len - 1] === 'function') {
335        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock);
336      } else {
337        return new Promise((resolve, reject) => {
338          resolve(paramMock.paramStringMock);
339        })
340      }
341    },
342    formatPhoneNumberToE164: function (...args) {
343      console.warn("telephony.call.formatPhoneNumberToE164 interface mocked in the Previewer. How this interface works on the Previewer may" +
344        " be different from that on a real device.")
345      const len = args.length
346      if (typeof args[len - 1] === 'function') {
347        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock);
348      } else {
349        return new Promise((resolve, reject) => {
350          resolve(paramMock.paramStringMock);
351        })
352      }
353    },
354    comparePhoneNumbers: function (...args) {
355      console.warn("telephony.call.comparePhoneNumbers interface mocked in the Previewer. How this interface works on the Previewer may" +
356        " be different from that on a real device.")
357      const len = args.length
358      if (typeof args[len - 1] === 'function') {
359        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
360      } else {
361        return new Promise((resolve, reject) => {
362          resolve(paramMock.paramBooleanMock);
363        })
364      }
365    },
366    getCallerIndex: function (...args) {
367      console.warn("telephony.call.getCallerIndex interface mocked in the Previewer. How this interface works on the Previewer may" +
368        " be different from that on a real device.")
369      const len = args.length
370      if (typeof args[len - 1] === 'function') {
371        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
372      } else {
373        return new Promise((resolve, reject) => {
374          resolve(paramMock.paramNumberMock);
375        })
376      }
377    },
378    getCountryCodeFromDbNumber: function (...args) {
379      console.warn("telephony.call.getCountryCodeFromDbNumber interface mocked in the Previewer. How this interface works on the Previewer may" +
380        " be different from that on a real device.")
381      const len = args.length
382      if (typeof args[len - 1] === 'function') {
383        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock);
384      } else {
385        return new Promise((resolve, reject) => {
386          resolve(paramMock.paramStringMock);
387        })
388      }
389    },
390    getIntlPrefixAndCountryCodeLen: function (...args) {
391      console.warn("telephony.call.getIntlPrefixAndCountryCodeLen interface mocked in the Previewer. How this interface works on the Previewer may" +
392        " be different from that on a real device.")
393      const len = args.length
394      if (typeof args[len - 1] === 'function') {
395        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
396      } else {
397        return new Promise((resolve, reject) => {
398          resolve(paramMock.paramNumberMock);
399        })
400      }
401    },
402    answer: function (...args) {
403      console.warn("telephony.call.answer interface mocked in the Previewer. How this interface works on the Previewer may" +
404        " be different from that on a real device.")
405      const len = args.length
406      if (typeof args[len - 1] === 'function') {
407        args[len - 1].call(this, paramMock.businessErrorMock);
408      } else {
409        return new Promise((resolve, reject) => {
410          resolve();
411        })
412      }
413    },
414    hangup: function (...args) {
415      console.warn("telephony.call.hangup interface mocked in the Previewer. How this interface works on the Previewer may" +
416        " be different from that on a real device.")
417      const len = args.length
418      if (typeof args[len - 1] === 'function') {
419        args[len - 1].call(this, paramMock.businessErrorMock);
420      } else {
421        return new Promise((resolve, reject) => {
422          resolve();
423        })
424      }
425    },
426    reject: function (...args) {
427      console.warn("telephony.call.reject interface mocked in the Previewer. How this interface works on the Previewer may" +
428        " be different from that on a real device.")
429      const len = args.length
430      if (typeof args[len - 1] === 'function') {
431        args[len - 1].call(this, paramMock.businessErrorMock);
432      } else {
433        return new Promise((resolve, reject) => {
434          resolve();
435        })
436      }
437    },
438    holdCall: function (...args) {
439      console.warn("telephony.call.holdCall interface mocked in the Previewer. How this interface works on the Previewer may" +
440        " be different from that on a real device.")
441      const len = args.length
442      if (typeof args[len - 1] === 'function') {
443        args[len - 1].call(this, paramMock.businessErrorMock);
444      } else {
445        return new Promise((resolve, reject) => {
446          resolve();
447        })
448      }
449    },
450    unHoldCall: function (...args) {
451      console.warn("telephony.call.unHoldCall interface mocked in the Previewer. How this interface works on the Previewer may" +
452        " be different from that on a real device.")
453      const len = args.length
454      if (typeof args[len - 1] === 'function') {
455        args[len - 1].call(this, paramMock.businessErrorMock);
456      } else {
457        return new Promise((resolve, reject) => {
458          resolve();
459        })
460      }
461    },
462    switchCall: function (...args) {
463      console.warn("telephony.call.switchCall interface mocked in the Previewer. How this interface works on the Previewer may" +
464        " be different from that on a real device.")
465      const len = args.length
466      if (typeof args[len - 1] === 'function') {
467        args[len - 1].call(this, paramMock.businessErrorMock);
468      } else {
469        return new Promise((resolve, reject) => {
470          resolve();
471        })
472      }
473    },
474    combineConference: function (...args) {
475      console.warn("telephony.call.combineConference interface mocked in the Previewer. How this interface works on the Previewer may" +
476        " be different from that on a real device.")
477      const len = args.length
478      if (typeof args[len - 1] === 'function') {
479        args[len - 1].call(this, paramMock.businessErrorMock);
480      } else {
481        return new Promise((resolve, reject) => {
482          resolve();
483        })
484      }
485    },
486    getMainCallId: function (...args) {
487      console.warn("telephony.call.getMainCallId interface mocked in the Previewer. How this interface works on the Previewer may" +
488        " be different from that on a real device.")
489      const len = args.length
490      if (typeof args[len - 1] === 'function') {
491        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
492      } else {
493        return new Promise((resolve, reject) => {
494          resolve(paramMock.paramNumberMock);
495        })
496      }
497    },
498    getSubCallIdList: function (...args) {
499      console.warn("telephony.call.getSubCallIdList interface mocked in the Previewer. How this interface works on the Previewer may" +
500        " be different from that on a real device.")
501      const len = args.length
502      if (typeof args[len - 1] === 'function') {
503        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock);
504      } else {
505        return new Promise((resolve, reject) => {
506          resolve(paramMock.paramArrayMock);
507        })
508      }
509    },
510    getCallIdListForConference: function (...args) {
511      console.warn("telephony.call.getCallIdListForConference interface mocked in the Previewer. How this interface works on the Previewer may" +
512        " be different from that on a real device.")
513      const len = args.length
514      if (typeof args[len - 1] === 'function') {
515        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramArrayMock);
516      } else {
517        return new Promise((resolve, reject) => {
518          resolve(paramMock.paramArrayMock);
519        })
520      }
521    },
522    getCallWaitingStatus: function (...args) {
523      console.warn("telephony.call.getCallWaitingStatus interface mocked in the Previewer. How this interface works on the Previewer may" +
524        " be different from that on a real device.")
525      const len = args.length
526      if (typeof args[len - 1] === 'function') {
527        args[len - 1].call(this, paramMock.businessErrorMock, CallWaitingStatus);
528      } else {
529        return new Promise((resolve, reject) => {
530          resolve(CallWaitingStatus);
531        })
532      }
533    },
534    setCallWaiting: function (...args) {
535      console.warn("telephony.call.setCallWaiting interface mocked in the Previewer. How this interface works on the Previewer may" +
536        " be different from that on a real device.")
537      const len = args.length
538      if (typeof args[len - 1] === 'function') {
539        args[len - 1].call(this, paramMock.businessErrorMock);
540      } else {
541        return new Promise((resolve, reject) => {
542          resolve();
543        })
544      }
545    },
546    startDTMF: function (...args) {
547      console.warn("telephony.call.startDTMF interface mocked in the Previewer. How this interface works on the Previewer may" +
548        " be different from that on a real device.")
549      const len = args.length
550      if (typeof args[len - 1] === 'function') {
551        args[len - 1].call(this, paramMock.businessErrorMock);
552      } else {
553        return new Promise((resolve, reject) => {
554          resolve();
555        })
556      }
557    },
558    stopDTMF: function (...args) {
559      console.warn("telephony.call.stopDTMF interface mocked in the Previewer. How this interface works on the Previewer may" +
560        " be different from that on a real device.")
561      const len = args.length
562      if (typeof args[len - 1] === 'function') {
563        args[len - 1].call(this, paramMock.businessErrorMock);
564      } else {
565        return new Promise((resolve, reject) => {
566          resolve();
567        })
568      }
569    },
570    isInEmergencyCall: function (...args) {
571      console.warn("telephony.call.isInEmergencyCall interface mocked in the Previewer. How this interface works on the Previewer may" +
572        " be different from that on a real device.")
573      const len = args.length
574      if (typeof args[len - 1] === 'function') {
575        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
576      } else {
577        return new Promise((resolve, reject) => {
578          resolve(paramMock.paramBooleanMock);
579        })
580      }
581    },
582    on: function (...args) {
583      console.warn("telephony.call.on interface mocked in the Previewer. How this interface works on the Previewer may " +
584        "be different from that on a real device.")
585      const len = args.length
586      if (typeof args[len - 1] === 'function') {
587        if (args[0] == 'callDetailsChange') {
588          args[len - 1].call(this, CallAttributeOptions);
589        } else if (args[0] == 'callEventChange') {
590          args[len - 1].call(this, CallEventOptions);
591        } else if (args[0] == 'callDisconnectedCause') {
592          args[len - 1].call(this, DisconnectedDetails);
593        }
594      }
595    },
596    off: function (...args) {
597      console.warn("telephony.call.off interface mocked in the Previewer. How this interface works on the Previewer may" +
598        " be different from that on a real device.")
599      const len = args.length
600      if (typeof args[len - 1] === 'function') {
601        if (args[0] == 'callDetailsChange') {
602          args[len - 1].call(this, CallAttributeOptions);
603        } else if (args[0] == 'callEventChange') {
604          args[len - 1].call(this, CallEventOptions);
605        } else if (args[0] == 'callDisconnectedCause') {
606          args[len - 1].call(this, DisconnectedDetails);
607        }
608      }
609    },
610    cancelMuted: function (...args) {
611      console.warn("telephony.call.cancelMuted interface mocked in the Previewer. How this interface works on the Previewer may" +
612      " be different from that on a real device.")
613      const len = args.length
614      if (typeof args[len - 1] === 'function') {
615        args[len - 1].call(this, paramMock.businessErrorMock);
616      } else {
617        return new Promise((resolve, reject) => {
618          resolve();
619        })
620      }
621    },
622    joinConference: function (...args) {
623      console.warn("telephony.call.joinConference interface mocked in the Previewer. How this interface works on the Previewer may" +
624      " be different from that on a real device.")
625      const len = args.length
626      if (typeof args[len - 1] === 'function') {
627        args[len - 1].call(this, paramMock.businessErrorMock);
628      } else {
629        return new Promise((resolve, reject) => {
630          resolve();
631        })
632      }
633    },
634    disableImsSwitch: function (...args) {
635      console.warn("telephony.call.disableImsSwitch interface mocked in the Previewer. How this interface works on the Previewer may" +
636      " be different from that on a real device.")
637      const len = args.length
638      if (typeof args[len - 1] === 'function') {
639        args[len - 1].call(this, paramMock.businessErrorMock);
640      } else {
641        return new Promise((resolve, reject) => {
642          resolve();
643        })
644      }
645    },
646    enableImsSwitch: function (...args) {
647      console.warn("telephony.call.enableImsSwitch interface mocked in the Previewer. How this interface works on the Previewer may" +
648      " be different from that on a real device.")
649      const len = args.length
650      if (typeof args[len - 1] === 'function') {
651        args[len - 1].call(this, paramMock.businessErrorMock);
652      } else {
653        return new Promise((resolve, reject) => {
654          resolve();
655        })
656      }
657    },
658    updateImsCallMode: function (...args) {
659      console.warn("telephony.call.updateImsCallMode interface mocked in the Previewer. How this interface works on the Previewer may" +
660      " be different from that on a real device.")
661      const len = args.length
662      if (typeof args[len - 1] === 'function') {
663        args[len - 1].call(this, paramMock.businessErrorMock);
664      } else {
665        return new Promise((resolve, reject) => {
666          resolve();
667        })
668      }
669    },
670    isNewCallAllowed: function (...args) {
671      console.warn("telephony.call.isNewCallAllowed interface mocked in the Previewer. How this interface works on the Previewer may" +
672        " be different from that on a real device.")
673      const len = args.length
674      if (typeof args[len - 1] === 'function') {
675        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
676      } else {
677        return new Promise((resolve, reject) => {
678          resolve(paramMock.paramBooleanMock);
679        })
680      }
681    },
682    separateConference: function (...args) {
683      console.warn("telephony.call.separateConference interface mocked in the Previewer. How this interface works on the Previewer may" +
684        " be different from that on a real device.")
685      const len = args.length
686      if (typeof args[len - 1] === 'function') {
687        args[len - 1].call(this, paramMock.businessErrorMock);
688      } else {
689        return new Promise((resolve, reject) => {
690          resolve();
691        })
692      }
693    },
694    getCallRestrictionStatus: function (...args) {
695      console.warn("telephony.call.getCallRestrictionStatus interface mocked in the Previewer. How this interface works on the Previewer may" +
696        " be different from that on a real device.")
697      const len = args.length
698      if (typeof args[len - 1] === 'function') {
699        args[len - 1].call(this, paramMock.businessErrorMock, RestrictionStatus);
700      } else {
701        return new Promise((resolve, reject) => {
702          resolve(RestrictionStatus);
703        })
704      }
705    },
706    setCallRestriction: function (...args) {
707      console.warn("telephony.call.setCallRestriction interface mocked in the Previewer. How this interface works on the Previewer may" +
708        " be different from that on a real device.")
709      const len = args.length
710      if (typeof args[len - 1] === 'function') {
711        args[len - 1].call(this, paramMock.businessErrorMock);
712      } else {
713        return new Promise((resolve, reject) => {
714          resolve();
715        })
716      }
717    },
718    setCallTransfer: function (...args) {
719      console.warn("telephony.call.setCallTransfer interface mocked in the Previewer. How this interface works on the Previewer may" +
720        " be different from that on a real device.")
721      const len = args.length
722      if (typeof args[len - 1] === 'function') {
723        args[len - 1].call(this, paramMock.businessErrorMock);
724      } else {
725        return new Promise((resolve, reject) => {
726          resolve();
727        })
728      }
729    },
730    getCallTransferInfo: function (...args) {
731      console.warn("telephony.call.getCallTransferInfo interface mocked in the Previewer. How this interface works on the Previewer may" +
732        " be different from that on a real device.")
733      const len = args.length
734      if (typeof args[len - 1] === 'function') {
735        args[len - 1].call(this, paramMock.businessErrorMock, CallTransferResult);
736      } else {
737        return new Promise((resolve, reject) => {
738          resolve(CallTransferResult);
739        })
740      }
741    },
742    setCallTransferInfo: function (...args) {
743      console.warn("telephony.call.setCallTransferInfo interface mocked in the Previewer. How this interface works on the Previewer may" +
744        " be different from that on a real device.")
745      const len = args.length
746      if (typeof args[len - 1] === 'function') {
747        args[len - 1].call(this, paramMock.businessErrorMock);
748      } else {
749        return new Promise((resolve, reject) => {
750          resolve();
751        })
752      }
753    },
754    isRinging: function (...args) {
755      console.warn("telephony.call.isRinging interface mocked in the Previewer. How this interface works on the Previewer may" +
756        " be different from that on a real device.")
757      const len = args.length
758      if (typeof args[len - 1] === 'function') {
759        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
760      } else {
761        return new Promise((resolve, reject) => {
762          resolve(paramMock.paramBooleanMock);
763        })
764      }
765    },
766    isImsSwitchEnabled: function (...args) {
767      console.warn("telephony.call.isImsSwitchEnabled interface mocked in the Previewer. How this interface works on the Previewer may" +
768      " be different from that on a real device.")
769      const len = args.length
770      if (typeof args[len - 1] === 'function') {
771        args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock);
772      } else {
773        return new Promise((resolve, reject) => {
774          resolve(paramMock.paramBooleanMock);
775        })
776      }
777    },
778    setMuted: function (...args) {
779      console.warn("telephony.call.setMuted interface mocked in the Previewer. How this interface works on the Previewer may" +
780        " be different from that on a real device.")
781      const len = args.length
782      if (typeof args[len - 1] === 'function') {
783        args[len - 1].call(this, paramMock.businessErrorMock);
784      } else {
785        return new Promise((resolve, reject) => {
786          resolve();
787        })
788      }
789    },
790    setAudioDevice: function (...args) {
791      console.warn("telephony.call.setAudioDevice interface mocked in the Previewer. How this interface works on the Previewer may" +
792        " be different from that on a real device.")
793      const len = args.length
794      if (typeof args[len - 1] === 'function') {
795        args[len - 1].call(this, paramMock.businessErrorMock);
796      } else {
797        return new Promise((resolve, reject) => {
798          resolve();
799        })
800      }
801    }
802  }
803  return call
804}