• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
22 #include <VtsDriverCommUtil.h>
23 
24 #include "specification_parser/SpecificationBuilder.h"
25 
26 namespace android {
27 namespace vts {
28 
29 class VtsDriverHalSocketServer : public VtsDriverCommUtil {
30  public:
VtsDriverHalSocketServer(android::vts::SpecificationBuilder & spec_builder,const char * lib_path)31   VtsDriverHalSocketServer(android::vts::SpecificationBuilder& spec_builder,
32                            const char* lib_path)
33       : VtsDriverCommUtil(), spec_builder_(spec_builder), lib_path_(lib_path) {}
34 
35   // Start a session to handle a new request.
36   bool ProcessOneCommand();
37 
38  protected:
39   void Exit();
40 
41   int32_t LoadHal(const string& path, int target_class, int target_type,
42                   float target_version, const string& target_package,
43                   const string& target_component_name,
44                   const string& hw_binder_service_name,
45                   const string& module_name);
46   int32_t Status(int32_t type);
47   const char* ReadSpecification(
48       const string& name, int target_class, int target_type,
49       float target_version, const string& target_package);
50   const char* Call(const string& arg);
51   const char* GetAttribute(const string& arg);
52   string ListFunctions() const;
53 
54  private:
55   android::vts::SpecificationBuilder& spec_builder_;
56   const char* lib_path_;
57 };
58 
59 extern int StartSocketServer(const string& socket_port_file,
60                              android::vts::SpecificationBuilder& spec_builder,
61                              const char* lib_path);
62 
63 }  // namespace vts
64 }  // namespace android
65 
66 #endif  // __VTS_DRIVER_HAL_SOCKET_SERVER_
67 
68 #endif  // VTS_AGENT_DRIVER_COMM_BINDER
69