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. 34 * 35 * @param instanceId The instance ID of the nanoapp whose request is being 36 * searched for. 37 * @param index A pointer to an index that is populated if a request for this 38 * nanoapp is found and the pointer is not null. 39 * @return A pointer to a SensorRequest that is owned by the provided 40 * nanoapp if one is found otherwise nullptr. 41 */ 42 const SensorRequest *findRequest(uint16_t instanceId, size_t *index) const; 43 }; 44 45 } // namespace chre 46 47 #endif // CHRE_CORE_SENSOR_REQUEST_MULTIPLEXER_H_