From: Kitae Kim Date: Mon, 11 Nov 2013 08:37:28 +0000 (+0900) Subject: tethering: added resolution message. X-Git-Tag: TizenStudio_2.0_p2.3~449^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F74%2F12874%2F1;p=sdk%2Femulator%2Fqemu.git tethering: added resolution message. Touch point might be different, depending on emulator resolution. That's why resolution message is added. In addition to this, resolution and max count for touch have to be sent on start_ans message. Change-Id: I8dfa69361f7ed69832d05f3c8ef26d89d6ef522c Signed-off-by: Kitae Kim --- diff --git a/tizen/src/ecs/ecs_tethering.h b/tizen/src/ecs/ecs_tethering.h index e7ae72e..0df460f 100644 --- a/tizen/src/ecs/ecs_tethering.h +++ b/tizen/src/ecs/ecs_tethering.h @@ -45,4 +45,4 @@ void send_tethering_sensor_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 +void send_tethering_touch_data(int x, int y, int index, int status); diff --git a/tizen/src/tethering/app_tethering.c b/tizen/src/tethering/app_tethering.c index ee4b141..d0ff763 100644 --- a/tizen/src/tethering/app_tethering.c +++ b/tizen/src/tethering/app_tethering.c @@ -328,7 +328,6 @@ static bool send_set_sensor_status_msg(Injector__SensorType sensor_type, static void set_sensor_data(Injector__SensorData *data) { - /* * data format for sensor device * each value is classified by carriage return character @@ -440,7 +439,7 @@ static bool send_mulitouch_start_ans_msg(Injector__Result result) return ret; } -static bool send_multitouch_max_count(void) +static bool send_set_multitouch_max_count(void) { bool ret = false; @@ -463,7 +462,6 @@ static bool send_multitouch_max_count(void) return ret; } - static void set_multitouch_data(Injector__MultiTouchData *data) { float x = 0.0, y = 0.0; @@ -472,7 +470,6 @@ static void set_multitouch_data(Injector__MultiTouchData *data) switch(data->status) { case INJECTOR__TOUCH_STATUS__PRESS: TRACE("touch pressed\n"); - index = data->index; x = data->xpoint; y = data->ypoint; @@ -480,7 +477,6 @@ static void set_multitouch_data(Injector__MultiTouchData *data) break; case INJECTOR__TOUCH_STATUS__RELEASE: TRACE("touch released\n"); - index = data->index; x = data->xpoint; y = data->ypoint; @@ -496,6 +492,30 @@ static void set_multitouch_data(Injector__MultiTouchData *data) send_tethering_touch_data(x, y, index, status); } +static bool send_set_multitouch_resolution(void) +{ + bool ret = false; + + Injector__MultiTouchMsg mt = INJECTOR__MULTI_TOUCH_MSG__INIT; + Injector__Resolution resolution = INJECTOR__RESOLUTION__INIT; + + TRACE("enter: %s\n", __func__); + + resolution.width = get_emul_lcd_width(); + resolution.height = get_emul_lcd_height(); + + mt.type = INJECTOR__MULTI_TOUCH_MSG__TYPE__RESOLUTION; + mt.resolution = &resolution; + + INFO("send multi-touch resolution: %dx%d\n", + resolution.width, resolution.height); + ret = build_mulitouch_msg(&mt); + + TRACE("leave: %s, ret: %d\n", __func__, ret); + + return ret; +} + static void msgproc_tethering_handshake_ans(Injector__HandShakeAns *msg) { // FIXME: handle handshake answer @@ -549,12 +569,6 @@ static bool msgproc_tethering_event_msg(Injector__EventMsg *msg) send_event_start_ans_msg(INJECTOR__RESULT__SUCCESS); } break; -#if 0 - case INJECTOR__EVENT_MSG__TYPE__START_ANS: - break; - case INJECTOR__EVENT_MSG__TYPE__EVENT_STATUS: - break; -#endif case INJECTOR__EVENT_MSG__TYPE__TERMINATE: break; default: @@ -590,12 +604,6 @@ static bool msgproc_tethering_sensor_msg(Injector__SensorMsg *msg) send_sensor_start_ans_msg(INJECTOR__RESULT__SUCCESS); break; -#if 0 - case INJECTOR__SENSOR_MSG__TYPE__START_ANS: - break; - case INJECTOR__SENSOR_MSG__TYPE__SENSOR_STATUS: - break; -#endif case INJECTOR__SENSOR_MSG__TYPE__TERMINATE: TRACE("SENSOR_MSG_TYPE_TERMINATE\n"); break; @@ -620,19 +628,15 @@ static bool msgproc_tethering_mt_msg(Injector__MultiTouchMsg *msg) switch(msg->type) { case INJECTOR__MULTI_TOUCH_MSG__TYPE__START_REQ: TRACE("MULTITOUCH_MSG_TYPE_START\n"); + + send_set_multitouch_max_count(); + send_set_multitouch_resolution(); + ret = send_mulitouch_start_ans_msg(INJECTOR__RESULT__SUCCESS); break; -#if 0 - case INJECTOR__MULTI_TOUCH_MSG__TYPE__START_ANS: - break; -#endif case INJECTOR__MULTI_TOUCH_MSG__TYPE__TERMINATE: TRACE("MULTITOUCH_MSG_TYPE_TERMINATE\n"); break; - case INJECTOR__MULTI_TOUCH_MSG__TYPE__MAX_COUNT: - ret = send_multitouch_max_count(); - TRACE("MULTITOUCH_MSG_TYPE_TERMINATE\n"); - break; case INJECTOR__MULTI_TOUCH_MSG__TYPE__TOUCH_DATA: set_multitouch_data(msg->touchdata); break; @@ -785,9 +789,7 @@ static void tethering_io_handler(void *opaque) return; } #endif - recv_buf.len = payloadsize; - to_read_bytes -= sizeof(payloadsize); } diff --git a/tizen/src/tethering/genmsg/tethering.pb-c.c b/tizen/src/tethering/genmsg/tethering.pb-c.c index 3a93617..7d52d8b 100644 --- a/tizen/src/tethering/genmsg/tethering.pb-c.c +++ b/tizen/src/tethering/genmsg/tethering.pb-c.c @@ -522,6 +522,49 @@ void injector__sensor_msg__free_unpacked PROTOBUF_C_ASSERT (message->base.descriptor == &injector__sensor_msg__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } +void injector__resolution__init + (Injector__Resolution *message) +{ + static Injector__Resolution init_value = INJECTOR__RESOLUTION__INIT; + *message = init_value; +} +size_t injector__resolution__get_packed_size + (const Injector__Resolution *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &injector__resolution__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t injector__resolution__pack + (const Injector__Resolution *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &injector__resolution__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t injector__resolution__pack_to_buffer + (const Injector__Resolution *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &injector__resolution__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Injector__Resolution * + injector__resolution__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Injector__Resolution *) + protobuf_c_message_unpack (&injector__resolution__descriptor, + allocator, len, data); +} +void injector__resolution__free_unpacked + (Injector__Resolution *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &injector__resolution__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} void injector__multi_touch_max_count__init (Injector__MultiTouchMaxCount *message) { @@ -1361,6 +1404,57 @@ const ProtobufCMessageDescriptor injector__sensor_msg__descriptor = (ProtobufCMessageInit) injector__sensor_msg__init, NULL,NULL,NULL /* reserved[123] */ }; +static const ProtobufCFieldDescriptor injector__resolution__field_descriptors[2] = +{ + { + "width", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Injector__Resolution, width), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "height", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Injector__Resolution, height), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned injector__resolution__field_indices_by_name[] = { + 1, /* field[1] = height */ + 0, /* field[0] = width */ +}; +static const ProtobufCIntRange injector__resolution__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor injector__resolution__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "injector.Resolution", + "Resolution", + "Injector__Resolution", + "injector", + sizeof(Injector__Resolution), + 2, + injector__resolution__field_descriptors, + injector__resolution__field_indices_by_name, + 1, injector__resolution__number_ranges, + (ProtobufCMessageInit) injector__resolution__init, + NULL,NULL,NULL /* reserved[123] */ +}; static const int32_t injector__multi_touch_max_count__max__default_value = 10; static const ProtobufCFieldDescriptor injector__multi_touch_max_count__field_descriptors[1] = { @@ -1480,20 +1574,22 @@ const ProtobufCMessageDescriptor injector__multi_touch_data__descriptor = (ProtobufCMessageInit) injector__multi_touch_data__init, NULL,NULL,NULL /* reserved[123] */ }; -const ProtobufCEnumValue injector__multi_touch_msg__type__enum_values_by_number[5] = +const ProtobufCEnumValue injector__multi_touch_msg__type__enum_values_by_number[6] = { { "START_REQ", "INJECTOR__MULTI_TOUCH_MSG__TYPE__START_REQ", 2 }, { "START_ANS", "INJECTOR__MULTI_TOUCH_MSG__TYPE__START_ANS", 3 }, { "TERMINATE", "INJECTOR__MULTI_TOUCH_MSG__TYPE__TERMINATE", 4 }, { "MAX_COUNT", "INJECTOR__MULTI_TOUCH_MSG__TYPE__MAX_COUNT", 5 }, { "TOUCH_DATA", "INJECTOR__MULTI_TOUCH_MSG__TYPE__TOUCH_DATA", 6 }, + { "RESOLUTION", "INJECTOR__MULTI_TOUCH_MSG__TYPE__RESOLUTION", 7 }, }; static const ProtobufCIntRange injector__multi_touch_msg__type__value_ranges[] = { -{2, 0},{0, 5} +{2, 0},{0, 6} }; -const ProtobufCEnumValueIndex injector__multi_touch_msg__type__enum_values_by_name[5] = +const ProtobufCEnumValueIndex injector__multi_touch_msg__type__enum_values_by_name[6] = { { "MAX_COUNT", 3 }, + { "RESOLUTION", 5 }, { "START_ANS", 1 }, { "START_REQ", 0 }, { "TERMINATE", 2 }, @@ -1506,15 +1602,15 @@ const ProtobufCEnumDescriptor injector__multi_touch_msg__type__descriptor = "Type", "Injector__MultiTouchMsg__Type", "injector", - 5, + 6, injector__multi_touch_msg__type__enum_values_by_number, - 5, + 6, injector__multi_touch_msg__type__enum_values_by_name, 1, injector__multi_touch_msg__type__value_ranges, NULL,NULL,NULL,NULL /* reserved[1234] */ }; -static const ProtobufCFieldDescriptor injector__multi_touch_msg__field_descriptors[6] = +static const ProtobufCFieldDescriptor injector__multi_touch_msg__field_descriptors[7] = { { "type", @@ -1588,9 +1684,22 @@ static const ProtobufCFieldDescriptor injector__multi_touch_msg__field_descripto 0, /* packed */ 0,NULL,NULL /* reserved1,reserved2, etc */ }, + { + "resolution", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Injector__MultiTouchMsg, resolution), + &injector__resolution__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, }; static const unsigned injector__multi_touch_msg__field_indices_by_name[] = { 4, /* field[4] = maxCount */ + 6, /* field[6] = resolution */ 2, /* field[2] = startAns */ 1, /* field[1] = startReq */ 3, /* field[3] = terminate */ @@ -1600,7 +1709,7 @@ static const unsigned injector__multi_touch_msg__field_indices_by_name[] = { static const ProtobufCIntRange injector__multi_touch_msg__number_ranges[1 + 1] = { { 1, 0 }, - { 0, 6 } + { 0, 7 } }; const ProtobufCMessageDescriptor injector__multi_touch_msg__descriptor = { @@ -1610,7 +1719,7 @@ const ProtobufCMessageDescriptor injector__multi_touch_msg__descriptor = "Injector__MultiTouchMsg", "injector", sizeof(Injector__MultiTouchMsg), - 6, + 7, injector__multi_touch_msg__field_descriptors, injector__multi_touch_msg__field_indices_by_name, 1, injector__multi_touch_msg__number_ranges, diff --git a/tizen/src/tethering/genmsg/tethering.pb-c.h b/tizen/src/tethering/genmsg/tethering.pb-c.h index 43e3efe..64288af 100644 --- a/tizen/src/tethering/genmsg/tethering.pb-c.h +++ b/tizen/src/tethering/genmsg/tethering.pb-c.h @@ -20,6 +20,7 @@ typedef struct _Injector__EventTerminate Injector__EventTerminate; typedef struct _Injector__SetSensorStatus Injector__SetSensorStatus; typedef struct _Injector__SensorData Injector__SensorData; typedef struct _Injector__SensorMsg Injector__SensorMsg; +typedef struct _Injector__Resolution Injector__Resolution; typedef struct _Injector__MultiTouchMaxCount Injector__MultiTouchMaxCount; typedef struct _Injector__MultiTouchData Injector__MultiTouchData; typedef struct _Injector__MultiTouchMsg Injector__MultiTouchMsg; @@ -46,7 +47,8 @@ typedef enum _Injector__MultiTouchMsg__Type { INJECTOR__MULTI_TOUCH_MSG__TYPE__START_ANS = 3, INJECTOR__MULTI_TOUCH_MSG__TYPE__TERMINATE = 4, INJECTOR__MULTI_TOUCH_MSG__TYPE__MAX_COUNT = 5, - INJECTOR__MULTI_TOUCH_MSG__TYPE__TOUCH_DATA = 6 + INJECTOR__MULTI_TOUCH_MSG__TYPE__TOUCH_DATA = 6, + INJECTOR__MULTI_TOUCH_MSG__TYPE__RESOLUTION = 7 } Injector__MultiTouchMsg__Type; typedef enum _Injector__InjectorMsg__Type { INJECTOR__INJECTOR_MSG__TYPE__HANDSHAKE_REQ = 2, @@ -224,6 +226,17 @@ struct _Injector__SensorMsg , 0, NULL, NULL, NULL, NULL, NULL } +struct _Injector__Resolution +{ + ProtobufCMessage base; + int32_t width; + int32_t height; +}; +#define INJECTOR__RESOLUTION__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&injector__resolution__descriptor) \ + , 0, 0 } + + struct _Injector__MultiTouchMaxCount { ProtobufCMessage base; @@ -261,10 +274,11 @@ struct _Injector__MultiTouchMsg Injector__EventTerminate *terminate; Injector__MultiTouchMaxCount *maxcount; Injector__MultiTouchData *touchdata; + Injector__Resolution *resolution; }; #define INJECTOR__MULTI_TOUCH_MSG__INIT \ { PROTOBUF_C_MESSAGE_INIT (&injector__multi_touch_msg__descriptor) \ - , 0, NULL, NULL, NULL, NULL, NULL } + , 0, NULL, NULL, NULL, NULL, NULL, NULL } struct _Injector__InjectorMsg @@ -512,6 +526,25 @@ Injector__SensorMsg * void injector__sensor_msg__free_unpacked (Injector__SensorMsg *message, ProtobufCAllocator *allocator); +/* Injector__Resolution methods */ +void injector__resolution__init + (Injector__Resolution *message); +size_t injector__resolution__get_packed_size + (const Injector__Resolution *message); +size_t injector__resolution__pack + (const Injector__Resolution *message, + uint8_t *out); +size_t injector__resolution__pack_to_buffer + (const Injector__Resolution *message, + ProtobufCBuffer *buffer); +Injector__Resolution * + injector__resolution__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void injector__resolution__free_unpacked + (Injector__Resolution *message, + ProtobufCAllocator *allocator); /* Injector__MultiTouchMaxCount methods */ void injector__multi_touch_max_count__init (Injector__MultiTouchMaxCount *message); @@ -626,6 +659,9 @@ typedef void (*Injector__SensorData_Closure) typedef void (*Injector__SensorMsg_Closure) (const Injector__SensorMsg *message, void *closure_data); +typedef void (*Injector__Resolution_Closure) + (const Injector__Resolution *message, + void *closure_data); typedef void (*Injector__MultiTouchMaxCount_Closure) (const Injector__MultiTouchMaxCount *message, void *closure_data); @@ -664,6 +700,7 @@ extern const ProtobufCMessageDescriptor injector__set_sensor_status__descriptor; extern const ProtobufCMessageDescriptor injector__sensor_data__descriptor; extern const ProtobufCMessageDescriptor injector__sensor_msg__descriptor; extern const ProtobufCEnumDescriptor injector__sensor_msg__type__descriptor; +extern const ProtobufCMessageDescriptor injector__resolution__descriptor; extern const ProtobufCMessageDescriptor injector__multi_touch_max_count__descriptor; extern const ProtobufCMessageDescriptor injector__multi_touch_data__descriptor; extern const ProtobufCMessageDescriptor injector__multi_touch_msg__descriptor; diff --git a/tizen/src/tethering/msg/tethering.proto b/tizen/src/tethering/msg/tethering.proto index da0570d..d4d014f 100644 --- a/tizen/src/tethering/msg/tethering.proto +++ b/tizen/src/tethering/msg/tethering.proto @@ -108,6 +108,11 @@ message SensorMsg { optional SensorData data = 6; } +message Resolution { + required int32 width = 1; + required int32 height = 2; +} + message MultiTouchMaxCount { optional int32 max = 1 [default = 10]; } @@ -131,6 +136,7 @@ message MultiTouchMsg { TERMINATE = 4; MAX_COUNT = 5; TOUCH_DATA = 6; + RESOLUTION = 7; } required Type type = 1; optional StartReq startReq= 2; @@ -138,6 +144,7 @@ message MultiTouchMsg { optional EventTerminate terminate= 4; optional MultiTouchMaxCount maxCount = 5; optional MultiTouchData touchData = 6; + optional Resolution resolution = 7; } message InjectorMsg {