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 17#ifndef CAR_EVS_APP_EVSSTATECONTROL_H 18#define CAR_EVS_APP_EVSSTATECONTROL_H 19 20#include <android/hardware/automotive/vehicle/2.0/IVehicle.h> 21#include <android/hardware/automotive/evs/1.0/IEvsEnumerator.h> 22#include <android/hardware/automotive/evs/1.0/IEvsDisplay.h> 23#include <android/hardware/automotive/evs/1.0/IEvsCamera.h> 24 25#include "StreamHandler.h" 26#include "ConfigManager.h" 27 28 29using namespace ::android::hardware::automotive::evs::V1_0; 30using namespace ::android::hardware::automotive::vehicle::V2_0; 31using ::android::hardware::Return; 32using ::android::hardware::Void; 33using ::android::hardware::hidl_vec; 34using ::android::hardware::hidl_handle; 35using ::android::sp; 36 37 38class EvsStateControl { 39public: 40 EvsStateControl(android::sp <IVehicle> pVnet, 41 android::sp <IEvsEnumerator> pEvs, 42 android::sp <IEvsDisplay> pDisplay, 43 const ConfigManager& config); 44 45 enum State { 46 REVERSE = 0, 47 LEFT, 48 RIGHT, 49 OFF, 50 NUM_STATES // Must come last 51 }; 52 53 bool configureForVehicleState(); 54 55private: 56 StatusCode invokeGet(VehiclePropValue *pRequestedPropValue); 57 bool configureEvsPipeline(State desiredState); 58 59 sp<IVehicle> mVehicle; 60 sp<IEvsEnumerator> mEvs; 61 sp<IEvsDisplay> mDisplay; 62 63 VehiclePropValue mGearValue; 64 VehiclePropValue mTurnSignalValue; 65 66 ConfigManager::CameraInfo mCameraInfo[State::NUM_STATES]; 67 State mCurrentState; 68 sp<IEvsCamera> mCurrentCamera; 69 70 sp<StreamHandler> mCurrentStreamHandler; 71}; 72 73 74#endif //CAR_EVS_APP_EVSSTATECONTROL_H 75