Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 1 | /* |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 2 | * Copyright (C) 2017 The Android Open Source Project |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 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 | |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 20 | #include <iostream> |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 21 | #include <string> |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 22 | |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 23 | #include <android-base/macros.h> |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 24 | #include <android/hidl/manager/1.0/IServiceManager.h> |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 25 | #include <utils/StrongPointer.h> |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 26 | |
Yifan Hong | 4b86549 | 2017-02-28 19:38:24 -0800 | [diff] [blame] | 27 | #include "NullableOStream.h" |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 28 | #include "utils.h" |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 29 | |
| 30 | namespace android { |
| 31 | namespace lshal { |
| 32 | |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 33 | class Lshal { |
| 34 | public: |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 35 | Lshal(); |
| 36 | Status main(const Arg &arg); |
| 37 | void usage(const std::string &command = "") const; |
| 38 | NullableOStream<std::ostream> err() const; |
| 39 | NullableOStream<std::ostream> out() const; |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 40 | |
Yifan Hong | 48dc9f8 | 2017-05-09 19:33:08 -0700 | [diff] [blame^] | 41 | Status emitDebugInfo( |
Andreas Huber | 28d3591 | 2017-03-24 13:14:11 -0700 | [diff] [blame] | 42 | const std::string &interfaceName, |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 43 | const std::string &instanceName, |
| 44 | const std::vector<std::string> &options, |
Yifan Hong | 48dc9f8 | 2017-05-09 19:33:08 -0700 | [diff] [blame^] | 45 | std::ostream &out, |
| 46 | NullableOStream<std::ostream> err) const; |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 47 | private: |
| 48 | Status parseArgs(const Arg &arg); |
| 49 | std::string mCommand; |
| 50 | Arg mCmdArgs; |
Yifan Hong | 4b86549 | 2017-02-28 19:38:24 -0800 | [diff] [blame] | 51 | NullableOStream<std::ostream> mErr = std::cerr; |
| 52 | NullableOStream<std::ostream> mOut = std::cout; |
Andreas Huber | 28d3591 | 2017-03-24 13:14:11 -0700 | [diff] [blame] | 53 | |
Yifan Hong | 443df79 | 2017-05-09 18:49:45 -0700 | [diff] [blame] | 54 | DISALLOW_COPY_AND_ASSIGN(Lshal); |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 55 | }; |
| 56 | |
Yifan Hong | b0dde93 | 2017-02-10 17:49:58 -0800 | [diff] [blame] | 57 | } // namespace lshal |
| 58 | } // namespace android |
| 59 | |
| 60 | #endif // FRAMEWORK_NATIVE_CMDS_LSHAL_LSHAL_H_ |