Home | History | Annotate | Download | only in protocol
      1 /* Copyright (C) 2010 The Android Open Source Project
      2 **
      3 ** This software is licensed under the terms of the GNU General Public
      4 ** License version 2, as published by the Free Software Foundation, and
      5 ** may be copied, distributed, and modified under those terms.
      6 **
      7 ** This program is distributed in the hope that it will be useful,
      8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 ** GNU General Public License for more details.
     11 */
     12 
     13 #ifndef _ANDROID_PROTOCOL_CORE_COMMANDS_API_H
     14 #define _ANDROID_PROTOCOL_CORE_COMMANDS_API_H
     15 
     16 /*
     17  * Contains the API for calling into the Core with UI control commands.
     18  */
     19 
     20 #include "android/android.h"
     21 #include "android/hw-sensors.h"
     22 
     23 /* Instructs the Core to change the coarse orientation.
     24  * Return:
     25  *  0 on success, or < 0 on failure.
     26  */
     27 extern int corecmd_set_coarse_orientation(AndroidCoarseOrientation orient);
     28 
     29 /* Toggles the network in the Core.
     30  * Return:
     31  *  0 on success, or < 0 on failure.
     32  */
     33 extern int corecmd_toggle_network();
     34 
     35 /* Starts or stops tracing in the Core.
     36  * Param:
     37  *  start - Starts (> 0), or stops (== 0) tracing.
     38  * Return:
     39  *  0 on success, or < 0 on failure.
     40  */
     41 extern int corecmd_trace_control(int start);
     42 
     43 /* Checks if network is disabled in the Core.
     44  * Return:
     45  *  0 if network is enabled, 1 if it is disabled, or < 0 on failure.
     46  */
     47 extern int corecmd_is_network_disabled();
     48 
     49 /* Requests a NetworkSpeed instance from the Core.
     50  * Param:
     51  *  index - Index of an entry in the NetworkSpeed array.
     52  *  netspeed - Upon success contains allocated and initialized NetworkSpeed
     53  *      instance for the given index. Note that strings addressed by "name" and
     54  *      "display" fileds in the returned NetworkSpeed instance are containd
     55  *      inside the buffer allocated for the returned NetworkSpeed instance.
     56  *      Caller of this routine must eventually free the buffer returned in this
     57  *      parameter.
     58  * Return:
     59  *  0 on success, or < 0 on failure.
     60  */
     61 extern int corecmd_get_netspeed(int index, NetworkSpeed** netspeed);
     62 
     63 /* Requests a NetworkLatency instance from the Core.
     64  * Param:
     65  *  index - Index of an entry in the NetworkLatency array.
     66  *  netdelay - Upon success contains allocated and initialized NetworkLatency
     67  *      instance for the given index. Note that strings addressed by "name" and
     68  *      "display" fileds in the returned NetworkLatency instance are containd
     69  *      inside the buffer allocated for the returned NetworkLatency instance.
     70  *      Caller of this routine must eventually free the buffer returned in this
     71  *      parameter.
     72  * Return:
     73  *  0 on success, or < 0 on failure.
     74  */
     75 extern int corecmd_get_netdelay(int index, NetworkLatency** netdelay);
     76 
     77 /* Requests a QEMU file path from the Core.
     78  * Param:
     79  *  type, filename - Request parameters that define the file for which path is
     80  *  requested.
     81  * Return:
     82  *  0 on success, or < 0 on failure.
     83  */
     84 extern int corecmd_get_qemu_path(int type,
     85                                  const char* filename,
     86                                  char* path,
     87                                  size_t path_buf_size);
     88 
     89 /* Gets LCD density property from the core properties.
     90  * Return:
     91  *  LCD density on success, or < 0 on failure.
     92  */
     93 extern int corecmd_get_hw_lcd_density(void);
     94 
     95 #endif /* _ANDROID_PROTOCOL_CORE_COMMANDS_API_H */
     96