1 /* 2 * Copyright (C) 2024 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 17 #pragma once 18 19 #include <aidl/android/hardware/radio/sim/IccIoResult.h> 20 21 #include <span> 22 #include <string> 23 24 namespace android::hardware::radio::minimal::sim { 25 26 ::aidl::android::hardware::radio::sim::IccIoResult toIccIoResult(std::span<uint8_t const> bytes); 27 ::aidl::android::hardware::radio::sim::IccIoResult toIccIoResult(std::vector<uint8_t>&& bytes); 28 ::aidl::android::hardware::radio::sim::IccIoResult toIccIoResult(std::string_view simResponse); 29 ::aidl::android::hardware::radio::sim::IccIoResult toIccIoResult(uint16_t errorCode); 30 31 std::vector<uint8_t> hexStringToBytes(std::string_view str); 32 std::vector<uint8_t> hexStringToBch(std::string_view str); 33 std::string bytesToHexString(std::span<uint8_t const> bytes); 34 std::string bytesToHexString(std::vector<uint8_t>&& bytes); 35 std::string bchToHexString(std::span<uint8_t const> bytes); 36 37 std::vector<uint8_t> uint8ToBytes(uint8_t val); 38 std::vector<uint8_t> uint16ToBytes(uint16_t val); 39 40 std::vector<uint8_t> encodeFplmns(std::span<std::string_view> fplmns); 41 std::vector<uint8_t> encodeMsisdn(std::string_view phoneNumber); 42 std::vector<uint8_t> encodeAd(uint8_t mncLength); 43 44 } // namespace android::hardware::radio::minimal::sim 45