| // iioservice/mojo/sensor.mojom-test-utils.h is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2019 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef IIOSERVICE_MOJO_SENSOR_MOJOM_TEST_UTILS_H_ |
| #define IIOSERVICE_MOJO_SENSOR_MOJOM_TEST_UTILS_H_ |
| |
| #include "iioservice/mojo/sensor.mojom.h" |
| |
| |
| namespace cros::mojom { |
| |
| |
| class SensorServiceInterceptorForTesting : public SensorService { |
| virtual SensorService* GetForwardingInterface() = 0; |
| void GetDeviceIds(DeviceType type, GetDeviceIdsCallback callback) override; |
| void GetAllDeviceIds(GetAllDeviceIdsCallback callback) override; |
| void GetDevice(int32_t iio_device_id, ::mojo::PendingReceiver<SensorDevice> device_request) override; |
| void RegisterNewDevicesObserver(::mojo::PendingRemote<SensorServiceNewDevicesObserver> observer) override; |
| }; |
| class SensorServiceAsyncWaiter { |
| public: |
| explicit SensorServiceAsyncWaiter(SensorService* proxy); |
| |
| SensorServiceAsyncWaiter(const SensorServiceAsyncWaiter&) = delete; |
| SensorServiceAsyncWaiter& operator=(const SensorServiceAsyncWaiter&) = delete; |
| |
| ~SensorServiceAsyncWaiter(); |
| void GetDeviceIds( |
| DeviceType type, std::vector<int32_t>* out_iio_device_ids); |
| std::vector<int32_t> GetDeviceIds(DeviceType type); |
| void GetAllDeviceIds( |
| base::flat_map<int32_t, std::vector<DeviceType>>* out_iio_device_ids_types); |
| base::flat_map<int32_t, std::vector<DeviceType>> GetAllDeviceIds(); |
| |
| private: |
| SensorService* const proxy_; |
| }; |
| |
| |
| class SensorDeviceInterceptorForTesting : public SensorDevice { |
| virtual SensorDevice* GetForwardingInterface() = 0; |
| void SetTimeout(uint32_t timeout) override; |
| void GetAttributes(const std::vector<std::string>& attr_names, GetAttributesCallback callback) override; |
| void SetFrequency(double frequency, SetFrequencyCallback callback) override; |
| void StartReadingSamples(::mojo::PendingRemote<SensorDeviceSamplesObserver> observer) override; |
| void StopReadingSamples() override; |
| void GetAllChannelIds(GetAllChannelIdsCallback callback) override; |
| void SetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices, bool en, SetChannelsEnabledCallback callback) override; |
| void GetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices, GetChannelsEnabledCallback callback) override; |
| void GetChannelsAttributes(const std::vector<int32_t>& iio_chn_indices, const std::string& attr_name, GetChannelsAttributesCallback callback) override; |
| void GetAllEvents(GetAllEventsCallback callback) override; |
| void GetEventsAttributes(const std::vector<int32_t>& iio_event_indices, const std::string& attr_name, GetEventsAttributesCallback callback) override; |
| void StartReadingEvents(const std::vector<int32_t>& iio_event_indices, ::mojo::PendingRemote<SensorDeviceEventsObserver> observer) override; |
| }; |
| class SensorDeviceAsyncWaiter { |
| public: |
| explicit SensorDeviceAsyncWaiter(SensorDevice* proxy); |
| |
| SensorDeviceAsyncWaiter(const SensorDeviceAsyncWaiter&) = delete; |
| SensorDeviceAsyncWaiter& operator=(const SensorDeviceAsyncWaiter&) = delete; |
| |
| ~SensorDeviceAsyncWaiter(); |
| void GetAttributes( |
| const std::vector<std::string>& attr_names, std::vector<std::optional<std::string>>* out_values); |
| std::vector<std::optional<std::string>> GetAttributes(const std::vector<std::string>& attr_names); |
| void SetFrequency( |
| double frequency, double* out_result_freq); |
| double SetFrequency(double frequency); |
| void GetAllChannelIds( |
| std::vector<std::string>* out_iio_chn_ids); |
| std::vector<std::string> GetAllChannelIds(); |
| void SetChannelsEnabled( |
| const std::vector<int32_t>& iio_chn_indices, bool en, std::vector<int32_t>* out_failed_indices); |
| std::vector<int32_t> SetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices, bool en); |
| void GetChannelsEnabled( |
| const std::vector<int32_t>& iio_chn_indices, std::vector<bool>* out_enabled); |
| std::vector<bool> GetChannelsEnabled(const std::vector<int32_t>& iio_chn_indices); |
| void GetChannelsAttributes( |
| const std::vector<int32_t>& iio_chn_indices, const std::string& attr_name, std::vector<std::optional<std::string>>* out_values); |
| std::vector<std::optional<std::string>> GetChannelsAttributes(const std::vector<int32_t>& iio_chn_indices, const std::string& attr_name); |
| void GetAllEvents( |
| std::vector<IioEventPtr>* out_iio_events); |
| std::vector<IioEventPtr> GetAllEvents(); |
| void GetEventsAttributes( |
| const std::vector<int32_t>& iio_event_indices, const std::string& attr_name, std::vector<std::optional<std::string>>* out_values); |
| std::vector<std::optional<std::string>> GetEventsAttributes(const std::vector<int32_t>& iio_event_indices, const std::string& attr_name); |
| |
| private: |
| SensorDevice* const proxy_; |
| }; |
| |
| |
| class SensorDeviceSamplesObserverInterceptorForTesting : public SensorDeviceSamplesObserver { |
| virtual SensorDeviceSamplesObserver* GetForwardingInterface() = 0; |
| void OnSampleUpdated(const base::flat_map<int32_t, int64_t>& sample) override; |
| void OnErrorOccurred(ObserverErrorType type) override; |
| }; |
| class SensorDeviceSamplesObserverAsyncWaiter { |
| public: |
| explicit SensorDeviceSamplesObserverAsyncWaiter(SensorDeviceSamplesObserver* proxy); |
| |
| SensorDeviceSamplesObserverAsyncWaiter(const SensorDeviceSamplesObserverAsyncWaiter&) = delete; |
| SensorDeviceSamplesObserverAsyncWaiter& operator=(const SensorDeviceSamplesObserverAsyncWaiter&) = delete; |
| |
| ~SensorDeviceSamplesObserverAsyncWaiter(); |
| |
| private: |
| SensorDeviceSamplesObserver* const proxy_; |
| }; |
| |
| |
| class SensorServiceNewDevicesObserverInterceptorForTesting : public SensorServiceNewDevicesObserver { |
| virtual SensorServiceNewDevicesObserver* GetForwardingInterface() = 0; |
| void OnNewDeviceAdded(int32_t iio_device_id, const std::vector<DeviceType>& types) override; |
| void OnDeviceRemoved(int32_t iio_device_id) override; |
| }; |
| class SensorServiceNewDevicesObserverAsyncWaiter { |
| public: |
| explicit SensorServiceNewDevicesObserverAsyncWaiter(SensorServiceNewDevicesObserver* proxy); |
| |
| SensorServiceNewDevicesObserverAsyncWaiter(const SensorServiceNewDevicesObserverAsyncWaiter&) = delete; |
| SensorServiceNewDevicesObserverAsyncWaiter& operator=(const SensorServiceNewDevicesObserverAsyncWaiter&) = delete; |
| |
| ~SensorServiceNewDevicesObserverAsyncWaiter(); |
| |
| private: |
| SensorServiceNewDevicesObserver* const proxy_; |
| }; |
| |
| |
| class SensorDeviceEventsObserverInterceptorForTesting : public SensorDeviceEventsObserver { |
| virtual SensorDeviceEventsObserver* GetForwardingInterface() = 0; |
| void OnEventUpdated(IioEventPtr iio_event) override; |
| void OnErrorOccurred(ObserverErrorType type) override; |
| }; |
| class SensorDeviceEventsObserverAsyncWaiter { |
| public: |
| explicit SensorDeviceEventsObserverAsyncWaiter(SensorDeviceEventsObserver* proxy); |
| |
| SensorDeviceEventsObserverAsyncWaiter(const SensorDeviceEventsObserverAsyncWaiter&) = delete; |
| SensorDeviceEventsObserverAsyncWaiter& operator=(const SensorDeviceEventsObserverAsyncWaiter&) = delete; |
| |
| ~SensorDeviceEventsObserverAsyncWaiter(); |
| |
| private: |
| SensorDeviceEventsObserver* const proxy_; |
| }; |
| |
| |
| |
| |
| } // cros::mojom |
| |
| #endif // IIOSERVICE_MOJO_SENSOR_MOJOM_TEST_UTILS_H_ |