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 <thread>
20 
21 #include "BaseUseCase.h"
22 #include "StreamHandler.h"
23 #include "BaseAnalyzeCallback.h"
24 #include "ResourceManager.h"
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,
43                                                BaseAnalyzeCallback* cb = nullptr);
44 
45 private:
46     bool initialize();
47 
48     bool mIsInitialized = false;
49     BaseAnalyzeCallback* mAnalyzeCallback = nullptr;
50 
51     sp<StreamHandler>           mStreamHandler;
52     sp<ResourceManager>         mResourceManager;
53 };
54 
55 }  // namespace support
56 }  // namespace evs
57 }  // namespace automotive
58 }  // namespace android
59 
60 #endif // CAR_LIB_EVS_SUPPORT_ANALYZE_USECASE_H
61