Packages
smppex
2.2.8
3.3.0
3.2.4
3.2.3
3.2.2
3.2.1
3.2.0
retired
3.1.0
retired
3.0.6
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.4.0
2.3.3
2.3.2
2.3.1
2.3.0
2.2.9
2.2.8
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.0
2.0.1
2.0.0
1.0.1
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
SMPP 3.4 protocol and framework implemented in Elixir
Current section
Files
Jump to
Current section
Files
lib/smppex/pdu/network_error_code.ex
defmodule SMPPEX.Pdu.NetworkErrorCode do
@moduledoc """
Module for operating with `deliver_sm` network_error_code parameter.
"""
@type type_code :: pos_integer()
@type error_code :: pos_integer()
@type network_error_code :: <<_::24>>
@spec encode(type_code, error_code) :: network_error_code
@doc """
Converts network_error_code type and error to octet string
## Example
iex(1)> SMPPEX.Pdu.NetworkErrorCode.encode(8,1)
<<08,00,01>>
"""
def encode(type_code, error_code) when type_code < 256 and error_code < 65_536 do
<<type_code::size(8), error_code::size(16)>>
end
@spec decode(network_error_code) :: {type_code, error_code}
@doc """
Converts octet_string from network_error_code tag to type_code and error_value
## Example
iex(1)> SMPPEX.Pdu.NetworkErrorCode.decode(<<08,00,01>>)
{8, 1}
"""
def decode(<<type_code::size(8), error_code::size(16)>>) do
{type_code, error_code}
end
end