• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 FRAMEWORK_NATIVE_CMDS_LSHAL_LSHAL_H_
18 #define FRAMEWORK_NATIVE_CMDS_LSHAL_LSHAL_H_
19 
20 #include <iostream>
21 #include <string>
22 
23 #include <android-base/macros.h>
24 #include <android/hidl/manager/1.0/IServiceManager.h>
25 #include <utils/StrongPointer.h>
26 
27 #include "NullableOStream.h"
28 #include "utils.h"
29 
30 namespace android {
31 namespace lshal {
32 
33 class Lshal {
34 public:
35     Lshal();
36     Lshal(std::ostream &out, std::ostream &err,
37             sp<hidl::manager::V1_0::IServiceManager> serviceManager,
38             sp<hidl::manager::V1_0::IServiceManager> passthroughManager);
39     Status main(const Arg &arg);
40     void usage(const std::string &command = "") const;
41     NullableOStream<std::ostream> err() const;
42     NullableOStream<std::ostream> out() const;
43     const sp<hidl::manager::V1_0::IServiceManager> &serviceManager() const;
44     const sp<hidl::manager::V1_0::IServiceManager> &passthroughManager() const;
45 
46     Status emitDebugInfo(
47             const std::string &interfaceName,
48             const std::string &instanceName,
49             const std::vector<std::string> &options,
50             std::ostream &out,
51             NullableOStream<std::ostream> err) const;
52 private:
53     Status parseArgs(const Arg &arg);
54     std::string mCommand;
55     Arg mCmdArgs;
56     NullableOStream<std::ostream> mOut;
57     NullableOStream<std::ostream> mErr;
58 
59     sp<hidl::manager::V1_0::IServiceManager> mServiceManager;
60     sp<hidl::manager::V1_0::IServiceManager> mPassthroughManager;
61 
62     DISALLOW_COPY_AND_ASSIGN(Lshal);
63 };
64 
65 }  // namespace lshal
66 }  // namespace android
67 
68 #endif  // FRAMEWORK_NATIVE_CMDS_LSHAL_LSHAL_H_
69