osc v0.1.2 OSC

Summary

Functions

Decode OSC to a value.

iex> OSC.decode(<<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>)
{:ok, %OSC.Message{address: "/foo", arguments: ["hello"]}}

Decode OSC to a value, raises an exception on error.

iex> OSC.decode!(<<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>)
%OSC.Message{address: "/foo", arguments: ["hello"]}

Encode a value to OSC.

iex> OSC.encode(%OSC.Message{address: "/foo", arguments: ["hello"]})
{:ok, <<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>}

Encode a value to OSC, raises an exception on error.

iex> OSC.encode!(%OSC.Message{address: "/foo", arguments: ["hello"]})
<<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>

Encode a value to OSC as iodata.

iex> OSC.encode(%OSC.Message{address: "/foo", arguments: ["hello"]})
{:ok, [["/foo", 0, 0, 0, 0], [',s', 0, 0], [["hello", 0, 0, 0]]]}

Encode a value to OSC as iodata, raises an exception on error.

iex> OSC.encode_to_iodata!(%OSC.Message{address: "/foo", arguments: ["hello"]})
[["/foo", 0, 0, 0, 0], [',s', 0, 0], [["hello", 0, 0, 0]]]

Functions

decode(iodata, options \\ [])
decode(iodata, Keyword.t) ::
  {:ok, OSC.Parser.t} |
  {:error, :invalid} |
  {:error, {:invalid, String.t}}

Decode OSC to a value.

iex> OSC.decode(<<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>)
{:ok, %OSC.Message{address: "/foo", arguments: ["hello"]}}
decode!(iodata, options \\ [])
decode!(iodata, Keyword.t) :: OSC.Parser.t | no_return

Decode OSC to a value, raises an exception on error.

iex> OSC.decode!(<<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>)
%OSC.Message{address: "/foo", arguments: ["hello"]}
encode(value, options \\ [])
encode(OSC.Encoder.t, Keyword.t) ::
  {:ok, iodata} |
  {:ok, String.t} |
  {:error, {:invalid, any}}

Encode a value to OSC.

iex> OSC.encode(%OSC.Message{address: "/foo", arguments: ["hello"]})
{:ok, <<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>}
encode!(value, options \\ [])
encode!(OSC.Encoder.t, Keyword.t) :: iodata | no_return

Encode a value to OSC, raises an exception on error.

iex> OSC.encode!(%OSC.Message{address: "/foo", arguments: ["hello"]})
<<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>
encode_to_iodata(value, options \\ [])
encode_to_iodata(OSC.Encoder.t, Keyword.t) ::
  {:ok, iodata} |
  {:error, {:invalid, any}}

Encode a value to OSC as iodata.

iex> OSC.encode(%OSC.Message{address: "/foo", arguments: ["hello"]})
{:ok, [["/foo", 0, 0, 0, 0], [',s', 0, 0], [["hello", 0, 0, 0]]]}
encode_to_iodata!(value, options \\ [])
encode_to_iodata!(OSC.Encoder.t, Keyword.t) ::
  iodata |
  no_return

Encode a value to OSC as iodata, raises an exception on error.

iex> OSC.encode_to_iodata!(%OSC.Message{address: "/foo", arguments: ["hello"]})
[["/foo", 0, 0, 0, 0], [',s', 0, 0], [["hello", 0, 0, 0]]]