ApplicationLauncherManager.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 "ApplicationLauncherManager.h"
  19. using namespace std;
  20. using namespace chip::app;
  21. using namespace chip::app::Clusters;
  22. using namespace chip::app::Clusters::ApplicationLauncher;
  23. using namespace chip::Uint8;
  24. CHIP_ERROR ApplicationLauncherManager::HandleGetCatalogList(AttributeValueEncoder & aEncoder)
  25. {
  26. std::list<uint16_t> catalogList = { 123, 456 };
  27. return aEncoder.EncodeList([catalogList](const auto & encoder) -> CHIP_ERROR {
  28. for (const auto & catalog : catalogList)
  29. {
  30. ReturnErrorOnFailure(encoder.Encode(catalog));
  31. }
  32. return CHIP_NO_ERROR;
  33. });
  34. }
  35. void ApplicationLauncherManager::HandleLaunchApp(CommandResponseHelper<LauncherResponseType> & helper, const ByteSpan & data,
  36. const ApplicationType & application)
  37. {
  38. ChipLogProgress(Zcl, "ApplicationLauncherManager::HandleLaunchApp");
  39. // TODO: Insert code here
  40. LauncherResponseType response;
  41. const char * buf = "data";
  42. response.data.SetValue(ByteSpan(from_const_char(buf), strlen(buf)));
  43. response.status = ApplicationLauncherStatusEnum::kSuccess;
  44. helper.Success(response);
  45. }
  46. void ApplicationLauncherManager::HandleStopApp(CommandResponseHelper<LauncherResponseType> & helper,
  47. const ApplicationType & application)
  48. {
  49. ChipLogProgress(Zcl, "ApplicationLauncherManager::HandleStopApp");
  50. // TODO: Insert code here
  51. LauncherResponseType response;
  52. const char * buf = "data";
  53. response.data.SetValue(ByteSpan(from_const_char(buf), strlen(buf)));
  54. response.status = ApplicationLauncherStatusEnum::kSuccess;
  55. helper.Success(response);
  56. }
  57. void ApplicationLauncherManager::HandleHideApp(CommandResponseHelper<LauncherResponseType> & helper,
  58. const ApplicationType & application)
  59. {
  60. ChipLogProgress(Zcl, "ApplicationLauncherManager::HandleHideApp");
  61. // TODO: Insert code here
  62. LauncherResponseType response;
  63. const char * buf = "data";
  64. response.data.SetValue(ByteSpan(from_const_char(buf), strlen(buf)));
  65. response.status = ApplicationLauncherStatusEnum::kSuccess;
  66. helper.Success(response);
  67. }