blob: 488689ba0e0254d87a641143cce519b54f36ca4d [file] [log] [blame]
Keun Soo Yim14f22722016-06-29 09:49:38 -07001/*
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 Yim6d8a16b2016-06-30 19:29:02 -070022#include <VtsDriverCommUtil.h>
23
Keun Soo Yim14f22722016-06-29 09:49:38 -070024#include "specification_parser/SpecificationBuilder.h"
25
26namespace android {
27namespace vts {
28
Keun Soo Yim6d8a16b2016-06-30 19:29:02 -070029class VtsDriverHalSocketServer : public VtsDriverCommUtil {
Keun Soo Yim14f22722016-06-29 09:49:38 -070030 public:
31 VtsDriverHalSocketServer(android::vts::SpecificationBuilder& spec_builder,
32 const char* lib_path)
Keun Soo Yim1f340b92016-07-09 12:42:33 -070033 : spec_builder_(spec_builder), lib_path_(lib_path), VtsDriverCommUtil() {}
Keun Soo Yim14f22722016-06-29 09:49:38 -070034
35 // Start a session to handle a new request.
Keun Soo Yim6d8a16b2016-06-30 19:29:02 -070036 bool ProcessOneCommand();
Keun Soo Yim14f22722016-06-29 09:49:38 -070037
Keun Soo Yim6d8a16b2016-06-30 19:29:02 -070038 protected:
Keun Soo Yim14f22722016-06-29 09:49:38 -070039 void Exit();
Keun Soo Yim1f340b92016-07-09 12:42:33 -070040 int32_t LoadHal(const string& path, int target_class, int target_type,
41 float target_version, const string& module_name);
Keun Soo Yim14f22722016-06-29 09:49:38 -070042 int32_t Status(int32_t type);
43 const char* Call(const string& arg);
44 const char* GetFunctions();
45
Keun Soo Yim14f22722016-06-29 09:49:38 -070046 private:
47 android::vts::SpecificationBuilder& spec_builder_;
48 const char* lib_path_;
49};
50
Keun Soo Yim6d8a16b2016-06-30 19:29:02 -070051extern int StartSocketServer(const string& socket_port_file,
52 android::vts::SpecificationBuilder& spec_builder,
53 const char* lib_path);
Keun Soo Yim14f22722016-06-29 09:49:38 -070054
55} // namespace vts
56} // namespace android
57
58#endif // __VTS_DRIVER_HAL_SOCKET_SERVER_
59
60#endif // VTS_AGENT_DRIVER_COMM_BINDER