|
| 1 | +/* |
| 2 | + * |
| 3 | + * Copyright (c) 2024 Project CHIP Authors |
| 4 | + * All rights reserved. |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +#pragma once |
| 20 | + |
| 21 | +#include <app/clusters/service-area-server/service-area-server.h> |
| 22 | +#include <app/util/config.h> |
| 23 | +#include <cstring> |
| 24 | +#include <utility> |
| 25 | + |
| 26 | +namespace chip { |
| 27 | +namespace app { |
| 28 | +namespace Clusters { |
| 29 | + |
| 30 | +class RvcDevice; |
| 31 | + |
| 32 | +namespace ServiceArea { |
| 33 | + |
| 34 | +class RvcServiceAreaDelegate : public Delegate |
| 35 | +{ |
| 36 | +private: |
| 37 | + // containers for array attributes. |
| 38 | + std::vector<ServiceArea::LocationStructureWrapper> mSupportedLocations; |
| 39 | + std::vector<ServiceArea::MapStructureWrapper> mSupportedMaps; |
| 40 | + std::vector<uint32_t> mSelectedLocations; |
| 41 | + std::vector<ServiceArea::Structs::ProgressStruct::Type> mProgressList; |
| 42 | + |
| 43 | +public: |
| 44 | + CHIP_ERROR Init() override; |
| 45 | + |
| 46 | + // command support |
| 47 | + bool IsSetSelectedLocationsAllowed(MutableCharSpan statusText) override; |
| 48 | + |
| 49 | + bool IsValidSelectLocationsSet(const ServiceArea::Commands::SelectLocations::DecodableType & req, |
| 50 | + ServiceArea::SelectLocationsStatus & locationStatus, MutableCharSpan statusText) override; |
| 51 | + |
| 52 | + bool HandleSkipCurrentLocation(MutableCharSpan skipStatusText) override; |
| 53 | + |
| 54 | + //************************************************************************* |
| 55 | + // Supported Locations accessors |
| 56 | + |
| 57 | + bool IsSupportedLocationsChangeAllowed() override; |
| 58 | + |
| 59 | + uint32_t GetNumberOfSupportedLocations() override; |
| 60 | + |
| 61 | + bool GetSupportedLocationByIndex(uint32_t listIndex, ServiceArea::LocationStructureWrapper & supportedLocation) override; |
| 62 | + |
| 63 | + bool GetSupportedLocationById(uint32_t aLocationId, uint32_t & listIndex, |
| 64 | + ServiceArea::LocationStructureWrapper & supportedLocation) override; |
| 65 | + |
| 66 | + bool AddSupportedLocation(const ServiceArea::LocationStructureWrapper & newLocation, uint32_t & listIndex) override; |
| 67 | + |
| 68 | + bool ModifySupportedLocation(uint32_t listIndex, const ServiceArea::LocationStructureWrapper & modifiedLocation) override; |
| 69 | + |
| 70 | + bool ClearSupportedLocations() override; |
| 71 | + |
| 72 | + //************************************************************************* |
| 73 | + // Supported Maps accessors |
| 74 | + |
| 75 | + bool IsSupportedMapChangeAllowed() override; |
| 76 | + |
| 77 | + uint32_t GetNumberOfSupportedMaps() override; |
| 78 | + |
| 79 | + bool GetSupportedMapByIndex(uint32_t listIndex, ServiceArea::MapStructureWrapper & supportedMap) override; |
| 80 | + |
| 81 | + bool GetSupportedMapById(uint8_t aMapId, uint32_t & listIndex, ServiceArea::MapStructureWrapper & supportedMap) override; |
| 82 | + |
| 83 | + bool AddSupportedMap(const ServiceArea::MapStructureWrapper & newMap, uint32_t & listIndex) override; |
| 84 | + |
| 85 | + bool ModifySupportedMap(uint32_t listIndex, const ServiceArea::MapStructureWrapper & newMap) override; |
| 86 | + |
| 87 | + bool ClearSupportedMaps() override; |
| 88 | + |
| 89 | + //************************************************************************* |
| 90 | + // Selected Locations accessors |
| 91 | + |
| 92 | + uint32_t GetNumberOfSelectedLocations() override; |
| 93 | + |
| 94 | + bool GetSelectedLocationByIndex(uint32_t listIndex, uint32_t & selectedLocation) override; |
| 95 | + |
| 96 | + // IsSelectedLocation() no override |
| 97 | + |
| 98 | + bool AddSelectedLocation(uint32_t aLocationId, uint32_t & listIndex) override; |
| 99 | + |
| 100 | + bool ClearSelectedLocations() override; |
| 101 | + |
| 102 | + //************************************************************************* |
| 103 | + // Progress accessors |
| 104 | + |
| 105 | + uint32_t GetNumberOfProgressElements() override; |
| 106 | + |
| 107 | + bool GetProgressElementByIndex(uint32_t listIndex, ServiceArea::Structs::ProgressStruct::Type & aProgressElement) override; |
| 108 | + |
| 109 | + bool GetProgressElementById(uint32_t aLocationId, uint32_t & listIndex, |
| 110 | + ServiceArea::Structs::ProgressStruct::Type & aProgressElement) override; |
| 111 | + |
| 112 | + bool AddProgressElement(const ServiceArea::Structs::ProgressStruct::Type & newProgressElement, uint32_t & listIndex) override; |
| 113 | + |
| 114 | + bool ModifyProgressElement(uint32_t listIndex, |
| 115 | + const ServiceArea::Structs::ProgressStruct::Type & modifiedProgressElement) override; |
| 116 | + |
| 117 | + bool ClearProgress() override; |
| 118 | +}; |
| 119 | + |
| 120 | +} // namespace ServiceArea |
| 121 | + |
| 122 | +} // namespace Clusters |
| 123 | +} // namespace app |
| 124 | +} // namespace chip |
0 commit comments