2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef HUMANACTIVITYMONITOR_HUMANACTIVITYMONITOR_MANAGER_H
18 #define HUMANACTIVITYMONITOR_HUMANACTIVITYMONITOR_MANAGER_H
22 #include <gesture_recognition.h>
23 #include <location_batch.h>
26 #include "common/picojson.h"
27 #include "common/platform_result.h"
30 namespace humanactivitymonitor {
33 const std::string kActivityTypePedometer = "PEDOMETER";
34 const std::string kActivityTypeWristUp = "WRIST_UP";
35 const std::string kActivityTypeHrm = "HRM";
36 const std::string kActivityTypeGps = "GPS";
39 typedef std::function<void(picojson::value*)> JsonCallback;
41 class HumanActivityMonitorManager {
43 HumanActivityMonitorManager();
44 virtual ~HumanActivityMonitorManager();
46 common::PlatformResult Init();
48 common::PlatformResult SetListener(const std::string& type,
49 JsonCallback callback);
50 common::PlatformResult UnsetListener(const std::string& type);
52 common::PlatformResult GetHumanActivityData(const std::string& type,
53 picojson::value* data);
57 common::PlatformResult IsSupported(const std::string& type);
59 common::PlatformResult SetWristUpListener(JsonCallback callback);
60 common::PlatformResult UnsetWristUpListener();
61 static void OnWristUpEvent(gesture_type_e gesture,
62 const gesture_data_h data,
64 gesture_error_e error,
67 common::PlatformResult SetHrmListener(JsonCallback callback);
68 common::PlatformResult UnsetHrmListener();
69 static void OnHrmSensorEvent(sensor_h sensor,
70 sensor_event_s *event,
72 common::PlatformResult GetHrmData(picojson::value* data);
74 common::PlatformResult SetGpsListener(JsonCallback callback);
75 common::PlatformResult UnsetGpsListener();
76 static void OnGpsEvent(int num_of_location, void *user_data);
77 common::PlatformResult GetGpsData(picojson::value* data);
80 std::map<std::string, bool> supported_;
82 gesture_h gesture_handle_;
83 JsonCallback wrist_up_event_callback_;
85 sensor_listener_h hrm_sensor_listener_;
86 JsonCallback hrm_event_callback_;
88 location_manager_h location_handle_;
89 JsonCallback gps_event_callback_;
92 } // namespace humanactivitymonitor
93 } // namespace extension
95 #endif // HUMANACTIVITYMONITOR_HUMANACTIVITYMONITOR_MANAGER_H