Runtime

AndroidJMH Mf ffij Copyright (c) 2009 Jollen's Consulting SIH JIR www.jollen.org consulting AndroidJMH Mf ffij Copyright (c) 2009 Jollen's Consulting ISflH JIR www.jollen.org consulting AndroidJMH ffi MKffii Copyright (c) 2009 Jollen's Consulting ISffH JIR www.jollen.org consulting

Step 3 HAL stub W callbacks

Android_init(JNIEnv *env, jclass clazz) if (const hw_module_t**)& module) 0) if & sSensorDevice) 0) const struct sensor_t* list Tit count moduLe-> get_sensors_ListcmociuLe, fcListj N Tit count moduLe-> get_sensors_ListcmociuLe, fcListj N define SENSORS_MODULE_ID sensors AndroidJMH MKffij Copyright (c) 2009 Jollen's Consulting ISffH JIR www.jollen.org consulting

Step 4 S HAL stub SS struct hwmodulet W wrapper

* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. * * Enumerate all available sensors. The list is returned * return number of sensors in the list int (*got_GGnGorG_li.GtXGtruct GonGorG_modulo_t* modulo AndroidJMMS MKii Copyright (c) 2009 Jollen's Consulting ISflMS JIR www.jollen.org consulting ** tag must be initialized to HARDWARE_MODULE_TAG * uint32_t tag...

Step2init function

Class SensorService extends ISensorService.Stub public SensorService Context context if localLOGV Log.d TAG, SensorService startup _sensors_control_init mNotificationManager Context.NOTIFICATION_SERVICE mContext context at AndroidJMH ffi MKffii Copyright c 2009 Jollen's Consulting ISffH JIR www.jollen.org consulting

Hwdevicet

Every device data structure must begin with hw_device_t followed by module specific public methods and attributes. tag must be initialized to HARDWARE_DEVICE_TAG uint32_t tag version number for hw_device_t uint32_t version reference to the module this device belongs to struct hw_module_t module padding reserved for future use uint32_t reserved 12 Close this device int close struct hw_device_t device AndroidJMH ffi MKffii Copyright c 2009 Jollen's Consulting ISffH JIR www.jollen.org consulting

Setprop

Data Structures Java

AndroidJMUS Mf Copyright c 2009 Jollen's Consulting H HS ffiR www.jollen.org consulting Service Java framework base services java Service JNI framework base servic s7jni AndroidJMH ffi MKffii Copyright c 2009 Jollen's Consulting ISf H JIR www.jollen.org consulting AndroidJMH Mf ffij Copyright c 2009 Jollen's Consulting ISf H JIR www.jollen.org consulting AndroidJlffl Hmig ii Copyright c 2009 Jollen's Consulting igl fgffil f . www.jollen.org consulting public ' default I abstract Q final Which...

HAL Stub S open callback function ffiS ftfft struct hwdevicet device control ops

Static inline int sensors_control_open const struct hw_module_t module, struct sensors_control_device_t device return SENSORS_HARDWARE_CONTROL, truct hw_device_t device int open const struct hw_module_t module, const struct hw_device_t device at AndroidJMH ffi MKffii Copyright c 2009 Jollen's Consulting ISffH JIR www.jollen.org consulting static JNINativeMethod gMethods _sensors_control_init, I, void android_init , IZ Z _sensors_control_wake, C I, void android_open , , void android_activate ,...

Step 6 callback HAL stub

Static inline int sensors_control_open const struct hw_module_t module, struct sensors_control_device_t device -Q return moau Le- gt metnoas- gt open moau Le, SENSORS_HARDWARE_CONTROL, struct hw_device_t device at AndroidJMH MKii Copyright c 2009 Jollen's Consulting ISffH JIR www.jollen.org consulting AndroidJMH Mf Copyright c 2009 Jollen's Consulting ISf H JIR www.jollen.org consulting

HAL Stub fffl

Service JNI framework base services jni AndroidJMH Mf ffij Copyright c 2009 Jollen's Consulting ISf H JIR www.jollen.org consulting AndroidJMH M Mf ii Copyright c 2009 Jollen's Consulting ISf H MJIR www.jollen.org consulting AndroidJMH M Mf ii Copyright c 2009 Jollen's Consulting ISf H MJIR www.jollen.org consulting