1/*
2 * Copyright (C) 2017 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
17#ifndef CHRE_PLATFORM_SLPI_SMGR_SMGR_CLIENT_H_
18#define CHRE_PLATFORM_SLPI_SMGR_SMGR_CLIENT_H_
19
20#include "chre/platform/slpi/smgr/smr_helper.h"
21#include "chre/util/singleton.h"
22
23/**
24 * @file
25 * Exposes the SMR helper and SMGR (non-internal) client handle used by the
26 * platform sensor implementation, for use in other modules.
27 */
28
29namespace chre {
30
31//! A singleton instance of SmrHelper that can be used for making synchronous
32//! sensor requests while remaining in micro-image. This must only be used from
33//! the CHRE thread.
34typedef Singleton<SmrHelper> SmrHelperSingleton;
35
36/**
37 * Convenience method for fetching the SMR helper singleton instance. Must only
38 * be used from the CHRE thread.
39 */
40inline SmrHelper *getSmrHelper() {
41  return SmrHelperSingleton::get();
42}
43
44/**
45 * @return The SMR client handle to the SMGR (non-internal) API, created by the
46 *         SLPI platform-specific sensors implementation
47 */
48smr_client_hndl getSensorServiceSmrClientHandle();
49
50}  // namespace chre
51
52#endif  // CHRE_PLATFORM_SLPI_SMGR_SMGR_CLIENT_H_
53