557b2966d63eba50cefe3961fd0131bf0f3aea9c
[platform/core/api/peripheral-io.git] / include / peripheral_dbus.h
1 /*
2  * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
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 #ifndef __PERIPHERAL_DBUS_H_
17 #define __PERIPHERAL_DBUS_H_
18
19 #include <gio/gio.h>
20
21 #define PERIPHERAL_DBUS_INTERFACE       "org.tizen.peripheral_io"
22 #define PERIPHERAL_DBUS_PATH            "/Org/Tizen/Peripheral_io"
23 #define PERIPHERAL_DBUS_GPIO_PATH       "/Org/Tizen/Peripheral_io/Gpio"
24 #define PERIPHERAL_DBUS_I2C_PATH        "/Org/Tizen/Peripheral_io/I2c"
25 #define PERIPHERAL_DBUS_PWM_PATH        "/Org/Tizen/Peripheral_io/Pwm"
26 #define PERIPHERAL_DBUS_NAME            "org.tizen.peripheral_io"
27
28 #define PERIPHERAL_METHOD_GPIO  "gpio"
29 #define PERIPHERAL_METHOD_I2C   "i2c"
30 #define PERIPHERAL_METHOD_PWM   "pwm"
31 #define PERIPHERAL_METHOD_SPI   "spi"
32 #define PERIPHERAL_METHOD_UART  "uart"
33
34 void gpio_proxy_init(void);
35 void i2c_proxy_init(void);
36 void pwm_proxy_init(void);
37
38 void gpio_proxy_deinit();
39 void i2c_proxy_deinit();
40 void pwm_proxy_deinit();
41
42 int peripheral_dbus_gpio(peripheral_gpio_h gpio, char * sensorid, char *funcname, int write_value, int *read_value);
43 int peripheral_dbus_gpio_open(peripheral_gpio_h gpio);
44 int peripheral_dbus_gpio_close(peripheral_gpio_h gpio);
45 int peripheral_dbus_gpio_get_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e *direction);
46 int peripheral_dbus_gpio_set_direction(peripheral_gpio_h gpio, peripheral_gpio_direction_e direction);
47 int peripheral_dbus_gpio_read(peripheral_gpio_h gpio, int *value);
48 int peripheral_dbus_gpio_write(peripheral_gpio_h gpio, int value);
49 int peripheral_dbus_gpio_get_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e *edge);
50 int peripheral_dbus_gpio_set_edge_mode(peripheral_gpio_h gpio, peripheral_gpio_edge_e edge);
51
52 int peripheral_dbus_i2c_init(peripheral_i2c_h i2c, int bus);
53 int peripheral_dbus_i2c_stop(peripheral_i2c_h i2c);
54 int peripheral_dbus_i2c_set_address(peripheral_i2c_h i2c, int address);
55 int peripheral_dbus_i2c_read(peripheral_i2c_h i2c, uint8_t *data, int length);
56 int peripheral_dbus_i2c_write(peripheral_i2c_h i2c, uint8_t *data, int length);
57
58 int peripheral_dbus_pwm_open(peripheral_pwm_context_h dev, int device, int channel);
59 int peripheral_dbus_pwm_close(peripheral_pwm_context_h dev);
60 int peripheral_dbus_pwm_get_duty_cycle(peripheral_pwm_context_h dev, int *duty_cycle);
61 int peripheral_dbus_pwm_set_duty_cycle(peripheral_pwm_context_h dev, int duty_cycle);
62 int peripheral_dbus_pwm_get_period(peripheral_pwm_context_h dev, int *period);
63 int peripheral_dbus_pwm_set_period(peripheral_pwm_context_h dev, int period);
64 int peripheral_dbus_pwm_set_enable(peripheral_pwm_context_h dev, peripheral_pwm_state_e enable);
65
66 #endif /* __PERIPHERAL_DBUS_H_ */