• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 #ifndef CHRE_CORE_SENSOR_REQUEST_MULTIPLEXER_H_
18 #define CHRE_CORE_SENSOR_REQUEST_MULTIPLEXER_H_
19 
20 #include "chre/core/request_multiplexer.h"
21 #include "chre/core/sensor_request.h"
22 
23 namespace chre {
24 
25 /**
26  * Provides methods on top of the RequestMultiplexer class specific for working
27  * with SensorRequest objects.
28  */
29 class SensorRequestMultiplexer : public RequestMultiplexer<SensorRequest> {
30  public:
31   /**
32    * Searches through the list of sensor requests for a request owned by the
33    * given nanoapp. The provided non-null index pointer is populated with the
34    * index of the request if it is found.
35    *
36    * @param instanceId The instance ID of the nanoapp whose request is being
37    *        searched for.
38    * @param index A non-null pointer to an index that is populated if a
39    *        request for this nanoapp is found.
40    * @return A pointer to a SensorRequest that is owned by the provided
41    *         nanoapp if one is found otherwise nullptr.
42    */
43   const SensorRequest *findRequest(uint32_t instanceId, size_t *index) const;
44 };
45 
46 }  // namespace chre
47 
48 #endif  // CHRE_CORE_SENSOR_REQUEST_MULTIPLEXER_H_