Grizzly.Transport behaviour (grizzly v0.15.6) View Source

Behaviour and functions for communicating to zipgateway

Link to this section Summary

Types

After starting a server options can be passed back to the caller so that the caller can do any other work it might seem fit.

t()

Functions

Accept a new connection

Get the assign value for the field

Update the assigns with this field and value

Preform the handshake

Listen using a transport

Open the transport

Parse the response for the transport

Send binary data using a transport

Link to this section Types

Specs

args() :: [ip_address: :inet.ip_address(), port: :inet.port_number()]

Specs

listen_option() :: {:strategy, :none | :accept}

After starting a server options can be passed back to the caller so that the caller can do any other work it might seem fit.

Options:

    • :strategy - this informs the caller if the transport needs to wait for connects to accept or if the socket can just process incoming messages. If the strategy is :accept that is to mean the socket is okay to start accepting new connections.

Specs

socket() :: :ssl.sslsocket() | :inet.socket()

Specs

t()

Link to this section Functions

Specs

accept(t()) :: {:ok, t()} | {:error, any()}

Accept a new connection

Link to this function

assign(transport, assign, default \\ nil)

View Source

Specs

assign(t(), atom(), any()) :: any()

Get the assign value for the field

Link to this function

assigns(transport, assign, assign_value)

View Source

Specs

assigns(t(), atom(), any()) :: t()

Update the assigns with this field and value

Specs

handshake(t()) :: {:ok, t()} | {:error, any()}

Preform the handshake

Specs

listen(t()) :: {:ok, t(), [listen_option()]} | {:error, any()}

Listen using a transport

Link to this function

new(impl, assigns \\ %{})

View Source

Specs

new(module(), map()) :: t()

Make a new Grizzly.Transport

If need to optionally assign some priv data you can map that into this function.

Link to this function

open(transport_module, args)

View Source

Specs

open(module(), args()) :: {:ok, t()} | {:error, :timeout}

Open the transport

Link to this function

parse_response(transport, response)

View Source

Specs

parse_response(t(), any()) ::
  {:ok, Grizzly.Transport.Response.t()}
  | {:error, Grizzly.ZWave.DecodeError.t()}

Parse the response for the transport

Link to this function

send(transport, binary, opts \\ [])

View Source

Specs

send(t(), binary(), keyword()) :: :ok

Send binary data using a transport

Link to this section Callbacks

Specs

accept(t()) :: {:ok, t()} | {:error, any()}

Specs

close(t()) :: :ok

Specs

handshake(t()) :: {:ok, t()} | {:error, any()}

Specs

listen(t()) :: {:ok, t(), [listen_option()]} | {:error, any()}

Specs

open(keyword()) :: {:ok, t()} | {:error, :timeout}

Specs

parse_response(any()) ::
  {:ok, Grizzly.Transport.Response.t()}
  | {:error, Grizzly.ZWave.DecodeError.t()}
Link to this callback

send(t, binary, keyword)

View Source

Specs

send(t(), binary(), keyword()) :: :ok