1 /*
2  * Copyright (C) 2020 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 #include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/IStream.h)
19 
20 namespace android {
21 namespace hardware {
22 namespace audio {
23 namespace CPP_VERSION {
24 namespace implementation {
25 
26 using ::android::sp;
27 using ::android::hardware::hidl_string;
28 using ::android::hardware::hidl_vec;
29 using ::android::hardware::Return;
30 using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
31 using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION;
32 
33 struct StreamCommon {
34     StreamCommon(int32_t ioHandle,
35                  const DeviceAddress& device,
36                  const AudioConfig& config,
37                  hidl_vec<AudioInOutFlag> flags);
38 
39     uint64_t getFrameSize() const;
40     uint64_t getFrameCount() const;
41     uint64_t getBufferSize() const;
42     uint32_t getSampleRate() const;
43     void getSupportedProfiles(const IStream::getSupportedProfiles_cb &_hidl_cb) const;
44     AudioFormat getFormat() const;
45     Result setFormat(AudioFormat format) const;
46     void getAudioProperties(const IStream::getAudioProperties_cb &_hidl_cb) const;
47     void getDevices(const IStream::getDevices_cb &_hidl_cb) const;
48     Result setDevices(const hidl_vec<DeviceAddress>& devices) const;
49 
50     const int32_t m_ioHandle;
51     const DeviceAddress m_device;
52     const AudioConfig m_config;
53     const hidl_vec<AudioInOutFlag> m_flags;
54 };
55 
56 }  // namespace implementation
57 }  // namespace CPP_VERSION
58 }  // namespace audio
59 }  // namespace hardware
60 }  // namespace android
61