healthd_mode_charger_nops.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2019 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include "healthd_mode_charger_nops.h"
  17. #include <health2/Health.h>
  18. #include <healthd/healthd.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. using namespace android;
  22. // main healthd loop
  23. extern int healthd_main(void);
  24. // NOPs for modes that need no special action
  25. static void healthd_mode_nop_init(struct healthd_config* config);
  26. static int healthd_mode_nop_preparetowait(void);
  27. static void healthd_mode_nop_heartbeat(void);
  28. static void healthd_mode_nop_battery_update(struct android::BatteryProperties* props);
  29. static struct healthd_mode_ops healthd_nops = {
  30. .init = healthd_mode_nop_init,
  31. .preparetowait = healthd_mode_nop_preparetowait,
  32. .heartbeat = healthd_mode_nop_heartbeat,
  33. .battery_update = healthd_mode_nop_battery_update,
  34. };
  35. static void healthd_mode_nop_init(struct healthd_config* config) {
  36. using android::hardware::health::V2_0::implementation::Health;
  37. Health::initInstance(config);
  38. }
  39. static int healthd_mode_nop_preparetowait(void) {
  40. return -1;
  41. }
  42. static void healthd_mode_nop_heartbeat(void) {}
  43. static void healthd_mode_nop_battery_update(struct android::BatteryProperties* /*props*/) {}
  44. int healthd_charger_nops(int /* argc */, char** /* argv */) {
  45. healthd_mode_ops = &healthd_nops;
  46. return healthd_main();
  47. }