1 /* 2 * Copyright (C) 2025 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 <optional> 20 #include <string> 21 #include <vector> 22 23 namespace aidl { 24 namespace android { 25 namespace hardware { 26 namespace radio { 27 namespace implementation { 28 29 uint8_t hex2bin1(const char c); 30 void hex2binImpl(const char* s, uint8_t* b, size_t sz); 31 bool hex2bin(const std::string_view hex, std::vector<uint8_t>* bin); 32 33 char bin2hex1(const unsigned x); 34 void bin2hexImpl(const uint8_t* b, char* s, size_t sz); 35 std::string bin2hex(const uint8_t* b, size_t sz); 36 37 std::string base64encode(const void* binaryData, size_t binarySize); 38 std::optional<std::vector<uint8_t>> base64decode(const char* encodedData, size_t encodedSize); 39 40 } // namespace implementation 41 } // namespace radio 42 } // namespace hardware 43 } // namespace android 44 } // namespace aidl 45