ExCEP.Gateway.ReportScheduler (ex_cep v0.1.1)

Copy Markdown

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

Summary

Functions

Applies a DataSubs Subs list and reschedules periodic timers.

Returns a specification to start this module under a supervisor.

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

Registers a sub-device instance with its model name.

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

Functions

apply_subscriptions(sched, subs_list)

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

Applies a DataSubs Subs list and reschedules periodic timers.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

flush_periodic(sched, device_id, service_id)

@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(sched, device_id, model)

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

Registers a sub-device instance with its model name.

start_link(opts)

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

update_point(sched, device_id, service_id, data_refer, value, opts \\ [])

@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.