| 1 | import type * as iotw from "@distilled.cloud/aws/iot-wireless"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `iotwireless:GetPositionEstimate` — resolve an |
| 7 | * estimated position (as a GeoJSON payload stream) from raw measurement |
| 8 | * data — WiFi access points, cell towers, GNSS scans, or an IP address — |
| 9 | * using third-party solvers, from a deployed Lambda or Task. Account-level: |
| 10 | * it is not tied to any registered device. |
| 11 | * |
| 12 | * ### Estimating a Position |
| 13 | * Provide the `GetPositionEstimateHttp` implementation layer on the |
| 14 | * Function effect, bind the capability in the init phase, then call the |
| 15 | * returned client at runtime. The `GeoJsonPayload` is a byte `Stream` — |
| 16 | * decode it with `Stream.mkString(Stream.decodeText(...))`. |
| 17 | * |
| 18 | * **Example:** Solve a Position from WiFi Scans |
| 19 | * ```typescript |
| 20 | * // init |
| 21 | * const estimate = yield* AWS.IoTWireless.GetPositionEstimate(); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const { GeoJsonPayload } = yield* estimate({ |
| 25 | * WiFiAccessPoints: [ |
| 26 | * { MacAddress: "A0:EC:F9:1E:32:C1", Rss: -66 }, |
| 27 | * { MacAddress: "A0:EC:F9:15:72:5E", Rss: -72 }, |
| 28 | * ], |
| 29 | * }); |
| 30 | * // on the Function effect: |
| 31 | * // .pipe(Effect.provide(AWS.IoTWireless.GetPositionEstimateHttp)) |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetPositionEstimate extends Binding.Service< |
| 37 | GetPositionEstimate, |
| 38 | "AWS.IoTWireless.GetPositionEstimate", |
| 39 | () => Effect.Effect< |
| 40 | ( |
| 41 | request: iotw.GetPositionEstimateRequest, |
| 42 | ) => Effect.Effect< |
| 43 | iotw.GetPositionEstimateResponse, |
| 44 | iotw.GetPositionEstimateError |
| 45 | > |
| 46 | > |
| 47 | > {} |
| 48 | export const GetPositionEstimate = Binding.Service<GetPositionEstimate>( |
| 49 | "AWS.IoTWireless.GetPositionEstimate", |
| 50 | ); |