|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef __PLUGININTERFACE_H__ |
|
18 #define __PLUGININTERFACE_H__ |
|
19 |
|
20 #include <EGL/egl.h> |
|
21 |
|
22 |
|
23 typedef struct |
|
24 { |
|
25 // the returned egl config that the plugin would preferably use |
|
26 // the config actually chosen may differ from what the plugin prefers. |
|
27 // The API selection is done according to the value specified by EGL_RENDERABLE_TYPE field in the given config. |
|
28 // If given config does not specify EGL_RENDERABLE_TYPE, opengl 2 is assumed by default |
|
29 const EGLint* (*getpreferredconfig)(void); |
|
30 |
|
31 // sets the display dimensions for the plugin, can be called at any point of time. |
|
32 // guaranteed to be once called rigth after initialize |
|
33 void (*setdisplaydimensions)(int, int); |
|
34 |
|
35 // produces the next frame, eglSwapbuffers will be called immediately after this function by the host. |
|
36 void (*produceframe)(void); |
|
37 |
|
38 // informs the plugin when it can have gpu resources allocated or not. the plugin is not allowed to make any gpu allocations |
|
39 // before this function has been called. also it should release all gpu resources when the parameter is false. |
|
40 // return 0 if resource (re)allocation was succesfull. The surface/context can be assumed to be created when this function is called with true |
|
41 // if this function is called with false, the surface/context will be destroyed immediately after this call by the host |
|
42 int (*gpuresourcesavailable)(int); |
|
43 |
|
44 // initializes the plugin, allocated all non gpu related resources |
|
45 // should return 0 if initialization was successfull. the full path to the directory where the external data for this plugin resides |
|
46 // can assume that EGL is initialized(but the context/surface is not) |
|
47 // the second parameter is the maximum amount of graphics memory the plugin is allowed to use (excluding surface) |
|
48 int (*initialize)(const char*, unsigned int); |
|
49 |
|
50 |
|
51 // destroys the plugin instance, plugin should free all resources it has reserved |
|
52 void (*destroy)(void); |
|
53 |
|
54 // reports the desired sensor id:s to the host, the host will listen to the specified sensors and sensor data via |
|
55 // receivesensordata function. The return value is an array of unsigned ints (sensor id:s). The list must be terminated with a value 0 |
|
56 // If plugin does not want to use sensors, the function pointer must to be initialized to NULL |
|
57 const unsigned int* (*desiredsensors)(void); |
|
58 |
|
59 // Function for receiving the sensor data. The funtion is essentially the same as MSensrvDataListener::DataReceived( CSensrvChannel& aChannel, TInt aCount, TInt aDataLost ) with different parameter types |
|
60 // the function should cast the first void ptr to CSensrvChannel* in order to figure out what kind of data is sent. The 2 int parameters are aDataCount and aDataLost (same as inSensrvDataListener::DataReceived) |
|
61 // If plugin does not want to use sensors, the function pointer must to be initialized to NULL |
|
62 void (*receivesensordata)(void*, int, int); |
|
63 |
|
64 // this function can be used to convey any additional data from/to the plugin. |
|
65 int (*extension)(int, void*); |
|
66 } plugin_export_v1_t; |
|
67 |
|
68 |
|
69 #ifdef __cplusplus |
|
70 extern "C" { |
|
71 #endif |
|
72 // returns the plugin interface. the return parameter should be cast to <plugin_export_vX_t*> where X should match the version given as a parameter to this function |
|
73 IMPORT_C void* getinterface(int version); |
|
74 |
|
75 #ifdef __cplusplus |
|
76 } |
|
77 #endif |
|
78 |
|
79 #endif |