1 /*
2  * Copyright (C) 2019 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 #ifndef CAR_LIB_EVS_SUPPORT_ANALYZE_USECASE_H
17 #define CAR_LIB_EVS_SUPPORT_ANALYZE_USECASE_H
18 
19 #include "BaseAnalyzeCallback.h"
20 #include "BaseUseCase.h"
21 #include "ResourceManager.h"
22 #include "StreamHandler.h"
23 
24 #include <thread>
25 
26 using ::android::sp;
27 using ::android::hardware::Return;
28 using ::std::string;
29 
30 namespace android {
31 namespace automotive {
32 namespace evs {
33 namespace support {
34 
35 class AnalyzeUseCase : public BaseUseCase {
36 public:
37     AnalyzeUseCase(string cameraId, BaseAnalyzeCallback* analyzeCallback);
38     virtual ~AnalyzeUseCase();
39     virtual bool startVideoStream() override;
40     virtual void stopVideoStream() override;
41 
42     static AnalyzeUseCase createDefaultUseCase(string cameraId, BaseAnalyzeCallback* cb = nullptr);
43 
44 private:
45     bool initialize();
46 
47     bool mIsInitialized = false;
48     BaseAnalyzeCallback* mAnalyzeCallback = nullptr;
49 
50     sp<StreamHandler> mStreamHandler;
51     sp<ResourceManager> mResourceManager;
52 };
53 
54 }  // namespace support
55 }  // namespace evs
56 }  // namespace automotive
57 }  // namespace android
58 
59 #endif  // CAR_LIB_EVS_SUPPORT_ANALYZE_USECASE_H
60