1 /* WinRT Windows.Perception.Stub Observer Implementation
3 * Copyright (C) 2023 Mohamad Al-Jaf
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(perception
);
28 IActivationFactory IActivationFactory_iface
;
29 ISpatialSurfaceObserverStatics ISpatialSurfaceObserverStatics_iface
;
30 ISpatialSurfaceObserverStatics2 ISpatialSurfaceObserverStatics2_iface
;
34 static inline struct observer
*impl_from_IActivationFactory( IActivationFactory
*iface
)
36 return CONTAINING_RECORD( iface
, struct observer
, IActivationFactory_iface
);
39 static HRESULT WINAPI
factory_QueryInterface( IActivationFactory
*iface
, REFIID iid
, void **out
)
41 struct observer
*impl
= impl_from_IActivationFactory( iface
);
43 TRACE( "iface %p, iid %s, out %p.\n", iface
, debugstr_guid( iid
), out
);
45 if (IsEqualGUID( iid
, &IID_IUnknown
) ||
46 IsEqualGUID( iid
, &IID_IInspectable
) ||
47 IsEqualGUID( iid
, &IID_IAgileObject
) ||
48 IsEqualGUID( iid
, &IID_IActivationFactory
))
50 *out
= &impl
->IActivationFactory_iface
;
51 IInspectable_AddRef( *out
);
55 if (IsEqualGUID( iid
, &IID_ISpatialSurfaceObserverStatics
))
57 *out
= &impl
->ISpatialSurfaceObserverStatics_iface
;
58 IInspectable_AddRef( *out
);
62 if (IsEqualGUID( iid
, &IID_ISpatialSurfaceObserverStatics2
))
64 *out
= &impl
->ISpatialSurfaceObserverStatics2_iface
;
65 IInspectable_AddRef( *out
);
69 FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid
) );
74 static ULONG WINAPI
factory_AddRef( IActivationFactory
*iface
)
76 struct observer
*impl
= impl_from_IActivationFactory( iface
);
77 ULONG ref
= InterlockedIncrement( &impl
->ref
);
78 TRACE( "iface %p increasing refcount to %lu.\n", iface
, ref
);
82 static ULONG WINAPI
factory_Release( IActivationFactory
*iface
)
84 struct observer
*impl
= impl_from_IActivationFactory( iface
);
85 ULONG ref
= InterlockedDecrement( &impl
->ref
);
86 TRACE( "iface %p decreasing refcount to %lu.\n", iface
, ref
);
90 static HRESULT WINAPI
factory_GetIids( IActivationFactory
*iface
, ULONG
*iid_count
, IID
**iids
)
92 FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
96 static HRESULT WINAPI
factory_GetRuntimeClassName( IActivationFactory
*iface
, HSTRING
*class_name
)
98 FIXME( "iface %p, class_name %p stub!\n", iface
, class_name
);
102 static HRESULT WINAPI
factory_GetTrustLevel( IActivationFactory
*iface
, TrustLevel
*trust_level
)
104 FIXME( "iface %p, trust_level %p stub!\n", iface
, trust_level
);
108 static HRESULT WINAPI
factory_ActivateInstance( IActivationFactory
*iface
, IInspectable
**instance
)
110 FIXME( "iface %p, instance %p stub!\n", iface
, instance
);
114 static const struct IActivationFactoryVtbl factory_vtbl
=
116 factory_QueryInterface
,
119 /* IInspectable methods */
121 factory_GetRuntimeClassName
,
122 factory_GetTrustLevel
,
123 /* IActivationFactory methods */
124 factory_ActivateInstance
,
127 DEFINE_IINSPECTABLE( observer_statics
, ISpatialSurfaceObserverStatics
, struct observer
, IActivationFactory_iface
)
129 static HRESULT WINAPI
observer_statics_RequestAccessAsync( ISpatialSurfaceObserverStatics
*iface
, IAsyncOperation_SpatialPerceptionAccessStatus
**result
)
131 FIXME( "iface %p, result %p stub!\n", iface
, result
);
135 static const struct ISpatialSurfaceObserverStaticsVtbl observer_statics_vtbl
=
137 observer_statics_QueryInterface
,
138 observer_statics_AddRef
,
139 observer_statics_Release
,
140 /* IInspectable methods */
141 observer_statics_GetIids
,
142 observer_statics_GetRuntimeClassName
,
143 observer_statics_GetTrustLevel
,
144 /* ISpatialSurfaceObserverStatics methods */
145 observer_statics_RequestAccessAsync
,
148 DEFINE_IINSPECTABLE( observer_statics2
, ISpatialSurfaceObserverStatics2
, struct observer
, IActivationFactory_iface
)
150 static HRESULT WINAPI
observer_statics2_IsSupported( ISpatialSurfaceObserverStatics2
*iface
, boolean
*value
)
152 TRACE( "iface %p, value %p.\n", iface
, value
);
158 static const struct ISpatialSurfaceObserverStatics2Vtbl observer_statics2_vtbl
=
160 observer_statics2_QueryInterface
,
161 observer_statics2_AddRef
,
162 observer_statics2_Release
,
163 /* IInspectable methods */
164 observer_statics2_GetIids
,
165 observer_statics2_GetRuntimeClassName
,
166 observer_statics2_GetTrustLevel
,
167 /* ISpatialSurfaceObserverStatics2 methods */
168 observer_statics2_IsSupported
,
171 static struct observer observer_statics
=
174 {&observer_statics_vtbl
},
175 {&observer_statics2_vtbl
},
179 IActivationFactory
*observer_factory
= &observer_statics
.IActivationFactory_iface
;