author | hgs |
Fri, 25 Jun 2010 17:36:03 -0500 | |
changeset 28 | ebf79c79991a |
parent 25 | 6f7ceef7b1d1 |
child 33 | 5e8b14bae8c3 |
permissions | -rw-r--r-- |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
25 | 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: Dynamic Management Interface Implementation |
|
15 |
* |
|
16 |
*/ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <stdlib.h> |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <assert.h> |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include "openmaxalwrapper.h" |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include "xadynintmgmtitf.h" |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "xadebug.h" |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
/* XADIMItfImpl* GetImpl(XADIMItf self) |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
* Description: Validate interface pointer and cast it to implementation pointer. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
static XADIMItfImpl* GetImpl(XADynamicInterfaceManagementItf self) |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
{ |
25 | 30 |
if (self) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
{ |
25 | 32 |
XADIMItfImpl* impl = (XADIMItfImpl*) (*self); |
33 |
if (impl && (impl == impl->self)) |
|
34 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
return impl; |
25 | 36 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
} |
25 | 38 |
return NULL; |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
/** |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
* Base Interface XADynamicInterfaceManagementItf implementation |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
**/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
/* XAresult XADIMItfImpl_AddInterface |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
* Optionally asynchronous method for exposing an interface on an object. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
XAresult XADIMItfImpl_AddInterface(XADynamicInterfaceManagementItf self, |
25 | 49 |
const XAInterfaceID iid, XAboolean async) |
50 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
XADIMItfImpl* impl = GetImpl(self); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
XAresult retval = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
DEBUG_API("->XADIMItfImpl_AddInterface"); |
25 | 54 |
if (!impl) |
55 |
{ |
|
56 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_AddInterface"); |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
return XA_RESULT_PARAMETER_INVALID; |
25 | 58 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
|
25 | 60 |
if (async) |
61 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
/* invoke asynchronously */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
/* check if another async operation is processed */ |
25 | 64 |
if (impl->asyncOngoing) |
65 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
/* abort ongoing operation */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
XAImpl_CancelThread(impl->asyncThr); |
25 | 68 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
impl->asyncOngoing = XA_BOOLEAN_TRUE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
impl->asyncID = iid; |
25 | 71 |
if (XAImpl_StartThread(impl->asyncThr, NULL, |
72 |
&XADIMItfImpl_AsyncAddItf, (void*) (self))) |
|
73 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
impl->asyncOngoing = XA_BOOLEAN_FALSE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
retval = XA_RESULT_RESOURCE_ERROR; |
25 | 76 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
else |
25 | 78 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
retval = XA_RESULT_SUCCESS; |
25 | 80 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
else |
25 | 83 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
84 |
/* invoke synchronously */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
retval = XADIMItfImpl_DoAddItf(impl, iid); |
25 | 86 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
DEBUG_API_A1("<-XADIMItfImpl_AddInterface %lu", retval); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
return retval; |
25 | 90 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
/* XAresult XADIMItfImpl_RemoveInterface |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
* Synchronous method for removing a dynamically exposed interface on an object. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
95 |
XAresult XADIMItfImpl_RemoveInterface(XADynamicInterfaceManagementItf self, |
25 | 96 |
const XAInterfaceID iid) |
97 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
XADIMItfImpl* impl = GetImpl(self); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
XAresult retval = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
DEBUG_API("->XADIMItfImpl_RemoveInterface"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
|
25 | 102 |
if (impl) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
{ |
25 | 104 |
XAObjItfMapEntry *mapEntry = NULL; |
105 |
if (impl->parent) |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
{ |
25 | 107 |
mapEntry = XAObjectItfImpl_GetItfEntry(impl->parent, iid); |
108 |
} |
|
109 |
if (mapEntry && mapEntry->isDynamic) |
|
110 |
{ |
|
111 |
if ((mapEntry->pItf)) |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
{ |
25 | 113 |
if (impl->DoRemoveItfImpl) |
114 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
retval = impl->DoRemoveItfImpl(impl->parent, mapEntry); |
25 | 116 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
else |
25 | 118 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
DEBUG_ERR("XADIMItfImpl_RemoveInterface: Object has specified dynamic itfs but not implemented DoRemoveItfImpl!!!"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
retval = XA_RESULT_INTERNAL_ERROR; |
25 | 121 |
} |
122 |
} |
|
123 |
else |
|
124 |
{ |
|
125 |
DEBUG_ERR("XADIMItfImpl_RemoveInterface interface not exposed"); |
|
126 |
retval = XA_RESULT_PRECONDITIONS_VIOLATED; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
127 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
} |
25 | 129 |
else /*( mapEntry && mapEntry->isDynamic )*/ |
130 |
{ /* interface is not supported for dynamic management */ |
|
131 |
DEBUG_ERR("XADIMItfImpl_RemoveInterface interface not supported"); |
|
132 |
retval = XA_RESULT_FEATURE_UNSUPPORTED; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
else |
25 | 136 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
retval = XA_RESULT_PARAMETER_INVALID; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
DEBUG_ERR("XADIMItfImpl_RemoveInterface: INVALID args"); |
25 | 139 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
DEBUG_API_A1("<-XADIMItfImpl_RemoveInterface %lu", retval); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
return retval; |
25 | 143 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
/* XAresult XADIMItfImpl_ResumeInterface |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
* Optionally asynchronous method for resuming a dynamically exposed interface on the object. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
XAresult XADIMItfImpl_ResumeInterface(XADynamicInterfaceManagementItf self, |
25 | 149 |
const XAInterfaceID iid, XAboolean async) |
150 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
XADIMItfImpl* impl = GetImpl(self); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
XAresult retval = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
DEBUG_API("->XADIMItfImpl_ResumeInterface"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
|
25 | 155 |
if (!impl) |
156 |
{ |
|
157 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_ResumeInterface"); |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
158 |
return XA_RESULT_PARAMETER_INVALID; |
25 | 159 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
160 |
|
25 | 161 |
if (async) |
162 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
/* invoke asynchronously */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
/* check if another async operation is processed */ |
25 | 165 |
if (impl->asyncOngoing) |
166 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
/* abort ongoing operation */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
XAImpl_CancelThread(impl->asyncThr); |
25 | 169 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
170 |
impl->asyncOngoing = XA_BOOLEAN_TRUE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
impl->asyncID = iid; |
25 | 172 |
if (XAImpl_StartThread(impl->asyncThr, NULL, |
173 |
&XADIMItfImpl_AsyncResumeItf, (void*) (self))) |
|
174 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
impl->asyncOngoing = XA_BOOLEAN_FALSE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
176 |
retval = XA_RESULT_RESOURCE_ERROR; |
25 | 177 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
else |
25 | 179 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
retval = XA_RESULT_SUCCESS; |
25 | 181 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
else |
25 | 184 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
/* invoke synchronously */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
retval = XADIMItfImpl_DoResumeItf(impl, iid); |
25 | 187 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
DEBUG_API_A1("<-XADIMItfImpl_ResumeInterface %lu", retval); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
return retval; |
25 | 191 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
/* XAresult XADIMItfImpl_RegisterCallback |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
* Registers a callback on the object |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
XAresult XADIMItfImpl_RegisterCallback(XADynamicInterfaceManagementItf self, |
25 | 197 |
xaDynamicInterfaceManagementCallback callback, void * pContext) |
198 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
XADIMItfImpl* impl = GetImpl(self); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
DEBUG_API("->XADIMItfImpl_RegisterCallback"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
|
25 | 202 |
if (!impl) |
203 |
{ |
|
204 |
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_RegisterCallback"); |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
return XA_RESULT_PARAMETER_INVALID; |
25 | 206 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
impl->dimCb = callback; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
impl->dimCbContext = pContext; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
impl->dimCbPtrToSelf = self; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
DEBUG_API("<-XADIMItfImpl_RegisterCallback"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
return XA_RESULT_SUCCESS; |
25 | 213 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
/** |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
* XADIMItfImpl -specific methods |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
**/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
/* XADIMItfImpl* XADIMItfImpl_Create() |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
* Description: Allocate and initialize DIMItfImpl |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
222 |
XADIMItfImpl* XADIMItfImpl_Create() |
25 | 223 |
{ |
224 |
XADIMItfImpl *self = (XADIMItfImpl*) calloc(1, sizeof(XADIMItfImpl)); |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
DEBUG_API("->XADIMItfImpl_Create"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
|
25 | 227 |
if (self) |
228 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
/* init itf default implementation */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
self->itf.AddInterface = XADIMItfImpl_AddInterface; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
self->itf.RemoveInterface = XADIMItfImpl_RemoveInterface; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
232 |
self->itf.ResumeInterface = XADIMItfImpl_ResumeInterface; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
233 |
self->itf.RegisterCallback = XADIMItfImpl_RegisterCallback; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
/* init variables */ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
self->asyncOngoing = XA_BOOLEAN_FALSE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
self->dimCbPtrToSelf = NULL; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
self->self = self; |
25 | 240 |
if (XAImpl_CreateThreadHandle(&(self->asyncThr)) != XA_RESULT_SUCCESS) |
241 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
242 |
free(self); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
243 |
self = NULL; |
25 | 244 |
} |
245 |
}DEBUG_API("<-XADIMItfImpl_Create"); |
|
246 |
return self; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
247 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
248 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
/* void XADIMItfImpl_Free(XADIMItfImpl* self) |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
250 |
* Description: Free all resources reserved at XADIMItfImpl_Create |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
void XADIMItfImpl_Free(XADIMItfImpl* self) |
25 | 253 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
DEBUG_API("->XADIMItfImpl_Free"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
assert(self==self->self); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
XAImpl_DeleteThreadHandle(self->asyncThr); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
free(self); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
DEBUG_API("<-XADIMItfImpl_Free"); |
25 | 259 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
/* void XADIMItfImpl_Init |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
* Description: Initialize DIM interface. Mandatory to call if dynamic |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
* interfaces are supported by object. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
*/ |
25 | 265 |
void XADIMItfImpl_Init(XADIMItfImpl* self, XAObjectItf parent, |
266 |
xaDoAddItfImpl doAdd, xaDoResumeItfImpl doResume, |
|
267 |
xaDoRemoveItfImpl doRemove) |
|
268 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
DEBUG_API("->XADIMItfImpl_Init"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
assert(self==self->self && parent && doAdd && doResume && doRemove); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
self->parent = parent; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
self->DoAddItfImpl = doAdd; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
self->DoResumeItfImpl = doResume; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
self->DoRemoveItfImpl = doRemove; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
DEBUG_API("<-XADIMItfImpl_Init"); |
25 | 278 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
/* void XADIMItfImpl_SendCbEvent |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
* Description: Object can use this method to send resource events |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
*/ |
25 | 283 |
void XADIMItfImpl_SendCbEvent(XADIMItfImpl* self, XAuint32 event, |
284 |
XAresult result, const XAInterfaceID iid) |
|
285 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
DEBUG_API("->XADIMItfImpl_SendCbEvent"); |
25 | 287 |
if (self->dimCb) |
288 |
{ |
|
289 |
self->dimCb((XADynamicInterfaceManagementItf) (self), |
|
290 |
self->dimCbContext, event, result, iid); |
|
291 |
}DEBUG_API("<-XADIMItfImpl_SendCbEvent"); |
|
292 |
} |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
/* void* XADIMItfImpl_AsyncAddItf |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
* Description: Launch AddItf from async thread. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
296 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
297 |
void* XADIMItfImpl_AsyncAddItf(void* args) |
25 | 298 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
299 |
XAresult retval = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
300 |
XADIMItfImpl* impl = GetImpl(args); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
DEBUG_API("->XADIMItfImpl_AsyncAddItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
302 |
|
25 | 303 |
if (impl) |
304 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
retval = XADIMItfImpl_DoAddItf(impl, impl->asyncID); |
25 | 306 |
if (impl->dimCb) |
307 |
{ |
|
308 |
impl->dimCb((XADynamicInterfaceManagementItf) (args), |
|
309 |
impl->dimCbContext, |
|
310 |
XA_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, retval, |
|
311 |
impl->asyncID); |
|
312 |
} |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
313 |
impl->asyncOngoing = XA_BOOLEAN_FALSE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
XAImpl_ExitThread(impl->asyncThr); |
25 | 315 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
else |
25 | 317 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
DEBUG_ERR("XADIMItfImpl_AsyncAddItf: INVALID args"); |
25 | 319 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
320 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
321 |
DEBUG_API("<-XADIMItfImpl_AsyncAddItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
return NULL; |
25 | 323 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
324 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
325 |
/* XAresult XADIMItfImpl_DoAddItf |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
326 |
* Description: Handle Itf dynamic addition and call object-specific parts. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
327 |
* Launched either from async thread or directly. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
328 |
*/ |
25 | 329 |
XAresult XADIMItfImpl_DoAddItf(XADIMItfImpl* impl, const XAInterfaceID iid) |
330 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
331 |
XAresult retval = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
332 |
DEBUG_API("->XADIMItfImpl_DoAddItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
333 |
|
25 | 334 |
if (impl) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
335 |
{ |
25 | 336 |
XAObjItfMapEntry *mapEntry = NULL; |
337 |
if (impl->parent) |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
338 |
{ |
25 | 339 |
mapEntry = XAObjectItfImpl_GetItfEntry(impl->parent, iid); |
340 |
} |
|
341 |
if (mapEntry && mapEntry->isDynamic) |
|
342 |
{ |
|
343 |
if (!(mapEntry->pItf)) |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
344 |
{ |
25 | 345 |
if (impl->DoAddItfImpl) |
346 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
retval = impl->DoAddItfImpl(impl->parent, mapEntry); |
25 | 348 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
else |
25 | 350 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
351 |
DEBUG_ERR("XADIMItfImpl_DoAddItf: Object has specified dynamic itfs but not implemented DoAddItfImpl!!!"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
352 |
retval = XA_RESULT_INTERNAL_ERROR; |
25 | 353 |
} |
354 |
} |
|
355 |
else |
|
356 |
{ |
|
357 |
DEBUG_ERR("XADIMItfImpl_DoAddItf interface already exposed"); |
|
358 |
retval = XA_RESULT_PRECONDITIONS_VIOLATED; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
359 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
360 |
} |
25 | 361 |
else /*( mapEntry && mapEntry->isDynamic )*/ |
362 |
{ /* interface is not supported for dynamic management */ |
|
363 |
DEBUG_ERR("XADIMItfImpl_DoAddItf interface not supported"); |
|
364 |
retval = XA_RESULT_FEATURE_UNSUPPORTED; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
367 |
else |
25 | 368 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
retval = XA_RESULT_INTERNAL_ERROR; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
370 |
DEBUG_ERR("XADIMItfImpl_DoAddItf: INVALID args"); |
25 | 371 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
372 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
373 |
DEBUG_API("<-XADIMItfImpl_DoAddItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
374 |
return retval; |
25 | 375 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
377 |
/* void* XADIMItfImpl_AsyncResumeItf |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
378 |
* Description: Launch ResumeItf from async thread. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
*/ |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
380 |
void* XADIMItfImpl_AsyncResumeItf(void* args) |
25 | 381 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
382 |
XAresult retval = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
383 |
XADIMItfImpl* impl = GetImpl(args); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
384 |
DEBUG_API("->XADIMItfImpl_AsyncResumeItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
|
25 | 386 |
if (impl) |
387 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
388 |
retval = XADIMItfImpl_DoResumeItf(impl, impl->asyncID); |
25 | 389 |
if (impl->dimCb) |
390 |
{ |
|
391 |
impl->dimCb((XADynamicInterfaceManagementItf) (args), |
|
392 |
impl->dimCbContext, |
|
393 |
XA_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, retval, |
|
394 |
impl->asyncID); |
|
395 |
} |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
396 |
impl->asyncOngoing = XA_BOOLEAN_FALSE; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
397 |
XAImpl_ExitThread(impl->asyncThr); |
25 | 398 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
399 |
else |
25 | 400 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
401 |
DEBUG_ERR("XADIMItfImpl_AsyncResumeItf: INVALID args"); |
25 | 402 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
DEBUG_API("<-XADIMItfImpl_AsyncResumeItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
return NULL; |
25 | 406 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
/* void XADIMItfImpl_DoResumeItf |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
409 |
* Description: Handle Itf dynamic resuming and call object-specific parts. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
* Launched either from async thread or directly. |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
411 |
*/ |
25 | 412 |
XAresult XADIMItfImpl_DoResumeItf(XADIMItfImpl* impl, const XAInterfaceID iid) |
413 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
414 |
XAresult retval = XA_RESULT_SUCCESS; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
415 |
DEBUG_API("->XADIMItfImpl_DoResumeItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
416 |
|
25 | 417 |
if (impl) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
{ |
25 | 419 |
XAObjItfMapEntry *mapEntry = XAObjectItfImpl_GetItfEntry( |
420 |
impl->parent, iid); |
|
421 |
if (mapEntry && mapEntry->isDynamic) |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
422 |
{ |
25 | 423 |
if ((!mapEntry->pItf)) |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
424 |
{ |
25 | 425 |
if (impl->DoResumeItfImpl) |
426 |
{ |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
427 |
retval = impl->DoResumeItfImpl(impl->parent, mapEntry); |
25 | 428 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
429 |
else |
25 | 430 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
431 |
DEBUG_ERR("XADIMItfImpl_DoResumeItf: Object has specified dynamic itfs but not implemented DoResumeItfImpl!!!"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
432 |
retval = XA_RESULT_INTERNAL_ERROR; |
25 | 433 |
} |
434 |
} |
|
435 |
else |
|
436 |
{ |
|
437 |
DEBUG_ERR("XADIMItfImpl_DoResumeItf interface already exposed"); |
|
438 |
retval = XA_RESULT_PRECONDITIONS_VIOLATED; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
439 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
440 |
} |
25 | 441 |
else /*( mapEntry && mapEntry->isDynamic )*/ |
442 |
{ /* interface is not supported for dynamic management */ |
|
443 |
DEBUG_ERR("XADIMItfImpl_DoResumeItf interface not supported"); |
|
444 |
retval = XA_RESULT_FEATURE_UNSUPPORTED; |
|
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
445 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
446 |
} |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
447 |
else |
25 | 448 |
{ |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
449 |
retval = XA_RESULT_INTERNAL_ERROR; |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
450 |
DEBUG_ERR("XADIMItfImpl_DoResumeItf: INVALID args"); |
25 | 451 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
452 |
|
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
453 |
DEBUG_API("<-XADIMItfImpl_DoResumeItf"); |
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
454 |
return retval; |
25 | 455 |
} |
12
5a06f39ad45b
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
456 |