void touch_emu_cmd(TP_POINT points[], int point_num) { int i; int down_flag; //ALOGD("[touch_emu_cmd]:num=%d", point_num); for (i=0; i<point_num; i++) { //ALOGD("[touch_emu_cmd]act=%d,x=%d,y=%d", points[i].action, points[i].x, points[i].y); if (points[i].action == TP_EMU_DEPRESS) //Down { ALOGD("[DOWN %d]:(%d, %d)", i, points[i].x, points[i].y); touch_down(3, points[i].x, points[i].y); down_flag = 1; } else if(points[i].action == TP_EMU_RELEASE) //Up { ALOGD("[UP %d]:(%d, %d)", i, points[i].x, points[i].y); if (down_flag) touch_down(3, points[i].x, points[i].y); touch_up(); break; } else if(points[i].action == TP_EMU_SINGLETAP) //Single tap { ALOGD("[SingleTap %d]:(%d, %d)", i, points[i].x, points[i].y); touch_down(3, points[i].x, points[i].y); touch_up(); break; } else if(points[i].action == TP_EMU_DOUBLETAP) //Double tap { ALOGD("[DoubleTap %d]:(%d, %d)", i, points[i].x, points[i].y); touch_down(3, points[i].x, points[i].y); touch_up(); touch_down(3, points[i].x, points[i].y); touch_up(); break; } } }
static void parse_input(char* buffer, internal_state_t* state) { char* cursor; long int contact, x, y, pressure, wait; cursor = (char*) buffer; cursor += 1; switch (buffer[0]) { case 'c': // COMMIT commit(state); break; case 'r': // RESET touch_panic_reset_all(state); break; case 'd': // TOUCH DOWN contact = strtol(cursor, &cursor, 10); x = strtol(cursor, &cursor, 10); y = strtol(cursor, &cursor, 10); pressure = strtol(cursor, &cursor, 10); touch_down(state, contact, x, y, pressure); break; case 'm': // TOUCH MOVE contact = strtol(cursor, &cursor, 10); x = strtol(cursor, &cursor, 10); y = strtol(cursor, &cursor, 10); pressure = strtol(cursor, &cursor, 10); touch_move(state, contact, x, y, pressure); break; case 'u': // TOUCH UP contact = strtol(cursor, &cursor, 10); touch_up(state, contact); break; case 'w': wait = strtol(cursor, &cursor, 10); if (g_verbose) fprintf(stderr, "Waiting %ld ms\n", wait); usleep(wait * 1000); break; default: break; } }