1 /* 2 * Copyright 2019 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 package com.android.bluetooth.btservice.storage; 18 19 import androidx.room.Entity; 20 21 @Entity 22 class CustomizedMetadataEntity { 23 public byte[] manufacturer_name; 24 public byte[] model_name; 25 public byte[] software_version; 26 public byte[] hardware_version; 27 public byte[] companion_app; 28 public byte[] main_icon; 29 public byte[] is_untethered_headset; 30 public byte[] untethered_left_icon; 31 public byte[] untethered_right_icon; 32 public byte[] untethered_case_icon; 33 public byte[] untethered_left_battery; 34 public byte[] untethered_right_battery; 35 public byte[] untethered_case_battery; 36 public byte[] untethered_left_charging; 37 public byte[] untethered_right_charging; 38 public byte[] untethered_case_charging; 39 public byte[] enhanced_settings_ui_uri; 40 public byte[] device_type; 41 public byte[] main_battery; 42 public byte[] main_charging; 43 public byte[] main_low_battery_threshold; 44 public byte[] untethered_left_low_battery_threshold; 45 public byte[] untethered_right_low_battery_threshold; 46 public byte[] untethered_case_low_battery_threshold; 47 public byte[] spatial_audio; 48 public byte[] fastpair_customized; 49 public byte[] le_audio; 50 public byte[] gmcs_cccd; 51 public byte[] gtbs_cccd; 52 toString()53 public String toString() { 54 StringBuilder builder = new StringBuilder(); 55 builder.append("manufacturer_name=") 56 .append(metadataToString(manufacturer_name)) 57 .append("|model_name=") 58 .append(metadataToString(model_name)) 59 .append("|software_version=") 60 .append(metadataToString(software_version)) 61 .append("|hardware_version=") 62 .append(metadataToString(hardware_version)) 63 .append("|companion_app=") 64 .append(metadataToString(companion_app)) 65 .append("|main_icon=") 66 .append(metadataToString(main_icon)) 67 .append("|is_untethered_headset=") 68 .append(metadataToString(is_untethered_headset)) 69 .append("|untethered_left_icon=") 70 .append(metadataToString(untethered_left_icon)) 71 .append("|untethered_right_icon=") 72 .append(metadataToString(untethered_right_icon)) 73 .append("|untethered_case_icon=") 74 .append(metadataToString(untethered_case_icon)) 75 .append("|untethered_left_battery=") 76 .append(metadataToString(untethered_left_battery)) 77 .append("|untethered_right_battery=") 78 .append(metadataToString(untethered_right_battery)) 79 .append("|untethered_case_battery=") 80 .append(metadataToString(untethered_case_battery)) 81 .append("|untethered_left_charging=") 82 .append(metadataToString(untethered_left_charging)) 83 .append("|untethered_right_charging=") 84 .append(metadataToString(untethered_right_charging)) 85 .append("|untethered_case_charging=") 86 .append(metadataToString(untethered_case_charging)) 87 .append("|enhanced_settings_ui_uri=") 88 .append(metadataToString(enhanced_settings_ui_uri)) 89 .append("|device_type=") 90 .append(metadataToString(device_type)) 91 .append("|main_battery=") 92 .append(metadataToString(main_battery)) 93 .append("|main_charging=") 94 .append(metadataToString(main_charging)) 95 .append("|main_low_battery_threshold=") 96 .append(metadataToString(main_low_battery_threshold)) 97 .append("|untethered_left_low_battery_threshold=") 98 .append(metadataToString(untethered_left_low_battery_threshold)) 99 .append("|untethered_right_low_battery_threshold=") 100 .append(metadataToString(untethered_right_low_battery_threshold)) 101 .append("|untethered_case_low_battery_threshold=") 102 .append(metadataToString(untethered_case_low_battery_threshold)) 103 .append("|spatial_audio=") 104 .append(metadataToString(spatial_audio)) 105 .append("|fastpair_customized=") 106 .append(metadataToString(fastpair_customized)) 107 .append("|le_audio=") 108 .append(metadataToString(le_audio)) 109 .append("|gmcs_cccd=") 110 .append(metadataToString(gmcs_cccd)) 111 .append("|gtbs_cccd=") 112 .append(metadataToString(gtbs_cccd)); 113 114 115 return builder.toString(); 116 } 117 metadataToString(byte[] metadata)118 private String metadataToString(byte[] metadata) { 119 if (metadata == null) { 120 return null; 121 } 122 return new String(metadata); 123 } 124 } 125