tethering: changed a way to set sensor or touch data. 72/12872/1
authorKitae Kim <kt920.kim@samsung.com>
Thu, 7 Nov 2013 11:31:07 +0000 (20:31 +0900)
committerKitae Kim <kt920.kim@samsung.com>
Mon, 25 Nov 2013 07:44:21 +0000 (16:44 +0900)
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 <kt920.kim@samsung.com>
tizen/src/ecs/ecs_tethering.c
tizen/src/ecs/ecs_tethering.h
tizen/src/tethering/app_tethering.c

index f332349211ca6b9334ce72d96e1931e26f07d045..066459b56cef62667380355ccd77180e3ce43a64 100644 (file)
@@ -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)
index e132b83995bf52d3bb56b921de7b8ece5f2b4c39..e7ae72e0a1fb3d65c59e0cbe86a8a5a3043e743e 100644 (file)
  *
  */
 
+// 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
index 0810de79354e9fac202eaf5464bb561b79e59789..9301b798ec67d65250fb4ddd339e7d0205c99b1b 100644 (file)
@@ -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)