SCRC v0.5.1 Scrc.Server View Source

Server implements boilerplate code for implementing an SCRC Server. It forwards the domain specific calls to it’s simulation.

Link to this section Summary

Types

Endpoint consists of a hostname (or IP) and port combination

A hostname or IP Address

A TCP Port number (0-65535)

Functions

Returns a specification to start this module under a supervisor

Initialize the server with the given simulation. Listen on port

Send identified payload to client

Send restart payload to client

Send sensor payload to client

Send shutdown payload to client

Link to this section Types

Endpoint consists of a hostname (or IP) and port combination.

Link to this type endpoint_host() View Source
endpoint_host() :: String.t()

A hostname or IP Address.

Link to this type endpoint_port() View Source
endpoint_port() :: integer()

A TCP Port number (0-65535)

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function init(map) View Source
init(%{simulation: pid(), port: endpoint_port()}) ::
  {:ok, %{simulation: pid(), socket: any(), endpoint: endpoint()}}

Initialize the server with the given simulation. Listen on port.

Link to this function send_identified(server) View Source
send_identified(pid()) :: :ok

Send identified payload to client.

Link to this function send_restart(server) View Source
send_restart(pid()) :: :ok

Send restart payload to client.

Link to this function send_sensor_data(server, sensor_data) View Source
send_sensor_data(pid(), Scrc.SensorData.t()) :: :ok

Send sensor payload to client.

Link to this function send_shutdown(server) View Source
send_shutdown(pid()) :: :ok

Send shutdown payload to client.

Link to this function start_link(state, opts \\ []) View Source