xref: /aosp_15_r20/external/webrtc/sdk/objc/api/peerconnection/RTCDtmfSender.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright 2017 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #import <Foundation/Foundation.h>
12*d9f75844SAndroid Build Coastguard Worker 
13*d9f75844SAndroid Build Coastguard Worker #import "RTCMacros.h"
14*d9f75844SAndroid Build Coastguard Worker 
15*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_BEGIN
16*d9f75844SAndroid Build Coastguard Worker 
17*d9f75844SAndroid Build Coastguard Worker RTC_OBJC_EXPORT
18*d9f75844SAndroid Build Coastguard Worker @protocol RTC_OBJC_TYPE
19*d9f75844SAndroid Build Coastguard Worker (RTCDtmfSender)<NSObject>
20*d9f75844SAndroid Build Coastguard Worker 
21*d9f75844SAndroid Build Coastguard Worker     /**
22*d9f75844SAndroid Build Coastguard Worker      * Returns true if this RTCDtmfSender is capable of sending DTMF. Otherwise
23*d9f75844SAndroid Build Coastguard Worker      * returns false. To be able to send DTMF, the associated RTCRtpSender must be
24*d9f75844SAndroid Build Coastguard Worker      * able to send packets, and a "telephone-event" codec must be negotiated.
25*d9f75844SAndroid Build Coastguard Worker      */
26*d9f75844SAndroid Build Coastguard Worker     @property(nonatomic, readonly) BOOL canInsertDtmf;
27*d9f75844SAndroid Build Coastguard Worker 
28*d9f75844SAndroid Build Coastguard Worker /**
29*d9f75844SAndroid Build Coastguard Worker  * Queues a task that sends the DTMF tones. The tones parameter is treated
30*d9f75844SAndroid Build Coastguard Worker  * as a series of characters. The characters 0 through 9, A through D, #, and *
31*d9f75844SAndroid Build Coastguard Worker  * generate the associated DTMF tones. The characters a to d are equivalent
32*d9f75844SAndroid Build Coastguard Worker  * to A to D. The character ',' indicates a delay of 2 seconds before
33*d9f75844SAndroid Build Coastguard Worker  * processing the next character in the tones parameter.
34*d9f75844SAndroid Build Coastguard Worker  *
35*d9f75844SAndroid Build Coastguard Worker  * Unrecognized characters are ignored.
36*d9f75844SAndroid Build Coastguard Worker  *
37*d9f75844SAndroid Build Coastguard Worker  * @param duration The parameter indicates the duration to use for each
38*d9f75844SAndroid Build Coastguard Worker  * character passed in the tones parameter. The duration cannot be more
39*d9f75844SAndroid Build Coastguard Worker  * than 6000 or less than 70 ms.
40*d9f75844SAndroid Build Coastguard Worker  *
41*d9f75844SAndroid Build Coastguard Worker  * @param interToneGap The parameter indicates the gap between tones.
42*d9f75844SAndroid Build Coastguard Worker  * This parameter must be at least 50 ms but should be as short as
43*d9f75844SAndroid Build Coastguard Worker  * possible.
44*d9f75844SAndroid Build Coastguard Worker  *
45*d9f75844SAndroid Build Coastguard Worker  * If InsertDtmf is called on the same object while an existing task for this
46*d9f75844SAndroid Build Coastguard Worker  * object to generate DTMF is still running, the previous task is canceled.
47*d9f75844SAndroid Build Coastguard Worker  * Returns true on success and false on failure.
48*d9f75844SAndroid Build Coastguard Worker  */
49*d9f75844SAndroid Build Coastguard Worker - (BOOL)insertDtmf:(nonnull NSString *)tones
50*d9f75844SAndroid Build Coastguard Worker           duration:(NSTimeInterval)duration
51*d9f75844SAndroid Build Coastguard Worker       interToneGap:(NSTimeInterval)interToneGap;
52*d9f75844SAndroid Build Coastguard Worker 
53*d9f75844SAndroid Build Coastguard Worker /** The tones remaining to be played out */
54*d9f75844SAndroid Build Coastguard Worker - (nonnull NSString *)remainingTones;
55*d9f75844SAndroid Build Coastguard Worker 
56*d9f75844SAndroid Build Coastguard Worker /**
57*d9f75844SAndroid Build Coastguard Worker  * The current tone duration value. This value will be the value last set via the
58*d9f75844SAndroid Build Coastguard Worker  * insertDtmf method, or the default value of 100 ms if insertDtmf was never called.
59*d9f75844SAndroid Build Coastguard Worker  */
60*d9f75844SAndroid Build Coastguard Worker - (NSTimeInterval)duration;
61*d9f75844SAndroid Build Coastguard Worker 
62*d9f75844SAndroid Build Coastguard Worker /**
63*d9f75844SAndroid Build Coastguard Worker  * The current value of the between-tone gap. This value will be the value last set
64*d9f75844SAndroid Build Coastguard Worker  * via the insertDtmf() method, or the default value of 50 ms if insertDtmf() was never
65*d9f75844SAndroid Build Coastguard Worker  * called.
66*d9f75844SAndroid Build Coastguard Worker  */
67*d9f75844SAndroid Build Coastguard Worker - (NSTimeInterval)interToneGap;
68*d9f75844SAndroid Build Coastguard Worker 
69*d9f75844SAndroid Build Coastguard Worker @end
70*d9f75844SAndroid Build Coastguard Worker 
71*d9f75844SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_END
72