Ibus protocol helper v0.1.0 ExIbus.Message View Source
A struct that keeps information about Ibus Message
It contains 3 main fields:
:src
- message source:dst
- message destination (receiver):msg
- message content
Module also contain several functions to operate with a message
Link to this section Summary
Functions
Will try to create a new ExIbus.Message.t
from given raw binary message
Create a raw binary message with length byte and last XOR byte as well
Check if given raw message is valid Ibus message
Link to this section Types
Link to this type
t()
View Source
t() :: %ExIbus.Message{dst: binary(), msg: binary(), src: binary()}
Link to this section Functions
Link to this function
parse(raw)
View Source
parse(binary()) :: {:ok, ExIbus.Message.t()} | {:error, term()}
Will try to create a new ExIbus.Message.t
from given raw binary message
Create a raw binary message with length byte and last XOR byte as well.
Example:
iex(1)> ExIbus.Message.raw(%ExIbus.Message{src: <<0x68>>, dst: <<0x18>>, msg: <<0x0A, 0x00>>})
<<104, 4, 24, 10, 0, 126>>
This message should be sent into Ibus can and will be normally received by car
Check if given raw message is valid Ibus message
Function is really usefull for scanning Ibus can from car.