1 /* 2 * Copyright (C) 2021 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 OHOS_HRIL_SMS_H 17 #define OHOS_HRIL_SMS_H 18 19 #include "hril_base.h" 20 #include "hril_sms_parcel.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 class HRilSms : public HRilBase { 25 public: 26 HRilSms(int32_t slotId, IHRilReporter &hrilReporter); 27 virtual ~HRilSms() = default; 28 29 bool IsSmsRespOrNotify(uint32_t code); 30 void RegisterSmsFuncs(const HRilSmsReq *smsFuncs); 31 32 int32_t SendGsmSms(int32_t serialId, const OHOS::HDI::Ril::V1_0::GsmSmsMessageInfo &gsmSmsMessageInfo); 33 int32_t SendCdmaSms(int32_t serialId, const OHOS::HDI::Ril::V1_0::SendCdmaSmsMessageInfo &cdmaSmsMessageInfo); 34 int32_t AddSimMessage(int32_t serialId, const OHOS::HDI::Ril::V1_0::SmsMessageIOInfo &smsMessageIOInfo); 35 int32_t DelSimMessage(int32_t serialId, int32_t index); 36 int32_t UpdateSimMessage(int32_t serialId, const OHOS::HDI::Ril::V1_0::SmsMessageIOInfo &smsMessageIOInfo); 37 int32_t SetSmscAddr(int32_t serialId, const OHOS::HDI::Ril::V1_0::ServiceCenterAddress &serviceCenterAddress); 38 int32_t GetSmscAddr(int32_t serialId); 39 int32_t SetCBConfig(int32_t serialId, const OHOS::HDI::Ril::V1_0::CBConfigInfo &cellBroadcastInfo); 40 int32_t GetCBConfig(int32_t serialId); 41 int32_t SetCdmaCBConfig(int32_t serialId, const OHOS::HDI::Ril::V1_0::CdmaCBConfigInfoList &cdmaCBConfigInfoList); 42 int32_t GetCdmaCBConfig(int32_t serialId); 43 int32_t SendSmsMoreMode(int32_t serialId, const OHOS::HDI::Ril::V1_0::GsmSmsMessageInfo &gsmSmsMessageInfo); 44 int32_t SendSmsAck(int32_t serialId, const OHOS::HDI::Ril::V1_0::ModeData &modeData); 45 int32_t AddCdmaSimMessage(int32_t serialId, const OHOS::HDI::Ril::V1_0::SmsMessageIOInfo &smsMessageIOInfo); 46 int32_t DelCdmaSimMessage(int32_t serialId, int32_t index); 47 int32_t UpdateCdmaSimMessage(int32_t serialId, const OHOS::HDI::Ril::V1_0::SmsMessageIOInfo &smsMessageIOInfo); 48 49 int32_t SendGsmSmsResponse( 50 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 51 int32_t SendCdmaSmsResponse( 52 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 53 int32_t AddSimMessageResponse( 54 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 55 int32_t DelSimMessageResponse( 56 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 57 int32_t UpdateSimMessageResponse( 58 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 59 int32_t SetSmscAddrResponse( 60 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 61 int32_t GetSmscAddrResponse( 62 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 63 int32_t SetCBConfigResponse( 64 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 65 int32_t GetCBConfigResponse( 66 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 67 int32_t SetCdmaCBConfigResponse( 68 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 69 int32_t GetCdmaCBConfigResponse( 70 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 71 int32_t SendSmsMoreModeResponse( 72 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 73 int32_t SendSmsAckResponse( 74 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 75 int32_t AddCdmaSimMessageResponse( 76 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 77 int32_t DelCdmaSimMessageResponse( 78 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 79 int32_t UpdateCdmaSimMessageResponse( 80 int32_t requestNum, HRilRadioResponseInfo &responseInfo, const void *response, size_t responseLen); 81 82 int32_t SmsStatusReportNotify(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 83 int32_t NewSmsStoredOnSimNotify(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 84 int32_t NewSmsNotify(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 85 int32_t NewCdmaSmsNotify(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 86 int32_t CBConfigNotify(int32_t indType, HRilErrNumber error, const void *response, size_t responseLen); 87 88 private: 89 void AddHandlerToMap(); 90 bool IsSmsResponse(uint32_t code); 91 bool IsSmsNotification(uint32_t code); 92 int32_t RequestWithInts(int32_t **p, ReqDataInfo *requestInfo, int32_t argCount, ...); 93 int32_t RequestWithStrings(int32_t serial, int32_t request, int32_t count, ...); 94 HDI::Ril::V1_0::CBConfigReportInfo MakeCBConfigResult(const void *response, const size_t responseLen); 95 HDI::Ril::V1_0::SendSmsResultInfo MakeSendSmsResult( 96 HRilRadioResponseInfo &responseInfo, int32_t serial, const void *response, const size_t responseLen); 97 void CopyToHRilCdmaCBConfigInfo( 98 HRilCdmaCBConfigInfo *list, OHOS::HDI::Ril::V1_0::CdmaCBConfigInfoList cellBroadcastInfoList); 99 100 const HRilSmsReq *smsFuncs_ = nullptr; 101 }; 102 } // namespace Telephony 103 } // namespace OHOS 104 #endif // OHOS_HRIL_SMS_H