cluster-init.cpp 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. #include "application-basic/ApplicationBasicManager.h"
  19. #include "application-launcher/ApplicationLauncherManager.h"
  20. #include "audio-output/AudioOutputManager.h"
  21. #include "target-navigator/TargetNavigatorManager.h"
  22. #include <app-common/zap-generated/cluster-objects.h>
  23. #include <app-common/zap-generated/ids/Attributes.h>
  24. #include <app-common/zap-generated/ids/Clusters.h>
  25. #include <app/AttributeAccessInterface.h>
  26. #include <app/util/attribute-storage.h>
  27. using namespace chip;
  28. namespace {
  29. static ApplicationBasicManager applicationBasicManager;
  30. static ApplicationLauncherManager applicationLauncherManager;
  31. static AudioOutputManager audioOutputManager;
  32. static TargetNavigatorManager targetNavigatorManager;
  33. } // namespace
  34. /** @brief Application Basic Cluster Init
  35. *
  36. * This function is called when a specific cluster is initialized. It gives the
  37. * application an opportunity to take care of cluster initialization procedures.
  38. * It is called exactly once for each endpoint where cluster is present.
  39. *
  40. * @param endpoint Ver.: always
  41. *
  42. */
  43. void emberAfApplicationBasicClusterInitCallback(chip::EndpointId endpoint)
  44. {
  45. ChipLogProgress(Zcl, "TV Android App: ApplicationBasic::SetDefaultDelegate");
  46. chip::app::Clusters::ApplicationBasic::SetDefaultDelegate(endpoint, &applicationBasicManager);
  47. }
  48. /** @brief Application Launcher Cluster Init
  49. *
  50. * This function is called when a specific cluster is initialized. It gives the
  51. * application an opportunity to take care of cluster initialization procedures.
  52. * It is called exactly once for each endpoint where cluster is present.
  53. *
  54. * @param endpoint Ver.: always
  55. *
  56. */
  57. void emberAfApplicationLauncherClusterInitCallback(EndpointId endpoint)
  58. {
  59. ChipLogProgress(Zcl, "TV Android App: ApplicationLauncher::SetDefaultDelegate");
  60. chip::app::Clusters::ApplicationLauncher::SetDefaultDelegate(endpoint, &applicationLauncherManager);
  61. }
  62. /** @brief Audio Output Cluster Init
  63. *
  64. * This function is called when a specific cluster is initialized. It gives the
  65. * application an opportunity to take care of cluster initialization procedures.
  66. * It is called exactly once for each endpoint where cluster is present.
  67. *
  68. * @param endpoint Ver.: always
  69. *
  70. */
  71. void emberAfAudioOutputClusterInitCallback(EndpointId endpoint)
  72. {
  73. ChipLogProgress(Zcl, "TV Android App: AudioOutput::SetDefaultDelegate");
  74. chip::app::Clusters::AudioOutput::SetDefaultDelegate(endpoint, &audioOutputManager);
  75. }
  76. /** @brief Target Navigator Cluster Init
  77. *
  78. * This function is called when a specific cluster is initialized. It gives the
  79. * application an opportunity to take care of cluster initialization procedures.
  80. * It is called exactly once for each endpoint where cluster is present.
  81. *
  82. * @param endpoint Ver.: always
  83. *
  84. */
  85. void emberAfTargetNavigatorClusterInitCallback(EndpointId endpoint)
  86. {
  87. ChipLogProgress(Zcl, "TV Android App: TargetNavigator::SetDefaultDelegate");
  88. chip::app::Clusters::TargetNavigator::SetDefaultDelegate(endpoint, &targetNavigatorManager);
  89. }