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-common/zap-generated/af-structs.h>
  20. #include <app/AttributeAccessInterface.h>
  21. #include <app/clusters/content-launch-server/content-launch-server.h>
  22. #include <jni.h>
  23. #include <lib/core/CHIPError.h>
  24. using chip::CharSpan;
  25. using chip::app::AttributeValueEncoder;
  26. using chip::app::CommandResponseHelper;
  27. using ContentLauncherDelegate = chip::app::Clusters::ContentLauncher::Delegate;
  28. using LaunchResponseType = chip::app::Clusters::ContentLauncher::Commands::LaunchResponse::Type;
  29. using ParameterType = chip::app::Clusters::ContentLauncher::Structs::Parameter::DecodableType;
  30. using BrandingInformationType = chip::app::Clusters::ContentLauncher::Structs::BrandingInformation::Type;
  31. class ContentLauncherManager : public ContentLauncherDelegate
  32. {
  33. public:
  34. static void NewManager(jint endpoint, jobject manager);
  35. void InitializeWithObjects(jobject managerObject);
  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. private:
  44. jobject mContentLauncherManagerObject = nullptr;
  45. jmethodID mGetAcceptHeaderMethod = nullptr;
  46. jmethodID mGetSupportedStreamingProtocolsMethod = nullptr;
  47. jmethodID mLaunchContentMethod = nullptr;
  48. jmethodID mLaunchUrlMethod = nullptr;
  49. };