ChannelManager.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. *
  3. * Copyright (c) 2021 Project CHIP Authors
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #pragma once
  18. #include <app/clusters/channel-server/channel-server.h>
  19. #include <jni.h>
  20. using chip::CharSpan;
  21. using chip::app::AttributeValueEncoder;
  22. using chip::app::CommandResponseHelper;
  23. using ChannelDelegate = chip::app::Clusters::Channel::Delegate;
  24. using ChangeChannelResponseType = chip::app::Clusters::Channel::Commands::ChangeChannelResponse::Type;
  25. class ChannelManager : public ChannelDelegate
  26. {
  27. public:
  28. static void NewManager(jint endpoint, jobject manager);
  29. void InitializeWithObjects(jobject managerObject);
  30. CHIP_ERROR HandleGetChannelList(AttributeValueEncoder & aEncoder) override;
  31. CHIP_ERROR HandleGetLineup(AttributeValueEncoder & aEncoder) override;
  32. CHIP_ERROR HandleGetCurrentChannel(AttributeValueEncoder & aEncoder) override;
  33. void HandleChangeChannel(CommandResponseHelper<ChangeChannelResponseType> & helper, const CharSpan & match) override;
  34. bool HandleChangeChannelByNumber(const uint16_t & majorNumber, const uint16_t & minorNumber) override;
  35. bool HandleSkipChannel(const uint16_t & count) override;
  36. private:
  37. jobject mChannelManagerObject = nullptr;
  38. jmethodID mGetChannelListMethod = nullptr;
  39. jmethodID mGetLineupMethod = nullptr;
  40. jmethodID mGetCurrentChannelMethod = nullptr;
  41. jmethodID mChangeChannelMethod = nullptr;
  42. jmethodID mChangeChannelByNumberMethod = nullptr;
  43. jmethodID mSkipChannelMethod = nullptr;
  44. };