harald v0.1.1 Harald.ManufacturerData.Apple View Source

Serialization module for Apple.

iBeacon

Reference: https://en.wikipedia.org/wiki/IBeacon#Packet_Structure_Byte_Map

Link to this section Summary

Functions

iex> deserialize(<<2, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0, 2, 3>>)

{:ok, {"iBeacon", %{major: 1, minor: 2, tx_power: 3, uuid: 4}}}

Indicates iBeacon data

Length of the data following the length byte

iex> serialize({"iBeacon", %{major: 1, minor: 2, tx_power: 3, uuid: 4}})

{:ok, <<2, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0, 2, 3>>}

Link to this section Functions

iex> deserialize(<<2, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0, 2, 3>>)
{:ok, {"iBeacon", %{major: 1, minor: 2, tx_power: 3, uuid: 4}}}

Indicates iBeacon data.

Length of the data following the length byte.

iex> serialize({"iBeacon", %{major: 1, minor: 2, tx_power: 3, uuid: 4}})
{:ok, <<2, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0, 2, 3>>}

iex> serialize({"iBeacon", %{major: 1, minor: 2, tx_power: 3}})
:error

iex> serialize(:orange)
:error