# `ExCEP.Gateway.ReportScheduler`

Periodic and spontaneous `DataSpont` reporting engine for an Edge Gateway (Section 8.7 & 8.9).

Manages:
- Registered sub-devices (`device_id => model`)
- Live point values (`{device_id, service_id, data_refer} => %{value, angle, quality, timestamp}`)
- `ExCEP.Gateway.SubscriptionManager` rules
- Automatic periodic timers (`TransCot: "peroid"` per Table 112, or `"period"` when
  `legacy_trans_cot: false`)
- Immediate spontaneous uploads (`TransCot: "spont"`) whenever a subscribed point changes

# `apply_subscriptions`

```elixir
@spec apply_subscriptions(GenServer.server(), [map()]) :: [map()]
```

Applies a `DataSubs` `Subs` list and reschedules periodic timers.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `flush_periodic`

```elixir
@spec flush_periodic(GenServer.server(), String.t(), String.t()) :: :ok
```

Triggers an immediate periodic upload for `{device_id, service_id}` (useful in tests).

# `register_device`

```elixir
@spec register_device(GenServer.server(), String.t(), String.t()) :: :ok
```

Registers a sub-device instance with its model name.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

# `update_point`

```elixir
@spec update_point(
  GenServer.server(),
  String.t(),
  String.t(),
  String.t(),
  term(),
  keyword()
) :: :ok
```

Updates a data point value. If the point matches an active spontaneous subscription
and the value changed, immediately uploads a `DataSpont` (`TransCot: "spont"`) frame.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
