CONTROL_COMMAND_SCREENSHOT_REQ = 2
};
+/* request */
+void req_set_sensor_accel(int x, int y, int z);
+
// control sub messages
void msgproc_control_hostkeyboard_req(ECS_Client *cli, ECS__HostKeyboardReq* req);
return value;
}
-static void req_set_sensor_accel(int len, const char* data)
+void req_set_sensor_accel(int x, int y, int z)
+{
+ char tmp[TEMP_BUF_SIZE] = { 0, };
+
+ sprintf(tmp, "%d, %d, %d", x, y, z);
+
+ set_sensor_accel(tmp, strlen(tmp));
+}
+
+static void _req_set_sensor_accel(int len, const char* data)
{
char tmp[TEMP_BUF_SIZE];
int x, y, z;
set_sensor_accel(tmp, strlen(tmp));
}
-static void req_set_sensor_proxi(int len, const char* data)
+static void _req_set_sensor_proxi(int len, const char* data)
{
char tmp[TEMP_BUF_SIZE];
set_sensor_proxi(tmp, strlen(tmp));
}
-static void req_set_sensor_light(int len, const char* data)
+static void _req_set_sensor_light(int len, const char* data)
{
char tmp[TEMP_BUF_SIZE];
int x;
}
}
-static void req_set_sensor_gyro(int len, const char* data)
+static void _req_set_sensor_gyro(int len, const char* data)
{
char tmp[TEMP_BUF_SIZE];
int x, y, z;
set_sensor_gyro(tmp, strlen(tmp));
}
-static void req_set_sensor_geo(int len, const char* data)
+static void _req_set_sensor_geo(int len, const char* data)
{
char tmp[TEMP_BUF_SIZE];
int x, y, z, accuracy, t_north, t_east, t_vertical;
set_sensor_mag(tmp, strlen(tmp));
}
-static void req_set_sensor_tilt(int len, const char* data)
+static void _req_set_sensor_tilt(int len, const char* data)
{
char tmp[TEMP_BUF_SIZE];
int x, y, z, accuracy = 3;
set_sensor_tilt(tmp, strlen(tmp));
}
-static void req_set_sensor_mag(int len, const char* data)
+static void _req_set_sensor_mag(int len, const char* data)
{
char tmp[TEMP_BUF_SIZE];
int x, y, z;
switch(atoi(tmpbuf)) {
case level_accel:
- req_set_sensor_accel(len, data);
+ _req_set_sensor_accel(len, data);
break;
case level_proxi:
- req_set_sensor_proxi(len, data);
+ _req_set_sensor_proxi(len, data);
break;
case level_light:
- req_set_sensor_light(len, data);
+ _req_set_sensor_light(len, data);
break;
case level_gyro:
- req_set_sensor_gyro(len, data);
+ _req_set_sensor_gyro(len, data);
break;
case level_geo:
- req_set_sensor_geo(len, data);
+ _req_set_sensor_geo(len, data);
break;
case level_tilt:
- req_set_sensor_tilt(len, data);
+ _req_set_sensor_tilt(len, data);
break;
case level_magnetic:
- req_set_sensor_mag(len, data);
+ _req_set_sensor_mag(len, data);
break;
default:
break;
#include "emul_state.h"
#include "maruskin_keymap.h"
#include "maruskin_server.h"
-#include "emul_state.h"
#include "hw/maru_pm.h"
-#include "emul_state.h"
+#include "ecs/ecs.h"
#ifdef CONFIG_HAX
#include "guest_debug.h"
void do_scale_event(double scale_factor)
{
- INFO("do_scale_event scale_factor:%lf\n", scale_factor);
+ INFO("do_scale_event scale_factor : %lf\n", scale_factor);
set_emul_win_scale(scale_factor);
void do_rotation_event(int rotation_type)
{
+ INFO("do_rotation_event rotation_type : %d\n", rotation_type);
- INFO( "do_rotation_event rotation_type:%d\n", rotation_type);
+ int x = 0, y = 0, z = 0;
- set_emul_rotation( rotation_type );
-}
-
-void send_rotation_event(int rotation_type)
-{
-
- INFO( "send_rotation_event rotation_type:%d\n", rotation_type);
-
- char send_buf[32] = { 0 };
-
- switch ( rotation_type ) {
+ switch (rotation_type) {
case ROTATION_PORTRAIT:
- sprintf( send_buf, "1\n3\n0\n9.80665\n0\n" );
+ x = 0;
+ y = 9.80665;
+ z = 0;
break;
case ROTATION_LANDSCAPE:
- sprintf( send_buf, "1\n3\n9.80665\n0\n0\n" );
+ x = 9.80665;
+ y = 0;
+ z = 0;
break;
case ROTATION_REVERSE_PORTRAIT:
- sprintf( send_buf, "1\n3\n0\n-9.80665\n0\n" );
+ x = 0;
+ y = -9.80665;
+ z = 0;
break;
case ROTATION_REVERSE_LANDSCAPE:
- sprintf(send_buf, "1\n3\n-9.80665\n0\n0\n");
+ x = -9.80665;
+ y = 0;
+ z = 0;
break;
-
default:
break;
}
- send_to_emuld( "sensor\n\n\n\n", 10, send_buf, 32 );
+ req_set_sensor_accel(x, y, z);
}
void set_maru_screenshot(DisplaySurface *surface)
void do_hardkey_event(int event_type, int keycode);
void do_scale_event(double scale_factor);
void do_rotation_event(int rotation_type);
-void send_rotation_event(int rotation_type);
QemuSurfaceInfo *get_screenshot_info(void);
DetailInfo *get_detail_info(int qemu_argc, char **qemu_argv);
break;
}
case RECV_CHANGE_LCD_STATE: {
- log_cnt += sprintf( log_buf + log_cnt, "RECV_CHANGE_LCD_STATE ==\n" );
- TRACE( log_buf );
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_CHANGE_LCD_STATE ==\n");
+ TRACE(log_buf);
- if ( 0 >= length ) {
- ERR( "there is no data looking at 0 length." );
+ if (0 >= length) {
+ ERR("there is no data looking at 0 length.");
continue;
}
int scale = 0;
double scale_ratio = 0.0;
short rotation_type = 0;
- int is_rotate = 0;
char* p = recvbuf;
- memcpy( &scale, p, sizeof( scale ) );
- p += sizeof( scale );
- memcpy( &rotation_type, p, sizeof( rotation_type ) );
+ memcpy(&scale, p, sizeof(scale));
+ p += sizeof(scale);
+ memcpy(&rotation_type, p, sizeof(rotation_type));
- scale = ntohl( scale );
- scale_ratio = ( (double) scale ) / 100;
- rotation_type = ntohs( rotation_type );
+ scale = ntohl(scale);
+ scale_ratio = ((double) scale) / 100;
+ rotation_type = ntohs(rotation_type);
- if ( get_emul_win_scale() != scale_ratio ) {
- do_scale_event( scale_ratio );
+ /* scaling */
+ if (get_emul_win_scale() != scale_ratio) {
+ do_scale_event(scale_ratio);
}
- if ( is_sensord_initialized == 1 && get_emul_rotation() != rotation_type ) {
- do_rotation_event( rotation_type );
- is_rotate = 1;
+ /* rotation */
+ bool is_rotate = false;
+ if (is_sensord_initialized == 1 && get_emul_rotation() != rotation_type) {
+ set_emul_rotation(rotation_type);
+ is_rotate = true;
}
#ifndef CONFIG_USE_SHM
- maruskin_sdl_resize(); /* send sdl event */
+ maruskin_sdl_resize();
#else
maruskin_shm_resize();
#endif
- if (is_rotate) {
- send_rotation_event( rotation_type );
+
+ /* after display resizing */
+ if (is_rotate == true) {
+ do_rotation_event(rotation_type);
}
break;