Home | History | Annotate | Download | only in event_injector
      1 /*
      2 * Copyright (C) 2011 The Android Open Source Project
      3 *
      4 * Licensed under the Apache License, Version 2.0 (the "License");
      5 * you may not use this file except in compliance with the License.
      6 * You may obtain a copy of the License at
      7 *
      8 * http://www.apache.org/licenses/LICENSE-2.0
      9 *
     10 * Unless required by applicable law or agreed to in writing, software
     11 * distributed under the License is distributed on an "AS IS" BASIS,
     12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 * See the License for the specific language governing permissions and
     14 * limitations under the License.
     15 */
     16 #ifndef ANDROID_EMULATOR_CONSOLE_H
     17 #define ANDROID_EMULATOR_CONSOLE_H
     18 
     19 #include "iolooper.h"
     20 #include "sockets.h"
     21 
     22 #ifdef __cplusplus
     23 extern "C" {
     24 #endif
     25 
     26 typedef struct EmulatorConsole  EmulatorConsole;
     27 
     28 /* Create a new EmulatorConsole object to connect asynchronously to
     29  * a given emulator port. Note that this always succeeds since the
     30  * connection is asynchronous.
     31  */
     32 EmulatorConsole* emulatorConsole_new(int port, IoLooper* looper);
     33 
     34 /* Call this after an iolooper_poll() or iolooper_wait() to check
     35  * the status of the console's socket and act upon it.
     36  *
     37  * Returns 0 on success, or -1 on error (which indicates disconnection!)
     38  */
     39 int  emulatorConsole_poll( EmulatorConsole*  console );
     40 
     41 /* Send a message to the console asynchronously. Any answer will be
     42  * ignored. */
     43 void emulatorConsole_send( EmulatorConsole*  console, const char* command );
     44 
     45 void emulatorConsole_sendMouseDown( EmulatorConsole* con, int x, int y );
     46 void emulatorConsole_sendMouseMotion( EmulatorConsole* con, int x, int y );
     47 void emulatorConsole_sendMouseUp( EmulatorConsole* con, int x, int y );
     48 
     49 void emulatorConsole_sendKey( EmulatorConsole* con, int keycode, int down );
     50 
     51 #ifdef __cplusplus
     52 }
     53 #endif
     54 
     55 #endif /* ANDROID_EMULATOR_CONSOLE_H */
     56