1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 18 #include <libminradio/GuaranteedCallback.h> 19 #include <libminradio/RadioSlotBase.h> 20 21 #include <aidl/android/hardware/radio/modem/BnRadioModem.h> 22 23 namespace android::hardware::radio::minimal { 24 25 class RadioModem : public RadioSlotBase, 26 public aidl::android::hardware::radio::modem::BnRadioModem { 27 public: 28 RadioModem(std::shared_ptr<SlotContext> context, 29 std::vector<aidl::android::hardware::radio::RadioTechnology> rats); 30 31 protected: 32 void onUpdatedResponseFunctions() override; 33 34 ::ndk::ScopedAStatus enableModem(int32_t serial, bool on) override; 35 ::ndk::ScopedAStatus getBasebandVersion(int32_t serial) override; 36 ::ndk::ScopedAStatus getDeviceIdentity(int32_t serial) override; 37 ::ndk::ScopedAStatus getHardwareConfig(int32_t serial) override; 38 ::ndk::ScopedAStatus getModemActivityInfo(int32_t serial) override; 39 ::ndk::ScopedAStatus getModemStackStatus(int32_t serial) override; 40 ::ndk::ScopedAStatus getRadioCapability(int32_t serial) override; 41 ::ndk::ScopedAStatus nvReadItem( 42 int32_t serial, ::aidl::android::hardware::radio::modem::NvItem itemId) override; 43 ::ndk::ScopedAStatus nvResetConfig( 44 int32_t serial, ::aidl::android::hardware::radio::modem::ResetNvType type) override; 45 ::ndk::ScopedAStatus nvWriteCdmaPrl(int32_t serial, const std::vector<uint8_t>& prl) override; 46 ::ndk::ScopedAStatus nvWriteItem( 47 int32_t serial, const ::aidl::android::hardware::radio::modem::NvWriteItem& i) override; 48 ::ndk::ScopedAStatus requestShutdown(int32_t serial) override; 49 ::ndk::ScopedAStatus responseAcknowledgement() override; 50 ::ndk::ScopedAStatus sendDeviceState( 51 int32_t serial, ::aidl::android::hardware::radio::modem::DeviceStateType stateType, 52 bool state) override; 53 ::ndk::ScopedAStatus setRadioCapability( 54 int32_t s, const ::aidl::android::hardware::radio::modem::RadioCapability& rc) override; 55 ::ndk::ScopedAStatus setRadioPower(int32_t serial, bool powerOn, bool forEmergencyCall, 56 bool preferredForEmergencyCall) override; 57 ::ndk::ScopedAStatus setResponseFunctions( 58 const std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse>& 59 radioModemResponse, 60 const std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication>& 61 radioModemIndication) override; 62 63 GuaranteedCallback<::aidl::android::hardware::radio::modem::IRadioModemIndication, 64 ::aidl::android::hardware::radio::modem::IRadioModemIndicationDefault, true> 65 indicate; 66 GuaranteedCallback<::aidl::android::hardware::radio::modem::IRadioModemResponse, 67 ::aidl::android::hardware::radio::modem::IRadioModemResponseDefault> 68 respond; 69 70 private: 71 int32_t mRatBitmap; 72 73 std::string getModemUuid() const; 74 std::string getSimUuid() const; 75 }; 76 77 } // namespace android::hardware::radio::minimal 78