From 8aa605ae68625abbabbb8d39043b078baa40e9be Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Thu, 7 Nov 2013 20:31:07 +0900 Subject: [PATCH] tethering: changed a way to set sensor or touch data. app_tethering module does not need to call set data fuction of each device. It would be better to use wrap up functions for setting data, because the purpose of ecs_tethering module is for communicating with ecp and each device. Change-Id: I82ab13a96810418908aed6f5a2a6e5751b9e5df8 Signed-off-by: Kitae Kim --- tizen/src/ecs/ecs_tethering.c | 16 +++++++++++++--- tizen/src/ecs/ecs_tethering.h | 17 ++++++++++++++++- tizen/src/tethering/app_tethering.c | 19 ++++++++++--------- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/tizen/src/ecs/ecs_tethering.c b/tizen/src/ecs/ecs_tethering.c index f332349..066459b 100644 --- a/tizen/src/ecs/ecs_tethering.c +++ b/tizen/src/ecs/ecs_tethering.c @@ -27,8 +27,7 @@ * */ -#include "qemu-common.h" -#include "qemu/sockets.h" +#include "ui/console.h" #include "ecs.h" #include "ecs_tethering.h" @@ -41,6 +40,7 @@ MULTI_DEBUG_CHANNEL(tizen, ecs_tethering); #define MSG_BUF_SIZE 255 #define MSG_LEN_SIZE 4 +#if 0 // ecs <-> ecp messages #define ECS_TETHERING_MSG_CATEGORY "tethering" @@ -53,6 +53,7 @@ MULTI_DEBUG_CHANNEL(tizen, ecs_tethering); #define ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS 3 #define ECS_TETHERING_MSG_ACTION_SENSOR_STATUS 4 #define ECS_TETHERING_MSG_ACTION_TOUCH_STATUS 5 +#endif // ecs <-> ecp static bool send_tethering_ntf(const char *data, const int len); @@ -65,7 +66,7 @@ void send_tethering_sensor_status_ecp(void) ECS_TETHERING_MSG_ACTION_SENSOR_STATUS); } -void send_tethering_multitouch_status_ecp(void) +void send_tethering_touch_status_ecp(void) { send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP, ECS_TETHERING_MSG_ACTION_TOUCH_STATUS); @@ -177,6 +178,15 @@ static bool send_tethering_ntf(const char *data, const int len) return true; } +void send_tethering_sensor_data(const char *data, int len) +{ + set_sensor_data(len, data); +} + +void send_tethering_touch_data(int x, int y, int index, int status) +{ + kbd_mouse_event(x, y, index, status); +} // handle tethering_req message bool msgproc_tethering_req(ECS_Client* ccli, ECS__TetheringReq* msg) diff --git a/tizen/src/ecs/ecs_tethering.h b/tizen/src/ecs/ecs_tethering.h index e132b83..e7ae72e 100644 --- a/tizen/src/ecs/ecs_tethering.h +++ b/tizen/src/ecs/ecs_tethering.h @@ -28,6 +28,21 @@ * */ +// ecs <-> ecp messages +#define ECS_TETHERING_MSG_CATEGORY "tethering" + +#define ECS_TETHERING_MSG_GROUP_ECP 1 +// #define TETHERING_MSG_GROUP_USB +// #define TETHERING_MSG_GROUP_WIFI + +#define ECS_TETHERING_MSG_ACTION_CONNECT 1 +#define ECS_TETHERING_MSG_ACTION_DISCONNECT 2 +#define ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS 3 +#define ECS_TETHERING_MSG_ACTION_SENSOR_STATUS 4 +#define ECS_TETHERING_MSG_ACTION_TOUCH_STATUS 5 + void send_tethering_sensor_status_ecp(void); -void send_tethering_multitouch_status_ecp(void); +void send_tethering_touch_status_ecp(void); void send_tethering_connection_status_ecp(void); +void send_tethering_sensor_data(const char *data, int len); +void send_tethering_touch_data(int x, int y, int index, int status); \ No newline at end of file diff --git a/tizen/src/tethering/app_tethering.c b/tizen/src/tethering/app_tethering.c index 0810de7..9301b79 100644 --- a/tizen/src/tethering/app_tethering.c +++ b/tizen/src/tethering/app_tethering.c @@ -320,7 +320,7 @@ static void set_sensor_data(Injector__SensorData *data) char tmp[255] = {0}; sprintf(tmp, "%s, %s, %s", data->x, data->y, data->z); - set_sensor_accel(tmp, strlen(tmp)); + send_tethering_sensor_data(tmp, strlen(tmp)); INFO("sensor_accel x: %s, y: %s, z: %s\n", data->x, data->y, data->z); } @@ -330,7 +330,7 @@ static void set_sensor_data(Injector__SensorData *data) char tmp[255] = {0}; sprintf(tmp, "%s %s %s", data->x, data->y, data->z); - set_sensor_mag(tmp, strlen(tmp)); + send_tethering_sensor_data(tmp, strlen(tmp)); INFO("sensor_mag x: %s, y: %s, z: %s\n", data->x, data->y, data->z); } @@ -340,7 +340,7 @@ static void set_sensor_data(Injector__SensorData *data) char tmp[255] = {0}; sprintf(tmp, "%s %s %s", data->x, data->y, data->z); - set_sensor_gyro(tmp, strlen(tmp)); + send_tethering_sensor_data(tmp, strlen(tmp)); INFO("sensor_gyro x: %s, y: %s, z: %s\n", data->x, data->y, data->z); } @@ -350,7 +350,8 @@ static void set_sensor_data(Injector__SensorData *data) char tmp[255] = {0}; sprintf(tmp, "%s", data->x); - set_sensor_proxi(tmp, strlen(tmp)); + send_tethering_sensor_data(tmp, strlen(tmp)); + INFO("sensor_proxi x: %s\n", data->x); } break; @@ -359,8 +360,9 @@ static void set_sensor_data(Injector__SensorData *data) char tmp[255] = {0}; sprintf(tmp, "%s", data->x); - set_sensor_light(tmp, strlen(tmp)); - INFO("sensor_light x: %s\n", data->x); + send_tethering_sensor_data(tmp, strlen(tmp)); + + TRACE("sensor_light x: %s\n", data->x); } break; default: @@ -458,10 +460,9 @@ static void set_multitouch_data(Injector__MultiTouchData *data) break; } - INFO("MT. index: %d, x: %f, y: %f\n", index, x, y); - + INFO("set touch_data. index: %d, x: %d, y: %d\n", index, x, y); // set ecs_multitouch - kbd_mouse_event(x, y, index, data->status); + send_tethering_touch_data(x, y, index, status); } static void msgproc_tethering_handshake_ans(Injector__HandShakeAns *msg) -- 2.7.4