1181152RDHALsensor模型分析Word文档格式.docx
- 文档编号:18324658
- 上传时间:2022-12-15
- 格式:DOCX
- 页数:16
- 大小:20.07KB
1181152RDHALsensor模型分析Word文档格式.docx
《1181152RDHALsensor模型分析Word文档格式.docx》由会员分享,可在线阅读,更多相关《1181152RDHALsensor模型分析Word文档格式.docx(16页珍藏版)》请在冰豆网上搜索。
75:
*InthisversionoftheAPItherecanonlybe256handles.
76:
77:
#defineSENSORS_HANDLE_BASE0
78:
#defineSENSORS_HANDLE_BITS8
79:
#defineSENSORS_HANDLE_COUNT(1<
<
SENSORS_HANDLE_BITS)
80:
81:
82:
83:
*Sensortypes
84:
85:
#defineSENSOR_TYPE_ACCELEROMETER1
86:
#defineSENSOR_TYPE_MAGNETIC_FIELD2
87:
#defineSENSOR_TYPE_ORIENTATION3
88:
#defineSENSOR_TYPE_GYROSCOPE4
89:
#defineSENSOR_TYPE_LIGHT5
90:
#defineSENSOR_TYPE_PRESSURE6
91:
#defineSENSOR_TYPE_TEMPERATURE7
92:
#defineSENSOR_TYPE_PROXIMITY8
93:
94:
95:
*Valuesreturnedbytheaccelerometerinvariouslocationsintheuniverse.
96:
*allvaluesareinSIunits(m/s^2)
97:
98:
99:
#defineGRAVITY_SUN(275.0f)
100:
#defineGRAVITY_MERCURY(3.70f)
101:
#defineGRAVITY_VENUS(8.87f)
102:
#defineGRAVITY_EARTH(9.80665f)
103:
#defineGRAVITY_MOON(1.6f)
104:
#defineGRAVITY_MARS(3.71f)
105:
#defineGRAVITY_JUPITER(23.12f)
106:
#defineGRAVITY_SATURN(8.96f)
107:
#defineGRAVITY_URANUS(8.69f)
108:
#defineGRAVITY_NEPTUNE(11.0f)
109:
#defineGRAVITY_PLUTO(0.6f)
110:
#defineGRAVITY_DEATH_STAR_I(0.000000353036145f)
111:
#defineGRAVITY_THE_ISLAND(4.815162342f)
112:
113:
/**MaximummagneticfieldonEarth'
ssurface*/
114:
#defineMAGNETIC_FIELD_EARTH_MAX(60.0f)
115:
116:
/**MinimummagneticfieldonEarth'
117:
#defineMAGNETIC_FIELD_EARTH_MIN(30.0f)
118:
119:
120:
121:
*statusofeachsensor
122:
123:
124:
#defineSENSOR_STATUS_UNRELIABLE0
125:
#defineSENSOR_STATUS_ACCURACY_LOW1
126:
#defineSENSOR_STATUS_ACCURACY_MEDIUM2
127:
#defineSENSOR_STATUS_ACCURACY_HIGH3
128:
130:
231:
*Light
232:
*-
235:
*
----
233:
234:
*ThelightsensorvalueisreturnedinSIluxunits.
236:
237:
typedefstruct{
238:
union{
239:
floatv[3];
240:
struct{
241:
floatx;
242:
floaty;
243:
floatz;
244:
};
245:
246:
floatazimuth;
247:
floatpitch;
248:
floatroll;
249:
250:
251:
int8_tstatus;
252:
uint8_treserved[3];
253:
}sensors_vec_t;
254:
255:
256:
*Unionofthevarioustypesofsensordata
257:
*thatcanbereturned.
258:
259:
260:
/*sensoridentifier*/
261:
intsensor;
262:
263:
264:
/*x,y,zvaluesofthegivensensor*/
265:
sensors_vec_tvector;
266:
267:
/*orientationvaluesareindegrees*/
268:
sensors_vec_torientation;
269:
270:
/*accelerationvaluesareinmeterpersecondpersecond(m/s^2)*/
271:
sensors_vec_tacceleration;
272:
273:
/*magneticvectorvaluesareinmicro-Tesla(uT)*/
274:
sensors_vec_tmagnetic;
275:
276:
/*temperatureisindegreescentigrade(Celsius)*/
277:
floattemperature;
278:
279:
/*distanceincentimeters*/
280:
floatdistance;
281:
282:
/*lightinSIluxunits*/
283:
floatlight;
284:
285:
286:
/*timeisinnanosecond*/
287:
int64_ttime;
288:
289:
uint32_treserved;
290:
}sensors_data_t;
291:
292:
定义了一个sensor获得的数据的结构体。
293:
structsensor_t;
294:
295:
296:
*EveryhardwaremodulemusthaveadatastructurenamedHAL_MODULE_INFO_SYM
297:
*andthefieldsofthisdatastructuremustbeginwithhw_module_t
298:
*followedbymodulespecificinformation.
299:
300:
structsensors_module_t{
301:
structhw_module_tcommon;
302:
303:
304:
*Enumerateallavailablesensors.Thelistisreturnedin"
list"
.
305:
*@returnnumberofsensorsinthelist
306:
307:
int(*get_sensors_list)(structsensors_module_t*module,
308:
structsensor_tconst**list);
309:
310:
上面定
311:
structsensor_t{
312:
/*nameofthissensors*/
313:
constchar*name;
314:
/*vendorofthehardwarepart*/
315:
constchar*vendor;
316:
/*versionofthehardwarepart+driver.Thevalueofthisfieldis
317:
*lefttotheimplementationanddoesn'
thavetobemonotonicaly
318:
*increasing.
319:
*/
320:
intversion;
321:
/*handlethatidentifiesthissensors.Thishandleisusedtoactivate
322:
*anddeactivatethissensor.Thevalueofthehandlemustbe8bits
323:
*inthisversionoftheAPI.
324:
325:
inthandle;
326:
/*thissensor'
stype.*/
327:
inttype;
328:
/*maximaumrangeofthissensor'
svalueinSIunits*/
329:
floatmaxRange;
330:
/*smallestdifferencebetweentwovaluesreportedbythissensor*/
331:
floatresolution;
332:
/*roughestimateofthissensor'
spowerconsumptioninmA*/
333:
floatpower;
334:
/*reservedfields,mustbezero*/
335:
void*reserved[9];
336:
337:
338:
339:
340:
*Everydevicedatastructuremustbeginwithhw_device_t
341:
*followedbymodulespecificpublicmethodsandattributes.
342:
343:
structsensors_control_device_t{
344:
structhw_device_tcommon;
345:
346:
347:
*Returnsanative_handle_t,whichwillbetheparameterto
348:
*sensors_data_device_t:
:
open_data().
349:
*Thecallertakesownershipofthishandle.Thisisintendedtobe
350:
*passedcrossprocesses.
351:
352:
*@returnanative_handle_tifsuccessful,NULLonerror
353:
354:
native_handle_t*(*open_data_source)(structsensors_control_device_t*dev);
355:
356:
357:
*Releasesanyresourcesthatwerecreatedbyopen_data_source.
358:
*ThiscallisoptionalandcanbeNULLifnotimplemented
359:
*bythesensorHAL.
360:
361:
*@return0ifsuccessful,<
0onerror
362:
363:
int(*close_data_source)(structsensors_control_device_t*dev);
364:
365:
/**Activate/deactivateonesensor.
366:
367:
*@paramhandleisthehandleofthesensortochange.
368:
*@paramenabledsetto1toenable,or0todisablethesensor.
369:
370:
*@return0onsuccess,negativeerrnocodeotherwise
371:
372:
int(*activate)(structsensors_control_device_t*dev,
373:
inthandle,intenabled);
374:
375:
376:
*Setthedelaybetweensensoreventsinms
377:
378:
379:
380:
int(*set_delay)(structsensors_control_device_t*dev,int32_tms);
381:
382:
383:
*Causessensors_data_device_t.poll()toreturn-EWOULDBLOCKimmediately.
384:
385:
int(*wake)(structsensors_control_device_t*dev);
386:
387:
388:
structsensors_data_device_t{
389:
390:
391:
392:
*Preparetoreadsensordata.
393:
394:
*ThisroutinedoesNOTtakeownershipofthehandle
395:
*andmustnotcloseit.Typicallythisroutinewould
396:
*useaduplicateofthenhparameter.
397:
398:
*@paramnhfromsensors_control_open.
399:
400:
401:
402:
int(*data_open)(structsensors_data_device_t*dev,native_handle_t*nh);
403:
404:
405:
*Callerhascompletedusingthesensordata.
406:
*Thecallerwillnotbeblockedinsensors_data_poll
407:
*whenthisroutineiscalled.
408:
409:
410:
411:
int(*data_close)(structsensors_data_device_t*dev);
412:
413:
414:
*Returnsensordataforoneoftheenabledsensors.
415:
416:
*@returnsensorhandleforthereturneddata,0x7FFFFFFFwhen
417:
*sensors_control_device_t.wake()iscalledand-errnoonerror
418:
*
419:
420:
int(*poll)(structsensors_data_device_t*dev,
421:
sensors_data_t*data);
422:
423:
424:
425:
/**convenienceAPIforopeningandclosingadevice*/
426:
427:
staticinlineintsensors_control_open(conststructhw_module_t*module,
428:
structsensors_control_device_t**device){
429:
returnmodule->
methods->
open(module,
430:
SENSORS_HARDWARE_CONTROL,(structhw_device_t**)device);
431:
}
432:
433:
staticinlineintsensors_control_close(structsensors_control_device_t*device){
434:
returndevice->
common.close(&
device->
common);
435:
436:
437:
staticinlineintsensors_data_open(conststructhw_module_t*module,
438:
structsensors_data_device_t**device){
439:
440:
SENSORS_HARDWARE_DATA,(structhw_device_t**)device);
441:
442:
443:
staticinlineintsensors_data_close(structsensors_data_device_t*device){
444:
445:
446:
447:
448:
__END_DECLS
449:
450:
#endif//ANDROID_SENSORS_INTERFACE_H
*********************hardware.h***************************************************
/*CopyrightStatement:
*Thissoftware/firmwareandrelateddocumentation("
MediaTekSoftware"
)are
*protectedunderrelevantcopyrightlaws.Theinformationcontainedherein
*isconfidentialandproprietarytoMediaTekInc.and/oritslicensors.
*WithoutthepriorwrittenpermissionofMediaTekinc.and/oritslicensors,
*anyreproduction,modification,useordisclosureofMediaTekSoftware,
*andinformationcontainedherein,inwholeorinpart,shallbestrictlyprohibited.
*MediaTekInc.(C)2010.Allrightsreserved.
*BYOPENINGTHISFILE,RECEIVERHEREBYUNEQUIVOCALLYACKNOWLEDGESANDAGREES
*THATTHESOFTWARE/FIRMWAREANDITSDOCUMENTATIONS("
MEDIATEKSOFTWARE"
)
*RECEIVEDFRO
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 1181152 RDHALsensor 模型 分析
![提示](https://static.bdocx.com/images/bang_tan.gif)