ContentLauncherManager.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 <app/AttributeAccessInterface.h>
  20. #include <app/clusters/content-launch-server/content-launch-server.h>
  21. #include <jni.h>
  22. #include <lib/core/CHIPError.h>
  23. using chip::CharSpan;
  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. class ContentLauncherManager : public ContentLauncherDelegate
  31. {
  32. public:
  33. static void NewManager(jint endpoint, jobject manager);
  34. void InitializeWithObjects(jobject managerObject);
  35. void HandleLaunchContent(CommandResponseHelper<LaunchResponseType> & helper,
  36. const chip::app::DataModel::DecodableList<ParameterType> & parameterList, bool autoplay,
  37. const CharSpan & data) override;
  38. void HandleLaunchUrl(CommandResponseHelper<LaunchResponseType> & helper, const CharSpan & contentUrl,
  39. const CharSpan & displayString, const BrandingInformationType & brandingInformation) override;
  40. CHIP_ERROR HandleGetAcceptHeaderList(AttributeValueEncoder & aEncoder) override;
  41. uint32_t HandleGetSupportedStreamingProtocols() override;
  42. uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
  43. private:
  44. jobject mContentLauncherManagerObject = nullptr;
  45. jmethodID mGetAcceptHeaderMethod = nullptr;
  46. jmethodID mGetSupportedStreamingProtocolsMethod = nullptr;
  47. jmethodID mLaunchContentMethod = nullptr;
  48. jmethodID mLaunchUrlMethod = nullptr;
  49. };