1 /*
2  * Copyright (C) 2016 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 #ifndef ANDROID_HARDWARE_RADIO_HAL_HIDL_UTILS_H
17 #define ANDROID_HARDWARE_RADIO_HAL_HIDL_UTILS_H
18 
19 #include <android/hardware/broadcastradio/1.0/types.h>
20 #include <hardware/radio.h>
21 
22 namespace android {
23 
24 using android::hardware::hidl_vec;
25 using android::hardware::broadcastradio::V1_0::Result;
26 using android::hardware::broadcastradio::V1_0::Properties;
27 using android::hardware::broadcastradio::V1_0::BandConfig;
28 using android::hardware::broadcastradio::V1_0::ProgramInfo;
29 using android::hardware::broadcastradio::V1_0::MetaData;
30 
31 class HidlUtils {
32 public:
33     static int convertHalResult(Result result);
34     static void convertBandConfigFromHal(radio_hal_band_config_t *config,
35                                          const BandConfig *halConfig);
36     static void convertPropertiesFromHal(radio_hal_properties_t *properties,
37                                          const Properties *halProperties);
38     static void convertBandConfigToHal(BandConfig *halConfig,
39                                        const radio_hal_band_config_t *config);
40     static void convertProgramInfoFromHal(radio_program_info_t *info,
41                                           const ProgramInfo *halInfo);
42     static void convertMetaDataFromHal(radio_metadata_t **metadata,
43                                        const hidl_vec<MetaData>& halMetadata,
44                                        uint32_t channel,
45                                        uint32_t subChannel);
46 };
47 
48 }  // namespace android
49 
50 #endif  // ANDROID_HARDWARE_RADIO_HAL_HIDL_UTILS_H
51