blob: 641e2c90ae4fd09ab98911648601bd959b73c516 [file] [log] [blame]
Mikhail Naganovbaf57fb2020-08-11 23:23:16 +00001/*
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#define LOG_TAG "android.hardware.audio@7.0-service.example"
18#include <hidl/HidlTransportSupport.h>
19#include <log/log.h>
20
21#include "DevicesFactory.h"
22#include "EffectsFactory.h"
23
24using android::hardware::configureRpcThreadpool;
25using android::hardware::joinRpcThreadpool;
26using namespace android;
27
28status_t registerDevicesFactoryService() {
29 sp<::android::hardware::audio::V7_0::IDevicesFactory> devicesFactory =
30 new ::android::hardware::audio::V7_0::implementation::DevicesFactory();
31 status_t status = devicesFactory->registerAsService("example");
32 ALOGE_IF(status != OK, "Error registering devices factory as service: %d", status);
33 return status;
34}
35
36status_t registerEffectsFactoryService() {
37 sp<::android::hardware::audio::effect::V7_0::IEffectsFactory> devicesFactory =
38 new ::android::hardware::audio::effect::V7_0::implementation::EffectsFactory();
39 status_t status = devicesFactory->registerAsService("example");
40 ALOGE_IF(status != OK, "Error registering effects factory as service: %d", status);
41 return status;
42}
43
44int main() {
45 configureRpcThreadpool(1, true);
46 status_t status = registerDevicesFactoryService();
47 if (status != OK) {
48 return status;
49 }
50 status = registerEffectsFactoryService();
51 if (status != OK) {
52 return status;
53 }
54 joinRpcThreadpool();
55
56 return 1;
57}