ExCEP. Common. Types
(ex_cep v0.1.1)
Copy Markdown
Shared protocol enumerations and helpers defined in CSG CEP TS2.2.
Summary
Functions
Formats a CRC32 integer as protocol hex string, e.g. "0x12345678".
Cause of Transmission (Head/Cot, Table 2)
Control command types (CtrlCmd, Table 122)
Encodes data quality ("00" = valid & not substituted; digit 1: 0 valid / 1 invalid;
digit 2: 0 not substituted / 1 substituted).
Generates a unique message ID (Head/Mid).
Generates a CmdId / SetId within protocol range 0..4294967295.
Parses a protocol CRC32 hex string ("0x12345678") to integer.
Types
@type cot() :: :request | :response | :periodic | :spontaneous | :confirm | String.t()
@type ctrl_type() ::
:yk_select
| :yk_execute
| :yk_cancel
| :yt_select
| :yt_execute
| :yt_cancel
| :yk_direct
| :yt_direct
Functions
Formats a CRC32 integer as protocol hex string, e.g. "0x12345678".
Cause of Transmission (Head/Cot, Table 2):
"1"(:request) - 主动请求"2"(:response) - 应答请求"3"(:periodic) - 周期上送"4"(:spontaneous) - 变化上送"5"(:confirm) - 主动确认
Control command types (CtrlCmd, Table 122):
"0"(:yk_select) - 遥控选择"1"(:yk_execute) - 遥控执行"2"(:yk_cancel) - 遥控取消"3"(:yt_select) - 遥调选择"4"(:yt_execute) - 遥调执行"5"(:yt_cancel) - 遥调取消"6"(:yk_direct) - 遥控直接控制"7"(:yt_direct) - 遥调直接控制
Encodes data quality ("00" = valid & not substituted; digit 1: 0 valid / 1 invalid;
digit 2: 0 not substituted / 1 substituted).
@spec next_mid() :: String.t()
Generates a unique message ID (Head/Mid).
@spec next_uint32_id() :: String.t()
Generates a CmdId / SetId within protocol range 0..4294967295.
@spec parse_crc32_hex(term()) :: {:ok, non_neg_integer()} | {:error, :invalid_crc}
Parses a protocol CRC32 hex string ("0x12345678") to integer.