-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support communication with both SCU types (#751)
- Loading branch information
1 parent
6b3c844
commit f4d6c15
Showing
18 changed files
with
169 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
defmodule Engine.ConfigAPI do | ||
@callback sign_config(String.t()) :: Engine.Config.sign_config() | ||
@callback headway_config(String.t(), DateTime.t()) :: Engine.Config.Headway.t() | nil | ||
@callback scu_migrated?(String.t()) :: boolean() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,43 @@ | ||
defmodule PaEss.Updater do | ||
@callback update_sign(PaEss.text_id(), top_line, bottom_line, duration, start, sign_id) :: | ||
{:ok, :sent} | {:error, :bad_status} | {:error, :post_error} | ||
when top_line: Content.Message.t(), | ||
bottom_line: Content.Message.t(), | ||
duration: integer(), | ||
start: integer() | :now, | ||
sign_id: String.t() | ||
@behaviour PaEss.UpdaterAPI | ||
|
||
@callback send_audio(PaEss.audio_id(), audios, priority, timeout, sign_id, extra_logs) :: | ||
{:ok, :sent} | {:error, any()} | ||
when priority: integer(), | ||
timeout: integer(), | ||
audios: [Content.Audio.t()], | ||
sign_id: String.t(), | ||
extra_logs: list | ||
require Logger | ||
|
||
@impl true | ||
def set_background_message( | ||
%{ | ||
id: id, | ||
scu_id: scu_id, | ||
pa_ess_loc: pa_ess_loc, | ||
text_zone: text_zone, | ||
config_engine: config_engine | ||
}, | ||
top, | ||
bottom | ||
) do | ||
if config_engine.scu_migrated?(scu_id) do | ||
Logger.error("Error sending to new SCU, not implemented") | ||
else | ||
MessageQueue.update_sign({pa_ess_loc, text_zone}, top, bottom, 180, :now, id) | ||
end | ||
end | ||
|
||
@impl true | ||
def play_message( | ||
%{ | ||
id: id, | ||
scu_id: scu_id, | ||
pa_ess_loc: pa_ess_loc, | ||
audio_zones: audio_zones, | ||
config_engine: config_engine | ||
}, | ||
audios, | ||
extra_logs | ||
) do | ||
if config_engine.scu_migrated?(scu_id) do | ||
Logger.error("Error sending to new SCU, not implemented") | ||
else | ||
MessageQueue.send_audio({pa_ess_loc, audio_zones}, audios, 5, 60, id, extra_logs) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
defmodule PaEss.UpdaterAPI do | ||
@callback set_background_message( | ||
Signs.Realtime.t() | Signs.Bus.t(), | ||
Content.Message.value(), | ||
Content.Message.value() | ||
) :: :ok | ||
|
||
@callback play_message(Signs.Realtime.t() | Signs.Bus.t(), [Content.Audio.value()], [keyword()]) :: | ||
:ok | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.