Accelerometer Function : Корзина : Форум |
blacklizard: |
28.10.10, 18:04 |
Acc_Type.h Код: typedef unsigned int FUint8; typedef unsigned long FUint32; typedef long FSint32; typedef enum { ACC_SAMPLERATE_100HZ=0, ACC_SAMPLERATE_400HZ } Acc_InternalSamplingRate_t; typedef enum { ACC_SCALE_2G=0, ACC_SCALE_8G } Acc_ScaleSelection_t; typedef enum { ACC_AXES_DISABLE=0, ACC_AXES_ENABLE=1, ACC_AXES_DONTCARE=2 } Acc_Axes_OP_t; Acc_class.h Код: #include "Acc_Type.h" UUID CID_CAccelerometerManager={0xF7,0xA4,0x58,0x00,0xD8,0x96,0x47,0xDE,0x9C,0x04,0x6A,0x30,0xD5,0x75,0x50,0x43}; UUID IID_IAccelerometerManager={0xB7,0x6C,0x85,0x42,0x43,0x72,0x43,0x24,0x98,0x86,0xFB,0xD6,0xF5,0x26,0x1F,0x10}; class IAccelerometerControl; class IAccelerometerData; class IUnknown { public: virtual void* pguid(); virtual void* QueryInterface(UUID* pIID, void** ppInterface); virtual void* AddRef(); virtual void* Release(); }; class IAccelerometerManager: public IUnknown { public: virtual int CreateAccelerometerControl(void** ppIAccelerometerControl); virtual int CreateAccelerometerData(void** ppIAccelerometerData); }; class IAccelerometerControl: public IUnknown { public: virtual int SetInternalSamplingRate(Acc_InternalSamplingRate_t SampleRate); virtual int GetInternalSamplingRate(Acc_InternalSamplingRate_t *pSampleRate); virtual int SetDetectScale(Acc_ScaleSelection_t Scale); virtual int GetDetectScale(Acc_ScaleSelection_t *pScale); virtual int SetAxesUsage(Acc_Axes_OP_t x_axis,Acc_Axes_OP_t y_axis,Acc_Axes_OP_t z_axis); virtual int GetAxesUsage(Acc_Axes_OP_t *px_axis,Acc_Axes_OP_t *py_axis,Acc_Axes_OP_t *pz_axis); virtual int PowerOnChip(void); virtual int PowerOffChip(void); }; class IAccelerometerData: public IUnknown { public: virtual int GetRawAxisValues(FUint8 *pX,FUint8 *pY,FUint8 *pZ); virtual int GetMaxAxisValues(FSint32 *pX,FSint32 *pY,FSint32 *pZ); virtual int GetMinAxisValues(FSint32 *pX,FSint32 *pY,FSint32 *pZ); virtual int ResetMaxMinValues(void); virtual int GetAxisValues(FSint32 *pX,FSint32 *pY,FSint32 *pZ); virtual void* Method6(); virtual void* Method7(); virtual void* Method8(); virtual void* Method9(); }; Usage example : Код: #include "Acc_class.h" int main() { wchar_t *buff = new wchar_t[0x100]; FSint32 pX,pY,pZ; IAccelerometerManager * pIAccelerometerManager=0; IAccelerometerData * pIAccelerometerData=0; IAccelerometerControl * pIAccelerometerControl=0; CoCreateInstance(&CID_CAccelerometerManager, &IID_IAccelerometerManager, PPINTERFACE(&pIAccelerometerManager)); if(pIAccelerometerManager) { pIAccelerometerManager->CreateAccelerometerControl(PPINTERFACE(&pIAccelerometerControl)); if(pIAccelerometerControl) { pIAccelerometerControl->PowerOnChip(); pIAccelerometerManager->CreateAccelerometerData(PPINTERFACE(&pIAccelerometerData)); if(pIAccelerometerData) { pIAccelerometerData->GetAxisValues(&pX,&pY,&pZ); pIAccelerometerData->Release(); } pIAccelerometerControl->PowerOffChip(); pIAccelerometerControl->Release(); } pIAccelerometerManager->Release(); } snwprintf( buff, 128, L"%d\n%d\n%d\n",pX,pY,pZ ); MessageBox(EMPTY_SID,Str2ID(buff,0,0xffff),NOIMAGE,1,0,0); delete buff; elf_exit(); return(0); } |
den_po: |
28.10.10, 18:12 |
и чем это отличается от того, что выложено в исходниках тут? http://supertrubka.org/newbb_plus/viewtopic.php?topic_id=4968 |
blacklizard: |
28.10.10, 18:19 |
den_po, you wan't me to put the code in that topic? If yes, please move this post to that topic. Thanks |
thomassafca: |
28.10.10, 18:21 |
He's wondering whats the difference with your code and the code in that thread , i think |
den_po: |
28.10.10, 18:26 |
Перемещено. |
URL этой темы: https://mobilefree.justdanpo.ru/newbb_plus/viewtopic.php?topic_id=5126 © 2005-2018 supertrubka.org |