4 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #pragma once /* __INJECTOR_H__ */
22 #include <sensor_internal.h>
26 #include "sensor_manager.h"
28 #define INJECTOR_ARGC 4 /* e.g. {sensorctl, inject, wristup, conf} */
30 #define REGISTER_INJECTOR(sensor_type, event_name, injector_type) \
31 static injector_type injector(sensor_type, event_name);
35 injector(sensor_type_t sensor_type, const char *event_name);
36 virtual ~injector() {}
38 virtual bool setup(void) { return true; }
39 virtual bool teardown(void) { return true; }
41 const std::string& name() const { return m_name; }
42 const sensor_type_t type() const { return m_type; }
44 virtual bool inject(int argc, char *argv[]) = 0;
51 class injector_manager : public sensor_manager {
53 static void register_injector(injector *inject);
56 virtual ~injector_manager();
58 bool run(int argc, char *argv[]);
61 static std::vector<injector *> injectors;
63 injector *get_injector(sensor_type_t type, const char *name);