1 /*
2  * Copyright (C) 2021-2022 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 
16 #ifndef TELEPHONY_CELLULAR_CALL_MMI_CODE_UTILS_H
17 #define TELEPHONY_CELLULAR_CALL_MMI_CODE_UTILS_H
18 
19 #include <string>
20 #include "cellular_call_data_struct.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 // Man-Machine Interface
25 class MMICodeUtils {
26 public:
27     /**
28      * MMICodeUtils constructor
29      */
30     MMICodeUtils() = default;
31 
32     /**
33      * ~MMICodeUtils destructor
34      */
35     ~MMICodeUtils() = default;
36 
37     /**
38      * IsNeedExecuteMmi
39      *
40      * 3GPP TS 22.030 V4.0.0 (2001-03)  6.5.2 Structure of the MMI
41      * TS 24.080 [10]
42      *
43      * @param analyseString
44      * @param isNeedUseIms
45      * @return bool
46      */
47     bool IsNeedExecuteMmi(const std::string &analyseString, bool isNeedUseIms);
48 
49     /**
50      * ExecuteMmiCode
51      *
52      * 3GPP TS 22.030 V16.0.0 (2020-07) 6.5.3 Handling of supplementary services    Figure 3.5.3.2
53      *
54      * @param slotId
55      * @return bool
56      */
57     bool ExecuteMmiCode(int32_t slotId);
58 
59     /**
60      * GetMMIData
61      *
62      * @return MMIData
63      */
64     MMIData GetMMIData();
65 
66 private:
67     /**
68      * RegexMatchMmi
69      *
70      * 3GPP TS 22.030 V4.0.0 (2001-03)  6.5.2 Structure of the MMI
71      * TS 24.080 [10]
72      *
73      * Regex Match Mmi Code
74      *
75      * @param analyseString
76      * @return bool
77      */
78     bool RegexMatchMmi(const std::string &analyseString);
79 
80 private:
81     MMIData mmiData_;
82     bool isNeedUseIms_ = false;
83 };
84 } // namespace Telephony
85 } // namespace OHOS
86 
87 #endif // TELEPHONY_CELLULAR_CALL_MMI_CODE_UTILS_H
88