AppContentLauncherManager.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. *
  3. * Copyright (c) 2021 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. #pragma once
  19. #include "../../java/ContentAppAttributeDelegate.h"
  20. #include <app-common/zap-generated/attributes/Accessors.h>
  21. #include <app/clusters/content-launch-server/content-launch-server.h>
  22. using chip::CharSpan;
  23. using chip::EndpointId;
  24. using chip::app::AttributeValueEncoder;
  25. using chip::app::CommandResponseHelper;
  26. using ContentLauncherDelegate = chip::app::Clusters::ContentLauncher::Delegate;
  27. using LaunchResponseType = chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Type;
  28. using ParameterType = chip::app::Clusters::ContentLauncher::Structs::ParameterStruct::DecodableType;
  29. using BrandingInformationType = chip::app::Clusters::ContentLauncher::Structs::BrandingInformationStruct::Type;
  30. using ContentAppAttributeDelegate = chip::AppPlatform::ContentAppAttributeDelegate;
  31. class AppContentLauncherManager : public ContentLauncherDelegate
  32. {
  33. public:
  34. AppContentLauncherManager(ContentAppAttributeDelegate * attributeDelegate, std::list<std::string> acceptHeaderList,
  35. uint32_t supportedStreamingProtocols);
  36. void HandleLaunchContent(CommandResponseHelper<LaunchResponseType> & helper,
  37. const chip::app::DataModel::DecodableList<ParameterType> & parameterList, bool autoplay,
  38. const CharSpan & data) override;
  39. void HandleLaunchUrl(CommandResponseHelper<LaunchResponseType> & helper, const CharSpan & contentUrl,
  40. const CharSpan & displayString, const BrandingInformationType & brandingInformation) override;
  41. CHIP_ERROR HandleGetAcceptHeaderList(AttributeValueEncoder & aEncoder) override;
  42. uint32_t HandleGetSupportedStreamingProtocols() override;
  43. void SetEndpointId(EndpointId epId) { mEndpointId = epId; };
  44. uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
  45. protected:
  46. std::list<std::string> mAcceptHeaderList;
  47. uint32_t mSupportedStreamingProtocols;
  48. private:
  49. EndpointId mEndpointId;
  50. // TODO: set this based upon meta data from app
  51. uint32_t mDynamicEndpointFeatureMap = 3;
  52. ContentAppAttributeDelegate * mAttributeDelegate;
  53. };