Documentation ¶
Overview ¶
Package pdumode provides functions to encode and decode PDU mode frames exchanged with a GSM modem in PDU mode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PDU ¶
type PDU struct { // SMCS Address SMSC SMSCAddress // TPDU in binary form TPDU []byte }
PDU represents the PDU exchanged with the GSM modem.
func UnmarshalBinary ¶
UnmarshalBinary decodes the binary form of the PDU provided by the modem.
Returns the unmarshalled PDU, or an error if unmarshalling fails.
func UnmarshalHexString ¶
UnmarshalHexString decodes the hex string provided by the modem.
func (*PDU) MarshalBinary ¶
MarshalBinary marshals the PDU into binary form.
func (*PDU) MarshalHexString ¶
MarshalHexString encodes the PDU into the hex string expected by the modem.
func (*PDU) UnmarshalBinary ¶
UnmarshalBinary decodes the binary form of the PDU provided by the modem.
func (*PDU) UnmarshalHexString ¶
UnmarshalHexString decodes the hex string provided by the modem.
type SMSCAddress ¶
SMSCAddress is the address of the SMSC.
The SMCSAddress is similar to a TPDU Address, but the binary form is marshalled differently, hence the subtype.
The Type-of-number should typically be TonNational or TonInternational, but that is not enforced.
The NumberingPlan should typically be NpISDN, but that is not enforced either.
func (*SMSCAddress) MarshalBinary ¶
func (a *SMSCAddress) MarshalBinary() (dst []byte, err error)
MarshalBinary marshals the SMSC Address into binary.
func (*SMSCAddress) UnmarshalBinary ¶
func (a *SMSCAddress) UnmarshalBinary(src []byte) (int, error)
UnmarshalBinary unmarshals an SMSC Address from a TPDU field.
It returns the number of bytes read from the source, and any error detected while decoding.