blob: 1ec8c2d8c994183057bead3eb1d1ec2f2dd785e9 [file] [log] [blame]
Todd Poynor752faf22013-06-12 13:25:59 -07001/*
Sandeep Patil526f8cf2016-11-01 16:41:56 -07002 * Copyright (C) 2016 The Android Open Source Project
Todd Poynor752faf22013-06-12 13:25:59 -07003 *
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 Cuie98e1772016-02-17 12:21:34 -080020#include <healthd/healthd.h>
Todd Poynor752faf22013-06-12 13:25:59 -070021
Todd Poynor752faf22013-06-12 13:25:59 -070022#include <stdio.h>
23#include <stdlib.h>
24#include <unistd.h>
Todd Poynor752faf22013-06-12 13:25:59 -070025#include <cutils/klog.h>
Todd Poynor752faf22013-06-12 13:25:59 -070026
27using namespace android;
28
Sandeep Patil526f8cf2016-11-01 16:41:56 -070029// main healthd loop
30extern int healthd_main(void);
Todd Poynorc7464c92013-09-10 12:40:00 -070031
32// Android mode
33
34extern void healthd_mode_android_init(struct healthd_config *config);
35extern int healthd_mode_android_preparetowait(void);
Sandeep Patil526f8cf2016-11-01 16:41:56 -070036extern void healthd_mode_android_heartbeat(void);
Todd Poynorc7464c92013-09-10 12:40:00 -070037extern void healthd_mode_android_battery_update(
38 struct android::BatteryProperties *props);
39
Todd Poynorc7464c92013-09-10 12:40:00 -070040static struct healthd_mode_ops android_ops = {
41 .init = healthd_mode_android_init,
42 .preparetowait = healthd_mode_android_preparetowait,
Sandeep Patil526f8cf2016-11-01 16:41:56 -070043 .heartbeat = healthd_mode_android_heartbeat,
Todd Poynorc7464c92013-09-10 12:40:00 -070044 .battery_update = healthd_mode_android_battery_update,
45};
46
Sandeep Patil526f8cf2016-11-01 16:41:56 -070047int main(int /*argc*/, char ** /*argv*/) {
Todd Poynorfea5b4d2013-09-09 12:09:08 -070048
Todd Poynorc7464c92013-09-10 12:40:00 -070049 healthd_mode_ops = &android_ops;
Todd Poynor752faf22013-06-12 13:25:59 -070050
Sandeep Patil526f8cf2016-11-01 16:41:56 -070051 return healthd_main();
Todd Poynor752faf22013-06-12 13:25:59 -070052}