Class ProxyDeviceService
- Namespace
- adas_core.module.ProxyDevices.Services
- Assembly
- adas-core.module.ProxyDevices.dll
ProxyDeviceService is responsible for managing proxy devices, processing requests, and streaming data from the devices. It uses a cache to store device instances for efficient retrieval and ensures that only enabled devices are processed. The service handles HTTP requests and returns appropriate responses based on the device's availability and functionality.
public class ProxyDeviceService : IProxyDeviceService
- Inheritance
-
ProxyDeviceService
- Implements
- Inherited Members
- Extension Methods
Constructors
ProxyDeviceService(IOptions<ProxyDeviceSettings>)
ProxyDeviceService is responsible for managing proxy devices, processing requests, and streaming data from the devices. It uses a cache to store device instances for efficient retrieval and ensures that only enabled devices are processed. The service handles HTTP requests and returns appropriate responses based on the device's availability and functionality.
public ProxyDeviceService(IOptions<ProxyDeviceSettings> settings)
Parameters
settingsIOptions<ProxyDeviceSettings>The settings for the proxy devices, including their configuration and parameters.
Methods
Process(string)
Process method takes a deviceId as input, retrieves the corresponding device from the cache or creates a new instance if it doesn't exist, and then calls the Process method of the device. It returns an HttpResponseMessage based on the outcome of the operation, handling any exceptions that may occur during the process.
public Task<HttpResponseMessage> Process(string deviceId)
Parameters
deviceIdstringThe unique identifier of the proxy device to be processed.
Returns
- Task<HttpResponseMessage>
A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Process method.
Stream(string)
Stream method takes a deviceId as input, retrieves the corresponding device from the cache or creates a new instance if it doesn't exist, and then calls the Stream method of the device.
public Task<HttpResponseMessage> Stream(string deviceId)
Parameters
deviceIdstringThe unique identifier of the proxy device to be streamed.
Returns
- Task<HttpResponseMessage>
A task that represents the asynchronous operation. The task result contains the HttpResponseMessage returned by the device's Stream method.