Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 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 VTS_AGENT_DRIVER_COMM_BINDER // socket |
| 18 | |
| 19 | #ifndef __VTS_DRIVER_HAL_SOCKET_SERVER_ |
| 20 | #define __VTS_DRIVER_HAL_SOCKET_SERVER_ |
| 21 | |
Keun Soo Yim | 6d8a16b | 2016-06-30 19:29:02 -0700 | [diff] [blame] | 22 | #include <VtsDriverCommUtil.h> |
| 23 | |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 24 | #include "specification_parser/SpecificationBuilder.h" |
| 25 | |
| 26 | namespace android { |
| 27 | namespace vts { |
| 28 | |
Keun Soo Yim | 6d8a16b | 2016-06-30 19:29:02 -0700 | [diff] [blame] | 29 | class VtsDriverHalSocketServer : public VtsDriverCommUtil { |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 30 | public: |
| 31 | VtsDriverHalSocketServer(android::vts::SpecificationBuilder& spec_builder, |
| 32 | const char* lib_path) |
Keun Soo Yim | 1f340b9 | 2016-07-09 12:42:33 -0700 | [diff] [blame] | 33 | : spec_builder_(spec_builder), lib_path_(lib_path), VtsDriverCommUtil() {} |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 34 | |
| 35 | // Start a session to handle a new request. |
Keun Soo Yim | 6d8a16b | 2016-06-30 19:29:02 -0700 | [diff] [blame] | 36 | bool ProcessOneCommand(); |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 37 | |
Keun Soo Yim | 6d8a16b | 2016-06-30 19:29:02 -0700 | [diff] [blame] | 38 | protected: |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 39 | void Exit(); |
Keun Soo Yim | 1f340b9 | 2016-07-09 12:42:33 -0700 | [diff] [blame] | 40 | int32_t LoadHal(const string& path, int target_class, int target_type, |
| 41 | float target_version, const string& module_name); |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 42 | int32_t Status(int32_t type); |
| 43 | const char* Call(const string& arg); |
| 44 | const char* GetFunctions(); |
| 45 | |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 46 | private: |
| 47 | android::vts::SpecificationBuilder& spec_builder_; |
| 48 | const char* lib_path_; |
| 49 | }; |
| 50 | |
Keun Soo Yim | 6d8a16b | 2016-06-30 19:29:02 -0700 | [diff] [blame] | 51 | extern int StartSocketServer(const string& socket_port_file, |
| 52 | android::vts::SpecificationBuilder& spec_builder, |
| 53 | const char* lib_path); |
Keun Soo Yim | 14f2272 | 2016-06-29 09:49:38 -0700 | [diff] [blame] | 54 | |
| 55 | } // namespace vts |
| 56 | } // namespace android |
| 57 | |
| 58 | #endif // __VTS_DRIVER_HAL_SOCKET_SERVER_ |
| 59 | |
| 60 | #endif // VTS_AGENT_DRIVER_COMM_BINDER |