20 #include <assert.h> |
20 #include <assert.h> |
21 #include "xavibradevice.h" |
21 #include "xavibradevice.h" |
22 #include "xavibraitf.h" |
22 #include "xavibraitf.h" |
23 #include "xaconfigextensionsitf.h" |
23 #include "xaconfigextensionsitf.h" |
24 #include "xadynintmgmtitf.h" |
24 #include "xadynintmgmtitf.h" |
25 |
25 #include "xavibraadaptctx.h" |
26 |
26 |
27 /* Static mapping of enumeration XAVibraDeviceInterfaces to interface iids */ |
27 /* Static mapping of enumeration XAVibraDeviceInterfaces to interface iids */ |
28 static const XAInterfaceID* XAVibraDeviceItfIIDs[VIBRA_ITFCOUNT]= |
28 static const XAInterfaceID* XAVibraDeviceItfIIDs[VIBRA_ITFCOUNT]= |
29 { |
29 { |
30 &XA_IID_OBJECT, |
30 &XA_IID_OBJECT, |
39 *****************************************************************************/ |
39 *****************************************************************************/ |
40 /* |
40 /* |
41 * XAresult XAVibraDeviceImpl_CreateVibraDevice |
41 * XAresult XAVibraDeviceImpl_CreateVibraDevice |
42 * Description: Create object |
42 * Description: Create object |
43 */ |
43 */ |
44 XAresult XAVibraDeviceImpl_CreateVibraDevice(XAObjectItf* pDevice, |
44 XAresult XAVibraDeviceImpl_CreateVibraDevice(FrameworkMap* mapper, |
|
45 XAObjectItf* pDevice, |
45 XAuint32 deviceID, |
46 XAuint32 deviceID, |
46 XAuint32 numInterfaces, |
47 XAuint32 numInterfaces, |
47 const XAInterfaceID * pInterfaceIds, |
48 const XAInterfaceID * pInterfaceIds, |
48 const XAboolean * pInterfaceRequired) |
49 const XAboolean * pInterfaceRequired) |
49 { |
50 { |
114 entry->required = XA_BOOLEAN_TRUE; |
115 entry->required = XA_BOOLEAN_TRUE; |
115 } |
116 } |
116 } |
117 } |
117 } |
118 } |
118 |
119 |
119 /* Initialize XAVibraDeviceImpl variables */ |
|
120 pImpl->deviceID = deviceID; |
|
121 |
|
122 #ifdef _GSTREAMER_BACKEND_ |
|
123 pImpl->adaptationCtx = XAVibraAdapt_Create(pImpl->deviceID); |
|
124 #endif |
|
125 |
|
126 /* This code is put here to return Feature Not Supported since adaptation is not present*/ |
120 /* This code is put here to return Feature Not Supported since adaptation is not present*/ |
127 /*************************************************/ |
121 /*************************************************/ |
|
122 DEBUG_ERR("Required interface not found - abort creation!"); |
128 XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); |
123 XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); |
129 DEBUG_ERR("Required interface not found - abort creation!"); |
|
130 DEBUG_API("<-XAVibraDeviceImpl_CreateVibraDevice"); |
124 DEBUG_API("<-XAVibraDeviceImpl_CreateVibraDevice"); |
131 return XA_RESULT_FEATURE_UNSUPPORTED; |
125 return XA_RESULT_FEATURE_UNSUPPORTED; |
132 /*************************************************/ |
126 /*************************************************/ |
133 |
127 |
134 /* Set ObjectItf to point to newly created object */ |
128 /* // Initialize XAVibraDeviceImpl variables |
135 /* *pDevice = (XAObjectItf)&(pBaseObj->self); |
129 pImpl->deviceID = deviceID; |
|
130 |
|
131 |
|
132 pImpl->adaptationCtx = XAVibraAdapt_Create(pImpl->deviceID); |
|
133 |
|
134 //Set ObjectItf to point to newly created object |
|
135 *pDevice = (XAObjectItf)&(pBaseObj->self); |
136 |
136 |
137 DEBUG_API("<-XAVibraDeviceImpl_Create"); |
137 DEBUG_API("<-XAVibraDeviceImpl_Create"); |
138 return XA_RESULT_SUCCESS;*/ |
138 return XA_RESULT_SUCCESS;*/ |
139 } |
139 } |
140 /* XAResult XAVibraDeviceImpl_QueryNumSupportedInterfaces |
140 /* XAResult XAVibraDeviceImpl_QueryNumSupportedInterfaces |
203 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
203 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
204 DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); |
204 DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); |
205 return XA_RESULT_PARAMETER_INVALID; |
205 return XA_RESULT_PARAMETER_INVALID; |
206 } |
206 } |
207 |
207 |
208 #ifdef _GSTREAMER_BACKEND_ |
208 |
209 ret = XAVibraAdapt_PostInit( pObjImpl->adaptationCtx ); |
209 ret = XAVibraAdapt_PostInit( pObjImpl->adaptationCtx ); |
210 #endif |
210 |
211 if( ret != XA_RESULT_SUCCESS ) |
211 if( ret != XA_RESULT_SUCCESS ) |
212 { |
212 { |
213 DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); |
213 DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); |
214 return ret; |
214 return ret; |
215 } |
215 } |
270 * Description: Free all resources reserved at XAVibraDeviceImpl_DoRealize() |
270 * Description: Free all resources reserved at XAVibraDeviceImpl_DoRealize() |
271 */ |
271 */ |
272 void XAVibraDeviceImpl_FreeResources(XAObjectItf self) |
272 void XAVibraDeviceImpl_FreeResources(XAObjectItf self) |
273 { |
273 { |
274 XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); |
274 XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); |
275 |
275 XAVibraDeviceImpl* pImpl = (XAVibraDeviceImpl*) (*self); |
276 XAuint8 itfIdx = 0; |
276 XAuint8 itfIdx = 0; |
277 DEBUG_API("->XAVibraDeviceImpl_FreeResources"); |
277 DEBUG_API("->XAVibraDeviceImpl_FreeResources"); |
278 #ifdef _GSTREAMER_BACKEND_ |
278 |
279 XAVibraDeviceImpl* pImpl = (XAVibraDeviceImpl*) (*self); |
279 |
280 assert( pObj && pImpl && pObj == pObj->self ); |
280 assert( pObj && pImpl && pObj == pObj->self ); |
281 if (pImpl->adaptationCtx != NULL) |
281 if (pImpl->adaptationCtx != NULL) |
282 { |
282 { |
283 XAVibraAdapt_Destroy(pImpl->adaptationCtx); |
283 XAVibraAdapt_Destroy(pImpl->adaptationCtx); |
284 pImpl->adaptationCtx = NULL; |
284 pImpl->adaptationCtx = NULL; |
285 } |
285 } |
286 #endif |
286 |
287 /* free all allocated interfaces */ |
287 /* free all allocated interfaces */ |
288 for (itfIdx = 0; itfIdx < VIBRA_ITFCOUNT; itfIdx++) |
288 for (itfIdx = 0; itfIdx < VIBRA_ITFCOUNT; itfIdx++) |
289 { |
289 { |
290 void *pItf = pObj->interfaceMap[itfIdx].pItf; |
290 void *pItf = pObj->interfaceMap[itfIdx].pItf; |
291 if (pItf) |
291 if (pItf) |