François Gaffie | 20f06f9 | 2015-03-24 09:01:14 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | #define LOG_TAG "APM::AudioPolicyEngine/Usage" |
| 18 | |
| 19 | #include "Usage.h" |
| 20 | |
François Gaffie | f19cf79 | 2018-05-30 17:22:17 +0200 | [diff] [blame] | 21 | namespace android { |
| 22 | namespace audio_policy { |
François Gaffie | 20f06f9 | 2015-03-24 09:01:14 +0100 | [diff] [blame] | 23 | |
| 24 | status_t Element<audio_usage_t>::setIdentifier(audio_usage_t identifier) |
| 25 | { |
| 26 | if (identifier > AUDIO_USAGE_MAX) { |
| 27 | return BAD_VALUE; |
| 28 | } |
| 29 | mIdentifier = identifier; |
| 30 | ALOGD("%s: Usage %s has identifier 0x%X", __FUNCTION__, getName().c_str(), identifier); |
| 31 | return NO_ERROR; |
| 32 | } |
| 33 | |
| 34 | template <> |
| 35 | status_t Element<audio_usage_t>::set<routing_strategy>(routing_strategy strategy) |
| 36 | { |
| 37 | if (strategy >= NUM_STRATEGIES) { |
| 38 | return BAD_VALUE; |
| 39 | } |
| 40 | ALOGD("%s: %d for Usage %s", __FUNCTION__, strategy, getName().c_str()); |
| 41 | mApplicableStrategy = strategy; |
| 42 | return NO_ERROR; |
| 43 | } |
| 44 | |
| 45 | template <> |
| 46 | routing_strategy Element<audio_usage_t>::get<routing_strategy>() const |
| 47 | { |
| 48 | ALOGD("%s: %d for Usage %s", __FUNCTION__, mApplicableStrategy, getName().c_str()); |
| 49 | return mApplicableStrategy; |
| 50 | } |
| 51 | |
| 52 | } // namespace audio_policy |
| 53 | } // namespace android |
| 54 | |
| 55 | |