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 <kt920.kim@samsung.com>
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);
static void set_sensor_data(Injector__SensorData *data)
{
-
/*
* data format for sensor device
* each value is classified by carriage return character
return ret;
}
-static bool send_multitouch_max_count(void)
+static bool send_set_multitouch_max_count(void)
{
bool ret = false;
return ret;
}
-
static void set_multitouch_data(Injector__MultiTouchData *data)
{
float x = 0.0, y = 0.0;
switch(data->status) {
case INJECTOR__TOUCH_STATUS__PRESS:
TRACE("touch pressed\n");
-
index = data->index;
x = data->xpoint;
y = data->ypoint;
break;
case INJECTOR__TOUCH_STATUS__RELEASE:
TRACE("touch released\n");
-
index = data->index;
x = data->xpoint;
y = data->ypoint;
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
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:
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;
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;
return;
}
#endif
-
recv_buf.len = payloadsize;
-
to_read_bytes -= sizeof(payloadsize);
}
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)
{
(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] =
{
(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 },
"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",
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 */
static const ProtobufCIntRange injector__multi_touch_msg__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 6 }
+ { 0, 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,
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;
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,
, 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;
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
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);
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);
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;
optional SensorData data = 6;
}
+message Resolution {
+ required int32 width = 1;
+ required int32 height = 2;
+}
+
message MultiTouchMaxCount {
optional int32 max = 1 [default = 10];
}
TERMINATE = 4;
MAX_COUNT = 5;
TOUCH_DATA = 6;
+ RESOLUTION = 7;
}
required Type type = 1;
optional StartReq startReq= 2;
optional EventTerminate terminate= 4;
optional MultiTouchMaxCount maxCount = 5;
optional MultiTouchData touchData = 6;
+ optional Resolution resolution = 7;
}
message InjectorMsg {