Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 1 | /* |
Sandeep Patil | 526f8cf | 2016-11-01 16:41:56 -0700 | [diff] [blame^] | 2 | * Copyright (C) 2016 The Android Open Source Project |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 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 | |
| 17 | #define LOG_TAG "healthd" |
| 18 | #define KLOG_LEVEL 6 |
| 19 | |
Yabin Cui | e98e177 | 2016-02-17 12:21:34 -0800 | [diff] [blame] | 20 | #include <healthd/healthd.h> |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 21 | |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 22 | #include <stdio.h> |
| 23 | #include <stdlib.h> |
| 24 | #include <unistd.h> |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 25 | #include <cutils/klog.h> |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 26 | |
| 27 | using namespace android; |
| 28 | |
Sandeep Patil | 526f8cf | 2016-11-01 16:41:56 -0700 | [diff] [blame^] | 29 | // main healthd loop |
| 30 | extern int healthd_main(void); |
Todd Poynor | c7464c9 | 2013-09-10 12:40:00 -0700 | [diff] [blame] | 31 | |
| 32 | // Android mode |
| 33 | |
| 34 | extern void healthd_mode_android_init(struct healthd_config *config); |
| 35 | extern int healthd_mode_android_preparetowait(void); |
Sandeep Patil | 526f8cf | 2016-11-01 16:41:56 -0700 | [diff] [blame^] | 36 | extern void healthd_mode_android_heartbeat(void); |
Todd Poynor | c7464c9 | 2013-09-10 12:40:00 -0700 | [diff] [blame] | 37 | extern void healthd_mode_android_battery_update( |
| 38 | struct android::BatteryProperties *props); |
| 39 | |
Todd Poynor | c7464c9 | 2013-09-10 12:40:00 -0700 | [diff] [blame] | 40 | static struct healthd_mode_ops android_ops = { |
| 41 | .init = healthd_mode_android_init, |
| 42 | .preparetowait = healthd_mode_android_preparetowait, |
Sandeep Patil | 526f8cf | 2016-11-01 16:41:56 -0700 | [diff] [blame^] | 43 | .heartbeat = healthd_mode_android_heartbeat, |
Todd Poynor | c7464c9 | 2013-09-10 12:40:00 -0700 | [diff] [blame] | 44 | .battery_update = healthd_mode_android_battery_update, |
| 45 | }; |
| 46 | |
Sandeep Patil | 526f8cf | 2016-11-01 16:41:56 -0700 | [diff] [blame^] | 47 | int main(int /*argc*/, char ** /*argv*/) { |
Todd Poynor | fea5b4d | 2013-09-09 12:09:08 -0700 | [diff] [blame] | 48 | |
Todd Poynor | c7464c9 | 2013-09-10 12:40:00 -0700 | [diff] [blame] | 49 | healthd_mode_ops = &android_ops; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 50 | |
Sandeep Patil | 526f8cf | 2016-11-01 16:41:56 -0700 | [diff] [blame^] | 51 | return healthd_main(); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 52 | } |