1 /*
2  * Copyright (C) 2023-2024 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 I_SATELLITE_SERVICE_H
17 #define I_SATELLITE_SERVICE_H
18 
19 #include "i_satellite_core_callback.h"
20 #include "iremote_proxy.h"
21 #include "telephony_types.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 using SatelliteMessage = GsmSimMessageParam;
26 
27 namespace {
28 const int32_t TELEPHONY_SATELLITE_SERVICE_ABILITY_ID = 4012;
29 }
30 
31 enum SatelliteServiceProxyType {
32     PROXY_SATELLITE_CALL = 0,
33     PROXY_SATELLITE_SMS = 1,
34 };
35 
36 enum class SatelliteCapability : uint32_t {
37     NONE    = 0x0,
38     CALL    = 0x1,
39     SMS     = 0x1 << 1,
40     DATA    = 0x1 << 2,
41 };
42 
43 class ISatelliteService : public IRemoteBroker {
44 public:
45     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.telephony.ISatelliteService");
46 
47 public:
48     /**
49      * @brief Get the result of whether the satellite mode is on.
50      *
51      * @return True if satellite mode is turn on, false otherwise.
52      */
53     virtual bool IsSatelliteEnabled() = 0;
54 
55     /**
56      * @brief Register a callback to service, so that service can send result to the caller.
57      *
58      * @param slotId sim slot id
59      * @param what identify the callback data
60      * @param callback callback object to deal with the callback data
61      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
62      */
63     virtual int32_t RegisterCoreNotify(int32_t slotId, int32_t what, const sptr<ISatelliteCoreCallback> &callback) = 0;
64 
65     /**
66      * @brief Register a callback to service, so that service can send result to the caller.
67      *
68      * @param slotId sim slot id
69      * @param what identify which callback should be unregister
70      * @param callback callback object to deal with the callback data
71      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
72      */
73     virtual int32_t UnRegisterCoreNotify(int32_t slotId, int32_t what) = 0;
74 
75     /**
76      * @brief Set the radio state.
77      *
78      * @param slotId sim slot id
79      * @param eventId radio event id
80      * @param isRadioOn radio on or off
81      * @param rst whether to enable automatic reset of the modem
82      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
83      */
84     virtual int32_t SetRadioState(int32_t slotId, int32_t isRadioOn, int32_t rst) = 0;
85 
86     /**
87      * @brief Get satellite imei
88      *
89      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
90      */
91     virtual std::string GetImei() = 0;
92 
93     /**
94      * @brief Get satellite capability
95      *
96      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
97      */
98     virtual int32_t GetSatelliteCapability() = 0;
99 
100     /**
101      * @brief Get the pointer of service.
102      *
103      * @param SatelliteServiceProxyType service type, call or sms
104      * @return Remote object of the service.
105      */
106     virtual sptr<IRemoteObject> GetProxyObjectPtr(SatelliteServiceProxyType proxyType) = 0;
107 };
108 } // namespace Telephony
109 } // namespace OHOS
110 #endif // I_SATELLITE_SERVICE_H