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