Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you have quoted is a <code>device-driver</code> implementation for <code>lights</code> in an Android Emulator. Hence, <code>int (*set_light)(struct light_device_t* dev, struct light_state_t const* state);</code> is actually a function pointer declaration. This means <code>set_light</code> is a pointer to a function taking a <code>light_device_t</code> pointer and <code>light_state_t</code> pointer while returning an <code>int</code> value.</p> <p>This is a typical implementation in Android source tree. This implementation is used to have a generic implementation for potentially <code>n</code> different cases i.e. based on a case, I may want to call a different function, but the way I set it up and the way I call it, is kept generic through this implementation.</p> <p>Coming to your next question of where is this invoked. Please refer to this <a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/services/jni/com_android_server_LightsService.cpp" rel="nofollow">source file</a>. In this file, the device is setup <a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/services/jni/com_android_server_LightsService.cpp#73" rel="nofollow">here</a> which will invoke the open method referred by you. Once the setup is complete and <code>device</code> is returned, the actual method is invoked in <code>setLight_native</code> method as shown <a href="http://androidxref.com/4.2.2_r1/xref/frameworks/base/services/jni/com_android_server_LightsService.cpp#125" rel="nofollow">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload