|
16 | 16 | * limitations under the License.
|
17 | 17 | */
|
18 | 18 |
|
19 |
| -/** |
20 |
| - * @file |
21 |
| - * This file implements reporting engine for CHIP |
22 |
| - * Data Model profile. |
23 |
| - * |
24 |
| - */ |
25 |
| - |
26 |
| -#include <app/data-model-provider/ActionReturnStatus.h> |
27 |
| -#include <app/icd/server/ICDServerConfig.h> |
28 |
| -#include <app/reporting/Read-Checked.h> |
29 |
| -#if CHIP_CONFIG_ENABLE_ICD_SERVER |
30 |
| -#include <app/icd/server/ICDNotifier.h> // nogncheck |
31 |
| -#endif |
32 | 19 | #include <app/AppConfig.h>
|
| 20 | +#include <app/ConcreteEventPath.h> |
33 | 21 | #include <app/InteractionModelEngine.h>
|
34 | 22 | #include <app/RequiredPrivilege.h>
|
| 23 | +#include <app/data-model-provider/ActionReturnStatus.h> |
| 24 | +#include <app/data-model-provider/Provider.h> |
| 25 | +#include <app/icd/server/ICDServerConfig.h> |
35 | 26 | #include <app/reporting/Engine.h>
|
| 27 | +#include <app/reporting/Read-Checked.h> |
36 | 28 | #include <app/reporting/Read.h>
|
37 | 29 | #include <app/reporting/reporting.h>
|
38 | 30 | #include <app/util/MatterCallbacks.h>
|
39 | 31 | #include <app/util/ember-compatibility-functions.h>
|
| 32 | +#include <lib/core/DataModelTypes.h> |
| 33 | +#include <protocols/interaction_model/StatusCode.h> |
| 34 | + |
| 35 | +#if CHIP_CONFIG_ENABLE_ICD_SERVER |
| 36 | +#include <app/icd/server/ICDNotifier.h> // nogncheck |
| 37 | +#endif |
40 | 38 |
|
41 | 39 | using namespace chip::Access;
|
42 | 40 |
|
43 | 41 | namespace chip {
|
44 | 42 | namespace app {
|
45 | 43 | namespace reporting {
|
| 44 | +namespace { |
| 45 | + |
| 46 | +using Protocols::InteractionModel::Status; |
| 47 | + |
| 48 | +Status EventPathValid(DataModel::Provider * model, const ConcreteEventPath & eventPath) |
| 49 | +{ |
| 50 | +#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE |
| 51 | + |
| 52 | + if (!model->GetClusterInfo(eventPath).has_value()) |
| 53 | + { |
| 54 | + return model->EndpointExists(eventPath.mEndpointId) ? Status::UnsupportedCluster : Status::UnsupportedEndpoint; |
| 55 | + } |
| 56 | + |
| 57 | + return Status::Success; |
| 58 | +#else |
| 59 | + return CheckEventSupportStatus(eventPath); |
| 60 | +#endif |
| 61 | +} |
| 62 | + |
| 63 | +} // namespace |
46 | 64 |
|
47 | 65 | Engine::Engine(InteractionModelEngine * apImEngine) : mpImEngine(apImEngine) {}
|
48 | 66 |
|
@@ -330,7 +348,8 @@ CHIP_ERROR Engine::CheckAccessDeniedEventPaths(TLV::TLVWriter & aWriter, bool &
|
330 | 348 | }
|
331 | 349 |
|
332 | 350 | ConcreteEventPath path(current->mValue.mEndpointId, current->mValue.mClusterId, current->mValue.mEventId);
|
333 |
| - Status status = CheckEventSupportStatus(path); |
| 351 | + Status status = EventPathValid(mpImEngine->GetDataModelProvider(), path); |
| 352 | + |
334 | 353 | if (status != Status::Success)
|
335 | 354 | {
|
336 | 355 | TLV::TLVWriter checkpoint = aWriter;
|
|
0 commit comments