Home | History | Annotate | Download | only in avd
      1 /* Copyright (C) 2008 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 #ifndef _ANDROID_AVD_HW_CONFIG_H
     13 #define _ANDROID_AVD_HW_CONFIG_H
     14 
     15 #include <stdint.h>
     16 #include "android/utils/ini.h"
     17 
     18 typedef char      hw_bool_t;
     19 typedef int       hw_int_t;
     20 typedef int64_t   hw_disksize_t;
     21 typedef char*     hw_string_t;
     22 typedef double    hw_double_t;
     23 
     24 /* these macros are used to define the fields of AndroidHwConfig
     25  * declared below
     26  */
     27 #define   HWCFG_BOOL(n,s,d,a,t)       hw_bool_t      n;
     28 #define   HWCFG_INT(n,s,d,a,t)        hw_int_t       n;
     29 #define   HWCFG_STRING(n,s,d,a,t)     hw_string_t    n;
     30 #define   HWCFG_DOUBLE(n,s,d,a,t)     hw_double_t    n;
     31 #define   HWCFG_DISKSIZE(n,s,d,a,t)   hw_disksize_t  n;
     32 
     33 typedef struct {
     34 #include "android/avd/hw-config-defs.h"
     35 } AndroidHwConfig;
     36 
     37 /* Set all default values, based on the target API level */
     38 void androidHwConfig_init( AndroidHwConfig*  hwConfig,
     39                            int               apiLevel );
     40 
     41 /* reads a hardware configuration file from disk.
     42  * returns -1 if the file could not be read, or 0 in case of success.
     43  *
     44  * note that default values are written to hwConfig if the configuration
     45  * file doesn't have the corresponding hardware properties.
     46  */
     47 int  androidHwConfig_read( AndroidHwConfig*  hwConfig,
     48                            IniFile*          configFile );
     49 
     50 /* Write a hardware configuration to a config file object.
     51  * Returns 0 in case of success. Note that any value that is set to the
     52  * default will not bet written.
     53  */
     54 int  androidHwConfig_write( AndroidHwConfig*  hwConfig,
     55                             IniFile*          configFile );
     56 
     57 /* Finalize a given hardware configuration */
     58 void androidHwConfig_done( AndroidHwConfig* config );
     59 
     60 /* Checks if screen doesn't support touch, or multi-touch */
     61 int  androidHwConfig_isScreenNoTouch( AndroidHwConfig* config );
     62 /* Checks if screen supports touch (but not multi-touch). */
     63 int  androidHwConfig_isScreenTouch( AndroidHwConfig* config );
     64 /* Checks if screen supports multi-touch. */
     65 int  androidHwConfig_isScreenMultiTouch( AndroidHwConfig* config );
     66 
     67 #endif /* _ANDROID_AVD_HW_CONFIG_H */
     68