1 /* 2 * Copyright (C) 2022-2023 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_IMS_SMS_CALLBACK_PROXY_H 17 #define TELEPHONY_IMS_SMS_CALLBACK_PROXY_H 18 19 #include "ims_sms_callback_interface.h" 20 #include "ims_sms_callback_ipc_interface_code.h" 21 #include "iremote_proxy.h" 22 #include "telephony_errors.h" 23 #include "telephony_log_wrapper.h" 24 25 namespace OHOS { 26 namespace Telephony { 27 class ImsSmsCallbackProxy : public IRemoteProxy<ImsSmsCallbackInterface> { 28 public: 29 explicit ImsSmsCallbackProxy(const sptr<IRemoteObject> &impl); 30 virtual ~ImsSmsCallbackProxy() = default; 31 32 /****************** sms basic ******************/ 33 /** 34 * @brief ImsSendMessageResponse the result of send the sms by IMS. 35 * 36 * @param slotId Indicates the card slot index number, 37 * ranging from {@code 0} to the maximum card slot index number supported by the device. 38 * @param result Indicates the result of send action. 39 * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure. 40 */ 41 int32_t ImsSendMessageResponse(int32_t slotId, const SendSmsResultInfo &result) override; 42 43 /** 44 * @brief ImsSendMessageResponse the fail result of send the sms by IMS. 45 * 46 * @param slotId Indicates the card slot index number, 47 * ranging from {@code 0} to the maximum card slot index number supported by the device. 48 * @param info Indicates details of failure. 49 * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure. 50 */ 51 int32_t ImsSendMessageResponse(int32_t slotId, const RadioResponseInfo &info) override; 52 53 /** 54 * @brief ImsSetSmsConfigResponse the result for enable or disable IMS SMS. 55 * 56 * @param slotId Indicates the card slot index number, 57 * ranging from {@code 0} to the maximum card slot index number supported by the device. 58 * @param info Indicates set action was success or failure. 59 * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure. 60 */ 61 int32_t ImsSetSmsConfigResponse(int32_t slotId, const RadioResponseInfo &info) override; 62 63 /** 64 * @brief ImsGetSmsConfigResponse the result for get IMS SMS config. 65 * 66 * @param slotId Indicates the card slot index number, 67 * ranging from {@code 0} to the maximum card slot index number supported by the device. 68 * @param imsSmsConfig Indicates Ims sms was enabled or disabled. 69 * ranging {@code 0} Ims sms was disabled {@code 1} Ims sms was enabled. 70 * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure. 71 */ 72 int32_t ImsGetSmsConfigResponse(int32_t slotId, int32_t imsSmsConfig) override; 73 74 /** 75 * @brief ImsGetSmsConfigResponse the fail result for get IMS SMS config. 76 * 77 * @param slotId Indicates the card slot index number, 78 * ranging from {@code 0} to the maximum card slot index number supported by the device. 79 * @param info Indicates details of failure. 80 * @return Returns {@code TELEPHONY_SUCCESS} on success, others on failure. 81 */ 82 int32_t ImsGetSmsConfigResponse(int32_t slotId, const RadioResponseInfo &info) override; 83 84 private: 85 int32_t WriteCommonInfo(std::string funcName, MessageParcel &in, int32_t slotId); 86 int32_t SendHRilRadioResponseInfo( 87 std::string funcName, int32_t slotId, int32_t eventId, const RadioResponseInfo &info); 88 int32_t SendRequest(MessageParcel &in, int32_t slotId, int32_t eventId); 89 90 private: 91 static inline BrokerDelegator<ImsSmsCallbackProxy> delegator_; 92 }; 93 } // namespace Telephony 94 } // namespace OHOS 95 96 #endif // TELEPHONY_IMS_SMS_CALLBACK_PROXY_H 97