1 /* 2 * Copyright (C) 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_ESIM_SERVICE_CALLBACK_STUB_H 17 #define I_ESIM_SERVICE_CALLBACK_STUB_H 18 19 #include <cstdint> 20 #include "iesim_service_callback.h" 21 #include "iremote_stub.h" 22 #include "download_profile_config_info_parcel.h" 23 #include "download_profile_result_parcel.h" 24 #include "downloadable_profile_parcel.h" 25 #include "esim_state_type.h" 26 #include "euicc_info_parcel.h" 27 #include "get_downloadable_profiles_result_parcel.h" 28 #include "iesim_service_callback.h" 29 #include "iremote_stub.h" 30 #include "profile_info_list_parcel.h" 31 #include "profile_metadata_result_parcel.h" 32 #include "response_esim_result.h" 33 #include "contract_request_data_parcel.h" 34 namespace OHOS { 35 namespace Telephony { 36 class IEsimServiceCallbackStub : public IRemoteStub<IEsimServiceCallback> { 37 public: 38 static const int32_t DEFAULT_ERROR = -1; 39 static const int32_t DEFAULT_RESULT = 0; 40 IEsimServiceCallbackStub(); 41 virtual ~IEsimServiceCallbackStub() = default; 42 int32_t OnEsimServiceCallback(EsimServiceCallback requestId, MessageParcel &data) override; 43 int OnRemoteRequest( 44 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 45 virtual void OnGetEuiccInfo(const EuiccInfo &result, const int32_t errorCode); 46 virtual void OnDeleteProfile(const int32_t &result, const int32_t errorCode); 47 virtual void OnDownloadProfile(const DownloadProfileResult &result, const int32_t errorCode); 48 virtual void OnGetDownloadableProfileMetadata( 49 const GetDownloadableProfileMetadataResult &result, const int32_t errorCode); 50 virtual void OnGetDownloadableProfiles( 51 const GetDownloadableProfilesResult &result, const int32_t errorCode); 52 virtual void OnResetMemory(const int32_t &result, const int32_t errorCode); 53 virtual void OnStartOsu(const OsuStatus &result, const int32_t errorCode); 54 virtual void OnSwitchToProfile(const int32_t &result, const int32_t errorCode); 55 virtual void OnCancelSession(const ResponseEsimResult &result, const int32_t errorCode); 56 virtual void OnGetDefaultSmdpAddress(const std::string &result, const int32_t errorCode); 57 virtual void OnGetEid(const std::string &result, const int32_t errorCode); 58 virtual void OnGetEuiccProfileInfoList(const GetEuiccProfileInfoListResult &result, const int32_t errorCode); 59 virtual void OnSetDefaultSmdpAddress(const int32_t &result, const int32_t errorCode); 60 virtual void OnSetProfileNickName(const int32_t &result, const int32_t errorCode); 61 virtual void OnGetSupportedPkids(const std::string &result, const int32_t errorCode); 62 virtual void OnGetContractInfo(const std::string &result, const int32_t errorCode); 63 private: 64 void OnGetEuiccInfo(MessageParcel &data); 65 void OnGetEid(MessageParcel &data); 66 void OnGetDownloadableProfileMetadata(MessageParcel &data); 67 void OnGetDownloadableProfiles(MessageParcel &data); 68 void OnGetEuiccProfileInfoList(MessageParcel &data); 69 void OnGetDefaultSmdpAddress(MessageParcel &data); 70 void OnSetDefaultSmdpAddress(MessageParcel &data); 71 void OnSetProfileNickname(MessageParcel &data); 72 void OnCancelSession(MessageParcel &data); 73 void OnDownloadProfile(MessageParcel &data); 74 void OnDeleteProfile(MessageParcel &data); 75 void OnStartOsu(MessageParcel &data); 76 void OnSwitchToProfile(MessageParcel &data); 77 void OnResetMemory(MessageParcel &data); 78 void OnGetSupportedPkids(MessageParcel &data); 79 void OnGetContractInfo(MessageParcel &data); 80 using EsimServiceCallbackFunc = std::function<void(MessageParcel &data)>; 81 std::map<uint32_t, EsimServiceCallbackFunc> memberFuncMap_; 82 }; 83 } // namespace Telephony 84 } // namespace OHOS 85 #endif // I_ESIM_CALLBACK_STUB_H