1 /* 2 * Copyright (C) 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_IMS_SMS_PROXY_H 17 #define TELEPHONY_IMS_SMS_PROXY_H 18 19 #include "ims_sms_interface.h" 20 #include "iremote_proxy.h" 21 22 #include "telephony_log_wrapper.h" 23 24 namespace OHOS { 25 namespace Telephony { 26 class ImsSmsProxy : public IRemoteProxy<ImsSmsInterface> { 27 public: ImsSmsProxy(const sptr<IRemoteObject> & impl)28 explicit ImsSmsProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<ImsSmsInterface>(impl) {} 29 ~ImsSmsProxy() = default; 30 31 /** 32 * @brief IMS send message interface. 33 * 34 * @param slotId Indicates the card slot index number, 35 * ranging from {@code 0} to the maximum card slot index number supported by the device. 36 * @param imsMessageInfo Indicates the information of IMS message. 37 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 38 */ 39 int32_t ImsSendMessage(int32_t slotId, const ImsMessageInfo &imsMessageInfo) override; 40 41 /** 42 * @brief IMS set ims sms config interface. 43 * 44 * @param slotId Indicates the card slot index number, 45 * ranging from {@code 0} to the maximum card slot index number supported by the device. 46 * @param imsSmsConfig 1:enable ims sms, 0:disable ims sms 47 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 48 */ 49 int32_t ImsSetSmsConfig(int32_t slotId, int32_t imsSmsConfig) override; 50 51 /** 52 * @brief IMS get sms config interface. 53 * 54 * @param slotId Indicates the card slot index number, 55 * ranging from {@code 0} to the maximum card slot index number supported by the device. 56 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 57 */ 58 int32_t ImsGetSmsConfig(int32_t slotId) override; 59 60 /** 61 * @brief Register CallBack to listen the response from ImsSms. 62 * 63 * @param sptr<ImsSmsCallbackInterface> 64 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 65 */ 66 int32_t RegisterImsSmsCallback(const sptr<ImsSmsCallbackInterface> &callback) override; 67 68 private: 69 int32_t WriteCommonInfo(std::string funcName, MessageParcel &in, int32_t slotId); 70 int32_t SendRequest(MessageParcel &in, int32_t slotId, int32_t eventId); 71 72 private: 73 static inline BrokerDelegator<ImsSmsProxy> delegator_; 74 }; 75 } // namespace Telephony 76 } // namespace OHOS 77 78 #endif // TELEPHONY_IMS_SMS_PROXY_H 79