feat: Working on sensor client dependency

This commit is contained in:
2024-11-10 22:27:59 -05:00
parent 10294801fc
commit f68ac528e4
2 changed files with 25 additions and 15 deletions

View File

@@ -12,9 +12,9 @@ import ServiceLifecycle
@DependencyClient
public struct SensorsClient: Sendable {
public var listen: @Sendable (_ topics: [String]) async throws -> AsyncStream<MQTTPublishInfo>
public var listen: @Sendable ([String]) async throws -> AsyncStream<MQTTPublishInfo>
public var logger: Logger?
public var publish: @Sendable (_ value: Double, _ topic: String) async throws -> Void
public var publish: @Sendable (Double, String) async throws -> Void
public var shutdown: @Sendable () -> Void = {}
public func listen(to topics: [String]) async throws -> AsyncStream<MQTTPublishInfo> {
@@ -45,7 +45,9 @@ public actor SensorsService2: Service {
private var sensors: [TemperatureAndHumiditySensor]
public init(sensors: [TemperatureAndHumiditySensor]) {
public init(
sensors: [TemperatureAndHumiditySensor]
) {
self.sensors = sensors
}