blob: f88ce7b018925ef3bb0a1e39da436f0b3d5b00f4 [file] [log] [blame]
Pavel Maltseva2f426a2016-10-04 10:17:05 -07001/*
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
Pavel Maltsev2579fb72017-02-02 12:39:36 -080017#define LOG_TAG "automotive.vehicle@2.0-service"
Yifan Hongf9d30342016-11-30 13:45:34 -080018#include <android/log.h>
Martijn Coenen02822372016-12-29 14:03:41 +010019#include <hidl/HidlTransportSupport.h>
Pavel Maltseva2f426a2016-10-04 10:17:05 -070020
21#include <iostream>
22
Pavel Maltsevc5344ac2017-02-08 12:33:46 -080023#include <vhal_v2_0/VehicleHalManager.h>
24#include <vhal_v2_0/DefaultVehicleHal.h>
Pavel Maltseva2f426a2016-10-04 10:17:05 -070025
26using namespace android;
27using namespace android::hardware;
Pavel Maltsev2579fb72017-02-02 12:39:36 -080028using namespace android::hardware::automotive::vehicle::V2_0;
Pavel Maltseva2f426a2016-10-04 10:17:05 -070029
30int main(int /* argc */, char* /* argv */ []) {
Pavel Maltseve2603e32016-10-25 16:03:23 -070031 auto hal = std::make_unique<impl::DefaultVehicleHal>();
32 auto service = std::make_unique<VehicleHalManager>(hal.get());
Pavel Maltseva2f426a2016-10-04 10:17:05 -070033
Martijn Coenen02822372016-12-29 14:03:41 +010034 configureRpcThreadpool(1, true /* callerWillJoin */);
35
Pavel Maltseve2603e32016-10-25 16:03:23 -070036 ALOGI("Registering as service...");
Pavel Maltseva2f426a2016-10-04 10:17:05 -070037 service->registerAsService("Vehicle");
38
39 ALOGI("Ready");
Martijn Coenen02822372016-12-29 14:03:41 +010040 joinRpcThreadpool();
Pavel Maltseva2f426a2016-10-04 10:17:05 -070041}