00001 /* 00002 * UniMotion - Unified Motion detection for Apple portables. 00003 * 00004 * Copyright (c) 2006 Lincoln Ramsay. All rights reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License version 2.1 as published by the Free Software Foundation. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation Inc. 59 Temple Place, Suite 330, Boston MA 02111-1307 USA 00018 */ 00019 #ifndef UNIMOTION_H 00020 #define UNIMOTION_H 00021 00022 #ifdef __cplusplus 00023 extern "C" { 00024 #endif 00025 00026 // The various SMS hardware that unimotion supports 00027 enum sms_hardware { 00028 unknown = 0, 00029 powerbook = 1, 00030 ibook = 2, 00031 highrespb = 3, 00032 macbookpro = 4 00033 }; 00034 00035 // prototypes for the functions in unimotion.c 00036 00037 // returns the value of SMS hardware present or unknown if no hardware is detected 00038 int detect_sms(); 00039 00040 // use the value returned from detect_sms as the type 00041 // these functinos return 1 on success and 0 on failure 00042 // they modify x, y and z if they are not 0 00043 00044 // raw, unmodified values 00045 int read_sms_raw(int type, int *x, int *y, int *z); 00046 // "calibrated" values (same as raw if no calibration data exists) 00047 int read_sms(int type, int *x, int *y, int *z); 00048 // real (1.0 = 1G) values (requires calibration data) 00049 // note that this is the preferred API as it need not change with new machines 00050 // however, this API does not work if no "scale" calibration data exists 00051 int read_sms_real(int type, double *x, double *y, double *z); 00052 00053 #ifdef __cplusplus 00054 } 00055 #endif 00056 00057 #endif 00058
1.5.6