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_STUB_H 17 #define TELEPHONY_IMS_SMS_CALLBACK_STUB_H 18 19 #include <map> 20 21 #include "event_handler.h" 22 #include "event_runner.h" 23 #include "ims_sms_callback_interface.h" 24 #include "ims_sms_callback_ipc_interface_code.h" 25 #include "iremote_stub.h" 26 27 28 namespace OHOS { 29 namespace Telephony { 30 class ImsSmsCallbackStub : public IRemoteStub<ImsSmsCallbackInterface> { 31 public: 32 ImsSmsCallbackStub(); 33 virtual ~ImsSmsCallbackStub(); 34 int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 35 36 /****************** sms basic ******************/ 37 int32_t ImsSendMessageResponse(int32_t slotId, const SendSmsResultInfo &result) override; 38 int32_t ImsSendMessageResponse(int32_t slotId, const HRilRadioResponseInfo &info) override; 39 int32_t ImsSetSmsConfigResponse(int32_t slotId, const HRilRadioResponseInfo &info) override; 40 int32_t ImsGetSmsConfigResponse(int32_t slotId, int32_t imsSmsConfig) override; 41 int32_t ImsGetSmsConfigResponse(int32_t slotId, const HRilRadioResponseInfo &info) override; 42 43 private: 44 void InitFuncMap(); 45 void InitSmsBasicFuncMap(); 46 47 /****************** sms basic ******************/ 48 int32_t OnImsSendMessageResponseInner(MessageParcel &data, MessageParcel &reply); 49 int32_t OnImsSetSmsConfigResponseInner(MessageParcel &data, MessageParcel &reply); 50 int32_t OnImsGetSmsConfigResponseInner(MessageParcel &data, MessageParcel &reply); 51 52 int32_t SendHRilRadioResponseInfo(int32_t slotId, uint32_t eventId, const HRilRadioResponseInfo &info); 53 54 private: 55 using RequestFuncType = int32_t (ImsSmsCallbackStub::*)(MessageParcel &data, MessageParcel &reply); 56 std::map<uint32_t, RequestFuncType> requestFuncMap_; 57 std::shared_ptr<AppExecFwk::EventHandler> handler_[2]; 58 }; 59 } // namespace Telephony 60 } // namespace OHOS 61 62 #endif // TELEPHONY_IMS_SMS_CALLBACK_STUB_H 63