ChannelManager.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 int16_t & count) override;
  36. uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
  37. private:
  38. jobject mChannelManagerObject = nullptr;
  39. jmethodID mGetChannelListMethod = nullptr;
  40. jmethodID mGetLineupMethod = nullptr;
  41. jmethodID mGetCurrentChannelMethod = nullptr;
  42. jmethodID mChangeChannelMethod = nullptr;
  43. jmethodID mChangeChannelByNumberMethod = nullptr;
  44. jmethodID mSkipChannelMethod = nullptr;
  45. // TODO: set this based upon meta data from app
  46. uint32_t mDynamicEndpointFeatureMap = 3;
  47. };