#include "ecs/ecs_tethering.h"
#include "genmsg/tethering.pb-c.h"
-#include "debug_ch.h"
+#include "util/new_debug_ch.h"
-MULTI_DEBUG_CHANNEL(tizen, app_tethering);
+DECLARE_DEBUG_CHANNEL(app_tethering);
#define TETHERING_MSG_HANDSHAKE_KEY 100
#define MSG_BUF_SIZE 255
msg_packed_size = tethering__tethering_msg__get_packed_size(msg);
*payloadsize = msg_packed_size + MSG_LEN_SIZE;
- TRACE("create tethering_msg. msg_packed_size %d, payloadsize %d\n", msg_packed_size, *payloadsize);
+ LOG_TRACE("create tethering_msg. msg_packed_size %d, payloadsize %d\n", msg_packed_size, *payloadsize);
buf = g_malloc(*payloadsize);
if (!buf) {
- ERR("failed to allocate memory\n");
+ LOG_SEVERE("failed to allocate memory\n");
return NULL;
}
tethering__tethering_msg__pack(msg, buf + MSG_LEN_SIZE);
- TRACE("msg_packed_size 1 %x\n", msg_packed_size);
+ LOG_TRACE("msg_packed_size 1 %x\n", msg_packed_size);
msg_packed_size = htonl(msg_packed_size);
- TRACE("msg_packed_size 2 %x\n", msg_packed_size);
+ LOG_TRACE("msg_packed_size 2 %x\n", msg_packed_size);
memcpy(buf, &msg_packed_size, MSG_LEN_SIZE);
}
if (!tethering_client) {
- ERR("TetheringState is NULL\n");
+ LOG_SEVERE("TetheringState is NULL\n");
g_free(buf);
return false;
}
total_buf_size = payload_size;
do {
- TRACE("sending a buffer as many as this size: %d\n", total_buf_size);
+ LOG_TRACE("sending a buffer as many as this size: %d\n", total_buf_size);
sent_size =
qemu_sendto(sockfd, buf + buf_offset, total_buf_size, 0, NULL, 0);
ret = select(sockfd + 1, NULL, &writefds, NULL, &timeout);
if (ret < 0) {
- INFO("not possible to send data\n");
+ LOG_INFO("not possible to send data\n");
break;
}
- TRACE("possible to send data\n");
+ LOG_TRACE("possible to send data\n");
continue;
}
- ERR("failed to send a message. sent_size: %d\n", sent_size);
+ LOG_SEVERE("failed to send a message. sent_size: %d\n", sent_size);
ret = false;
break;
}
- TRACE("sent size: %d\n", sent_size);
+ LOG_TRACE("sent size: %d\n", sent_size);
buf_offset += sent_size;
total_buf_size -= sent_size;
} while (total_buf_size > 0);
- TRACE("sent packets: %d, payload_size %d\n", (payload_size - total_buf_size), payload_size);
+ LOG_TRACE("sent packets: %d, payload_size %d\n", (payload_size - total_buf_size), payload_size);
g_free(buf);
return ret;
Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
Tethering__HandShakeReq req = TETHERING__HAND_SHAKE_REQ__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
req.key = TETHERING_MSG_HANDSHAKE_KEY;
msg.type = TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_REQ;
msg.handshakereq = &req;
- TRACE("send handshake_req message\n");
+ LOG_TRACE("send handshake_req message\n");
send_msg_to_controller(&msg);
- TRACE("leave: %s\n", __func__);
+ LOG_TRACE("leave: %s\n", __func__);
return true;
}
Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
Tethering__EmulatorState emul_state = TETHERING__EMULATOR_STATE__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
emul_state.state = TETHERING__CONNECTION_STATE__DISCONNECTED;
msg.type = TETHERING__TETHERING_MSG__TYPE__EMUL_STATE;
msg.emulstate = &emul_state;
- INFO("send emulator_state message\n");
+ LOG_INFO("send emulator_state message\n");
send_msg_to_controller(&msg);
- TRACE("leave: %s\n", __func__);
+ LOG_TRACE("leave: %s\n", __func__);
return true;
}
bool ret = false;
Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
msg.type = TETHERING__TETHERING_MSG__TYPE__EVENT_MSG;
msg.eventmsg = event;
ret = send_msg_to_controller(&msg);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
Tethering__EventMsg event = TETHERING__EVENT_MSG__INIT;
Tethering__StartAns start_ans = TETHERING__START_ANS__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
start_ans.result = result;
event.type = TETHERING__EVENT_MSG__TYPE__START_ANS;
event.startans = &start_ans;
- TRACE("send event_start_ans message\n");
+ LOG_TRACE("send event_start_ans message\n");
ret = build_event_msg(&event);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
Tethering__EventMsg event = TETHERING__EVENT_MSG__INIT;
Tethering__SetEventStatus event_status = TETHERING__SET_EVENT_STATUS__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
event_status.type = event_type;
event_status.state = status;
event.type = TETHERING__EVENT_MSG__TYPE__EVENT_STATUS;
event.setstatus = &event_status;
- TRACE("send event_set_event_status message\n");
+ LOG_TRACE("send event_set_event_status message\n");
ret = build_event_msg(&event);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
int status = TETHERING__STATE__DISABLED;
if (msg->state == TETHERING__CONNECTION_STATE__TERMINATED) {
- INFO("app is terminated\n");
+ LOG_INFO("app is terminated\n");
// set_tethering_app_state(false);
set_tethering_sensor_status(status);
{
int touch_status = 0;
- TRACE("EVENT_MSG_TYPE_START_REQ\n");
+ LOG_TRACE("EVENT_MSG_TYPE_START_REQ\n");
send_set_event_status_msg(TETHERING__EVENT_TYPE__SENSOR,
TETHERING__STATE__ENABLED);
}
set_tethering_touch_status(touch_status);
- TRACE("send multi-touch event_status msg: %d\n", touch_status);
+ LOG_TRACE("send touch event_status msg: %d\n", touch_status);
send_set_event_status_msg(TETHERING__EVENT_TYPE__TOUCH, touch_status);
- TRACE("send event_start_ans msg: %d\n", touch_status);
+ LOG_TRACE("send event_start_ans msg: %d\n", touch_status);
send_event_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS);
}
break;
case TETHERING__EVENT_MSG__TYPE__TERMINATE:
break;
default:
- TRACE("invalid event_msg type\n");
+ LOG_TRACE("invalid event_msg type\n");
ret = false;
break;
}
(const uint8_t *)data);
if (!tethering) {
- ERR("no tethering massage\n");
+ LOG_SEVERE("no tethering massage\n");
return false;
}
ret = false;
} else {
msgproc_tethering_handshake_ans(msg);
- TRACE("receive handshake answer\n");
+ LOG_TRACE("receive handshake answer\n");
set_tethering_connection_status(CONNECTED);
}
{
Tethering__AppState *msg = tethering->appstate;
- TRACE("receive app_state msg\n");
+ LOG_TRACE("receive app_state msg\n");
if (!msg) {
ret = false;
} else {
{
Tethering__EventMsg *msg = tethering->eventmsg;
- TRACE("receive event_msg\n");
+ LOG_TRACE("receive event_msg\n");
if (!msg) {
ret = false;
} else {
{
Tethering__SensorMsg *msg = tethering->sensormsg;
- TRACE("receive sensor_msg\n");
+ LOG_TRACE("receive sensor_msg\n");
if (!msg) {
ret = false;
} else {
{
Tethering__TouchMsg *msg = tethering->touchmsg;
- TRACE("receive touch_msg\n");
+ LOG_TRACE("receive touch_msg\n");
if (!msg) {
ret = false;
} else {
{
Tethering__DisplayMsg *msg = tethering->displaymsg;
- TRACE("receive display_msg\n");
+ LOG_TRACE("receive display_msg\n");
if (!msg) {
ret = false;
} else {
#endif
default:
- TRACE("invalid type message\n");
+ LOG_WARNING("invalid type message\n");
ret = false;
break;
}
to_read_bytes = (int)to_read_bytes_long;
#endif
- TRACE("ioctl: ret: %d, FIONREAD: %d\n", ret, to_read_bytes);
+ LOG_TRACE("ioctl: ret: %d, FIONREAD: %d\n", ret, to_read_bytes);
if (to_read_bytes == 0) {
- INFO("there is no read data\n");
+ LOG_INFO("there is no read data\n");
disconnect_tethering_app();
return;
}
}
payloadsize = ntohl(payloadsize);
- TRACE("payload size: %d\n", payloadsize);
+ LOG_TRACE("payload size: %d\n", payloadsize);
#if 0
if (payloadsize > to_read_bytes) {
- TRACE("invalid payload size: %d\n", payloadsize);
+ LOG_TRACE("invalid payload size: %d\n", payloadsize);
return;
}
#endif
qemu_recv(sockfd, (char *)(recv_buf.data + recv_buf.stack_size),
to_read_bytes, 0);
if (read_size == 0) {
- ERR("failed to read data\n");
+ LOG_SEVERE("failed to read data\n");
disconnect_tethering_app();
return;
}
g_strlcpy(serveraddr, ipaddress, sizeof(serveraddr));
}
- INFO("server ip address: %s, port: %d\n", serveraddr, port);
+ LOG_INFO("server ip address: %s, port: %d\n", serveraddr, port);
ret = inet_aton(serveraddr, &addr.sin_addr);
if (ret == 0) {
- ERR("inet_aton failure\n");
+ LOG_SEVERE("inet_aton failure\n");
return -1;
}
sock = qemu_socket(PF_INET, SOCK_STREAM, 0);
if (sock < 0) {
// set_tethering_connection_status(DISCONNECTED);
- ERR("tethering socket creation is failed\n", sock);
+ LOG_SEVERE("tethering socket creation is failed\n", sock);
return -1;
}
- INFO("tethering socket is created: %d\n", sock);
+ LOG_INFO("tethering socket is created: %d\n", sock);
qemu_set_nonblock(sock);
perror("connect failure");
ret = -socket_error();
} else {
- INFO("tethering socket is connected.\n");
+ LOG_INFO("tethering socket is connected.\n");
ret = 0;
// set_tethering_app_state(true);
break;
}
- TRACE("ret: %d\n", ret);
+ LOG_TRACE("ret: %d\n", ret);
} while (ret == -EINPROGRESS);
if (ret < 0 && ret != -EISCONN) {
if (ret == -ECONNREFUSED) {
- INFO("socket connection is refused\n");
+ LOG_INFO("socket connection is refused\n");
set_tethering_connection_status(CONNREFUSED);
}
- INFO("close socket\n");
+ LOG_TRACE("close socket\n");
end_tethering_socket(sock);
sock = -1;
}
tethering_client->fd = -1;
- INFO("close tethering socket\n");
+ LOG_INFO("close tethering socket\n");
set_tethering_connection_status(DISCONNECTED);
set_tethering_sensor_status(status);
set_tethering_touch_status(status);
#if 0
static void set_tethering_app_state(bool state)
{
- TRACE("set tethering_app state: %d", state);
+ LOG_TRACE("set tethering_app state: %d", state);
app_state = state;
}
send_tethering_connection_status_ecp();
}
-static void tethering_notify_exit(Notifier *notifier, void *data) {
+static void tethering_notify_exit(Notifier *notifier, void *data)
+{
+ LOG_INFO("tethering_notify_exit\n");
disconnect_tethering_app();
}
static Notifier tethering_exit = { .notify = tethering_notify_exit };
{
int sock = 0;
- INFO("disconnect app from ecp\n");
+ LOG_TRACE("disconnect app from ecp\n");
if (!tethering_client) {
+ LOG_SEVERE("tethering client instance is NULL\n");
return -1;
}
sock = tethering_client->fd;
if (sock < 0) {
- ERR("tethering socket is terminated or not ready\n");
+ LOG_SEVERE("tethering socket is terminated or not ready\n");
+ return -1;
} else {
- // destroy_tethering_io_handler(sock);
-#if 0
- if (get_tethering_app_state()) {
- send_emul_state_msg();
- }
-#endif
send_emul_state_msg();
-
end_tethering_socket(sock);
- // release_tethering_thread(tethering_client);
}
return 0;
timeout.tv_usec = 0;
ret = select(sockfd + 1, &readfds, NULL, NULL, &timeout);
- TRACE("select timeout! result: %d\n", ret);
+ LOG_TRACE("select timeout! result: %d\n", ret);
if (ret > 0) {
- TRACE("ready for read operation!!\n");
+ LOG_TRACE("ready for read operation!!\n");
tethering_io_handler(socket);
}
static void *initialize_tethering_socket(void *opaque)
{
- TetheringState *socket = (TetheringState *)opaque;
- TRACE("callback function for tethering_thread\n");
+ TetheringState *client = (TetheringState *)opaque;
+ LOG_TRACE("callback function for tethering_thread\n");
- if (!socket) {
- ERR("TetheringState is NULL\n");
+ if (!client) {
+ LOG_SEVERE("TetheringState is NULL\n");
return NULL;
}
- socket->fd = start_tethering_socket(socket->ipaddress, socket->port);
- if (socket->fd < 0) {
- ERR("failed to start tethering_socket\n");
+ client->fd = start_tethering_socket(client->ipaddress, client->port);
+ if (client->fd < 0) {
+ LOG_SEVERE("failed to start tethering_socket\n");
// tethering_sock = -1;
return NULL;
}
-
- INFO("tethering_sock: %d\n", socket->fd);
+ LOG_TRACE("tethering_sock: %d\n", client->fd);
reset_tethering_recv_buf(&recv_buf);
send_handshake_req_msg();
emulator_add_exit_notifier(&tethering_exit);
while (1) {
- qemu_mutex_lock(&socket->mutex);
- if (socket->status == DISCONNECTED) {
- qemu_mutex_unlock(&socket->mutex);
- INFO("disconnected socket. destroy this thread\n");
+ qemu_mutex_lock(&client->mutex);
+ if (client->status == DISCONNECTED) {
+ qemu_mutex_unlock(&client->mutex);
+ LOG_INFO("disconnected socket. destroy this thread\n");
break;
}
- qemu_mutex_unlock(&socket->mutex);
+ qemu_mutex_unlock(&client->mutex);
- tethering_loop(socket->fd);
+ tethering_loop(client->fd);
}
- return socket;
+ return client;
}
#if 0
#include "emul_state.h"
#include "skin/maruskin_operation.h"
#include "encode_fb.h"
-#include "debug_ch.h"
+#include "util/new_debug_ch.h"
-MULTI_DEBUG_CHANNEL(tizen, app_tethering);
+DECLARE_DEBUG_CHANNEL(app_tethering);
#ifdef CONFIG_WEBP
static void *encode_webp(void);
#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
clock_gettime(CLOCK_MONOTONIC, &end);
- INFO("encoding time: %.5f seconds\n",
+ LOG_TRACE("encoding time: %.5f seconds\n",
((double)end.tv_sec + (1.0e-9 * end.tv_nsec)) -
((double)start.tv_sec + (1.0e-9 * start.tv_nsec)));
#endif
}
if (!p->buffer) {
- ERR("failed to allocate \n");
+ LOG_SEVERE("failed to allocate \n");
}
memcpy(p->buffer + p->length, data, len);
surface = request_screenshot();
if (!surface) {
- ERR("failed to get framebuffer\n");
+ LOG_SEVERE("failed to get framebuffer\n");
return NULL;
}
height = get_emul_resolution_height();
image_stride = width * 4;
- TRACE("width %d, height %d, stride %d, raw image %d\n",
+ LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
width, height, image_stride, (image_stride * height));
- TRACE("png_create_write_struct\n");
+ LOG_TRACE("png_create_write_struct\n");
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr) {
- ERR("png_create_write_struct failure\n");
+ LOG_SEVERE("png_create_write_struct failure\n");
g_free(surface->data);
g_free(surface);
return NULL;
}
- TRACE("png_create_info_struct\n");
+ LOG_TRACE("png_create_info_struct\n");
info_ptr = png_create_info_struct(png_ptr);
if (!png_ptr) {
- ERR("png_create_info_struct failure\n");
+ LOG_SEVERE("png_create_info_struct failure\n");
g_free(surface->data);
g_free(surface);
png_destroy_write_struct(&png_ptr, &info_ptr);
return NULL;
}
- TRACE("try png_jmpbuf\n");
+ LOG_TRACE("try png_jmpbuf\n");
if (setjmp(png_jmpbuf(png_ptr))) {
- ERR("png_jmpbuf failure\n");
+ LOG_SEVERE("png_jmpbuf failure\n");
g_free(surface->data);
g_free(surface);
png_destroy_write_struct(&png_ptr, &info_ptr);
return NULL;
}
- TRACE("png_init_io\n");
+ LOG_TRACE("png_init_io\n");
container = g_malloc(sizeof(struct encode_mem));
if (!container) {
- ERR("failed to allocate encode_mem\n");
+ LOG_SEVERE("failed to allocate encode_mem\n");
g_free(surface->data);
g_free(surface);
png_destroy_write_struct(&png_ptr, &info_ptr);
row_pointers = png_malloc(png_ptr, sizeof(png_bytep) * height);
if (row_pointers == NULL) {
- ERR("failed to allocate png memory\n");
+ LOG_SEVERE("failed to allocate png memory\n");
g_free(surface->data);
g_free(surface);
png_destroy_write_struct(&png_ptr, &info_ptr);
row_pointers[row_index] = surface->data + (row_index * image_stride);
}
- TRACE("png_write_image\n");
+ LOG_TRACE("png_write_image\n");
png_write_image(png_ptr, row_pointers);
- TRACE("png_write_end\n");
+ LOG_TRACE("png_write_end\n");
png_write_end(png_ptr, info_ptr);
g_free(surface->data);
g_free(surface);
- TRACE("png image size %d\n", container->length);
+ LOG_TRACE("png image size %d\n", container->length);
png_destroy_write_struct(&png_ptr, &info_ptr);
png_destroy_info_struct(png_ptr, &info_ptr);
container = g_malloc(sizeof(struct encode_mem));
if (!container) {
- ERR("failed to allocate encode_mem\n");
+ LOG_SEVERE("failed to allocate encode_mem\n");
return NULL;
}
surface = request_screenshot();
if (!surface) {
- ERR("failed to get framebuffer\n");
+ LOG_SEVERE("failed to get framebuffer\n");
g_free(container);
return NULL;
}
height = get_emul_resolution_height();
image_stride = width * 4;
- TRACE("width %d, height %d, stride %d, raw image %d\n",
+ LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
width, height, image_stride, (image_stride * height));
ret = WebPEncodeLosslessBGRA((const uint8_t *)surface->data, width,
height, image_stride, &container->buffer);
- TRACE("lossless encode framebuffer via webp. result %zu\n", ret);
+ LOG_TRACE("lossless encode framebuffer via webp. result %zu\n", ret);
container->length = (int)ret;
#include "ecs/ecs_tethering.h"
#include "genmsg/tethering.pb-c.h"
-#include "debug_ch.h"
+#include "util/new_debug_ch.h"
-MULTI_DEBUG_CHANNEL(tizen, app_tethering);
+DECLARE_DEBUG_CHANNEL(app_tethering);
typedef struct sensor_state {
bool is_sensor_event;
bool ret = false;
Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
msg.type = TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG;
msg.sensormsg = sensor;
ret = send_msg_to_controller(&msg);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
Tethering__SensorMsg event = TETHERING__SENSOR_MSG__INIT;
Tethering__StartAns start_ans = TETHERING__START_ANS__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
start_ans.result = result;
event.type = TETHERING__SENSOR_MSG__TYPE__START_ANS;
event.startans = &start_ans;
- TRACE("send sensor_start_ans message\n");
+ LOG_TRACE("send sensor_start_ans message\n");
ret = build_sensor_msg(&event);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
Tethering__SetSensorStatus sensor_status =
TETHERING__SET_SENSOR_STATUS__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
sensor_status.type = sensor_type;
sensor_status.state = status;
sensor.type = TETHERING__SENSOR_MSG__TYPE__SENSOR_STATUS;
sensor.setstatus = &sensor_status;
- TRACE("send sensor_set_event_status message\n");
+ LOG_TRACE("send sensor_set_event_status message\n");
ret = build_sensor_msg(&sensor);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
level_accel, 3, data->x, data->y, data->z);
send_tethering_sensor_data(tmp, strlen(tmp));
- TRACE("sensor_accel x: %s, y: %s, z: %s\n",
+ LOG_TRACE("sensor_accel x: %s, y: %s, z: %s\n",
data->x, data->y, data->z);
}
break;
level_magnetic, 3, data->x, data->y, data->z);
send_tethering_sensor_data(tmp, strlen(tmp));
- TRACE("sensor_mag x: %s, y: %s, z: %s\n",
+ LOG_TRACE("sensor_mag x: %s, y: %s, z: %s\n",
data->x, data->y, data->z);
}
break;
level_gyro, 3, data->x, data->y, data->z);
send_tethering_sensor_data(tmp, strlen(tmp));
- TRACE("sensor_gyro x: %s, y: %s, z: %s\n",
+ LOG_TRACE("sensor_gyro x: %s, y: %s, z: %s\n",
data->x, data->y, data->z);
}
break;
sprintf(tmp, "%d\n%d\n%.1f\n", level_proxi, 1, x);
send_tethering_sensor_data(tmp, strlen(tmp));
- TRACE("sensor_proxi x: %.1f, %s\n", x, tmp);
+ LOG_TRACE("sensor_proxi x: %.1f, %s\n", x, tmp);
}
break;
case TETHERING__SENSOR_TYPE__LIGHT:
sprintf(tmp, "%d\n%d\n%s%s\n", level_light, 2, data->x, data->y);
send_tethering_sensor_data(tmp, strlen(tmp));
- TRACE("sensor_light x: %s\n", data->x);
+ LOG_TRACE("sensor_light x: %s\n", data->x);
}
break;
default:
- TRACE("invalid sensor data\n");
+ LOG_TRACE("invalid sensor data\n");
break;
}
}
switch(msg->type) {
case TETHERING__SENSOR_MSG__TYPE__START_REQ:
- TRACE("SENSOR_MSG_TYPE_START_REQ\n");
+ LOG_TRACE("SENSOR_MSG_TYPE_START_REQ\n");
// TODO
// init_sensor_state();
send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__LIGHT,
TETHERING__STATE__ENABLED);
- TRACE("SENSOR_MSG_TYPE_START_ANS\n");
+ LOG_TRACE("SENSOR_MSG_TYPE_START_ANS\n");
send_sensor_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS);
break;
case TETHERING__SENSOR_MSG__TYPE__TERMINATE:
- TRACE("SENSOR_MSG_TYPE_TERMINATE\n");
+ LOG_TRACE("SENSOR_MSG_TYPE_TERMINATE\n");
break;
case TETHERING__SENSOR_MSG__TYPE__SENSOR_DATA:
- TRACE("SENSOR_MSG_TYPE_SENSOR_DATA\n");
+ LOG_TRACE("SENSOR_MSG_TYPE_SENSOR_DATA\n");
set_sensor_data(msg->data);
break;
default:
- TRACE("invalid sensor_msg type");
+ LOG_TRACE("invalid sensor_msg type");
ret = false;
break;
}
#include "touch.h"
#include "genmsg/tethering.pb-c.h"
#include "ecs/ecs_tethering.h"
-#include "debug_ch.h"
+#include "util/new_debug_ch.h"
-MULTI_DEBUG_CHANNEL(tizen, app_tethering);
+DECLARE_DEBUG_CHANNEL(app_tethering);
typedef struct touch_state {
bool is_touch_event;
bool is_touch_supported;
// int touch_max_point;
-
// display_state *display;
} touch_event;
bool ret = false;
Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
msg.type = TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG;
msg.touchmsg = touch;
- TRACE("touch message size: %d\n", tethering__tethering_msg__get_packed_size(&msg));
+ LOG_TRACE("touch message size: %d\n", tethering__tethering_msg__get_packed_size(&msg));
ret = send_msg_to_controller(&msg);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT;
Tethering__StartAns start_ans = TETHERING__START_ANS__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
start_ans.result = result;
ret = build_touch_msg(&mt);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
Tethering__TouchMaxCount touch_cnt =
TETHERING__TOUCH_MAX_COUNT__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
touch_cnt.max = get_emul_max_touch_point();
mt.type = TETHERING__TOUCH_MSG__TYPE__MAX_COUNT;
mt.maxcount = &touch_cnt;
- TRACE("send touch max count: %d\n", touch_cnt.max);
+ LOG_TRACE("send touch max count: %d\n", touch_cnt.max);
ret = build_touch_msg(&mt);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
switch(data->state) {
case TETHERING__TOUCH_STATE__PRESSED:
- TRACE("touch pressed\n");
+ LOG_TRACE("touch pressed\n");
index = data->index;
x = data->xpoint;
y = data->ypoint;
state = PRESSED;
break;
case TETHERING__TOUCH_STATE__RELEASED:
- TRACE("touch released\n");
+ LOG_TRACE("touch released\n");
index = data->index;
x = data->xpoint;
y = data->ypoint;
state = RELEASED;
break;
default:
- TRACE("invalid touch data\n");
+ LOG_TRACE("invalid touch data\n");
break;
}
- TRACE("set touch_data. index: %d, x: %lf, y: %lf\n", index, x, y);
+ LOG_TRACE("set touch_data. index: %d, x: %lf, y: %lf\n", index, x, y);
send_tethering_touch_data(x, y, index, state);
}
Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT;
Tethering__Resolution resolution = TETHERING__RESOLUTION__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
resolution.width = get_emul_resolution_width();
resolution.height = get_emul_resolution_height();
mt.type = TETHERING__TOUCH_MSG__TYPE__RESOLUTION;
mt.resolution = &resolution;
- TRACE("send touch resolution: %dx%d\n",
+ LOG_TRACE("send touch resolution: %dx%d\n",
resolution.width, resolution.height);
ret = build_touch_msg(&mt);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}
{
is_touch_event = status;
- INFO("set touch_event status: %d\n", status);
+ LOG_TRACE("set touch_event status: %d\n", status);
}
static void set_hwkey_data(Tethering__HWKeyMsg *msg)
break;
default:
- INFO("undefined type: %d\n", msg->type);
+ LOG_WARNING("undefined type: %d\n", msg->type);
}
- INFO("convert hwkey msg to keycode: %d\n", keycode);
+ LOG_TRACE("convert hwkey msg to keycode: %d\n", keycode);
send_tethering_hwkey_data(keycode);
}
#endif
switch(msg->type) {
case TETHERING__TOUCH_MSG__TYPE__START_REQ:
- TRACE("TOUCH_MSG_TYPE_START\n");
+ LOG_TRACE("TOUCH_MSG_TYPE_START\n");
// state = init_touch_state();
// it means that app starts to send touch values.
ret = send_touch_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS);
break;
case TETHERING__TOUCH_MSG__TYPE__TERMINATE:
- TRACE("TOUCH_MSG_TYPE_TERMINATE\n");
+ LOG_TRACE("TOUCH_MSG_TYPE_TERMINATE\n");
// it means that app stops to send touch values.
// set_touch_event_status(false);
break;
#endif
default:
- TRACE("invalid touch_msg\n");
+ LOG_TRACE("invalid touch_msg\n");
ret = false;
break;
}
Tethering__TouchMsg touch = TETHERING__TOUCH_MSG__INIT;
Tethering__DisplayMsg display = TETHERING__DISPLAY_MSG__INIT;
- TRACE("enter: %s\n", __func__);
+ LOG_TRACE("enter: %s\n", __func__);
image = (struct encode_mem *)encode_framebuffer(ENCODE_WEBP);
if (!image) {
- ERR("failed to encode framebuffer\n");
+ LOG_SEVERE("failed to encode framebuffer\n");
return false;
}
- TRACE("image data size %d\n", image->length);
+ LOG_TRACE("image data size %d\n", image->length);
display.has_imagedata = true;
display.imagedata.len = image->length;
display.imagedata.data = image->buffer;
// ret = build_display_msg(&display);
ret = build_touch_msg(&touch);
- INFO("send display message: %d\n", ret);
+ LOG_TRACE("send display message: %d\n", ret);
g_free(image->buffer);
g_free(image);
- TRACE("leave: %s, ret: %d\n", __func__, ret);
+ LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
return ret;
}