Documentation ¶
Overview ¶
The package sds implements everything that is necessary for sending and receiving SDS messages through the Peripheral Equipment Interface (PEI) of a TETRA radio terminal. This implementation is solely based on:
[AI] ETSI TS 100 392-2 V3.9.2 (2020-06) [PEI] ETSI EN 300 392-5 V2.7.1 (2020-04)
The most relevant chapters in [AI] are 29 (SDS-TL Protocol) and 14 (CMCE Protocol).
Abbreviations: PDU: Protocol Data Unit SDU: Service Data Unit UDH: User Data Header
Restrictions: Store/forward control information is not supported yet.
Index ¶
- Constants
- Variables
- func AppendEncodedPayloadText(bytes []byte, bits int, text string, textEncoding TextEncoding) ([]byte, int)
- func BitsToTextBytes(encoding TextEncoding, bits int) int
- func DecodePayloadText(textEncoding TextEncoding, bytes []byte) (string, error)
- func DecodeTimestamp(bytes []byte) (time.Time, error)
- func EncodeTimestampUTC(timestamp time.Time) []byte
- func ParseSDSTLPDU(bytes []byte) (interface{}, error)
- func ParseStatus(bytes []byte) (interface{}, error)
- func RemoveLeadingOPTA(s string) string
- func RemoveTrailingITSI(s string) string
- func RequestMaxMessagePDUBits(ctx context.Context, requester tetra.Requester) (int, error)
- func SendMessage(destination tetra.Identity, message Encoder) string
- func SplitLeadingOPTA(s string) (string, string)
- func SplitToMaxBits(encoding TextEncoding, maxPDUBits int, text string) []string
- func SplitTrailingITSI(s string) (string, string)
- func TextBytes(encoding TextEncoding, length int) int
- func TextBytesToBits(encoding TextEncoding, length int) int
- type AIService
- type ConcatenatedTextSDU
- type ConcatenatedTextUDH
- type DeliveryReportRequest
- type DeliveryStatus
- type Encoder
- type EncoderFunc
- type ExternalSubscriberNumber
- type ExternalSubscriberNumberDigit
- type ForwardAddressExtension
- type ForwardAddressSNA
- type ForwardAddressSSI
- type ForwardAddressType
- type Header
- type IncomingMessage
- type Message
- type MessageCallback
- type MessageReference
- type ProtocolIdentifier
- type ResponseCallback
- type SDSAcknowledge
- type SDSReport
- type SDSShortReport
- type SDSTLMessageType
- type SDSTransfer
- type ShortReportType
- type SimpleTextMessage
- type Stack
- type Status
- type StatusCallback
- type StatusMessage
- type StoreForwardControl
- type TextEncoding
- type TextHeader
- type TextSDU
- type UDHInformationElementID
- type ValidityPeriod
Constants ¶
const ( // CRLF line ending for AT commands CRLF = "\x0d\x0a" // CtrlZ line ending for PDUs CtrlZ = "\x1a" // SwitchToSDSTL is a short-cut for selecting the SDS-TL AI service with ISSI addressing and E2EE according to [PEI] 6.14.6 SwitchToSDSTL = "AT+CTSDS=12,0,0,0,1" // SwitchToStatus is a short-cut for selecting the status AI service with ISSI addresssing according to [PEI] 6.14.6 SwitchToStatus = "AT+CTSDS=13,0" )
const SDSShortReportPDUIdentifier byte = 0x7A
SDSShortReportPDUIdentifier for SDS-SHORT-REPORT PDUs
Variables ¶
var EncodingByName = map[string]TextEncoding{ "ISO8859-1": ISO8859_1, "ISO8859-2": ISO8859_2, "ISO8859-3": ISO8859_3, "ISO8859-4": ISO8859_4, "ISO8859-5": ISO8859_5, "ISO8859-6": ISO8859_6, "ISO8859-7": ISO8859_7, "ISO8859-8": ISO8859_8, "ISO8859-9": ISO8859_9, "ISO8859-10": ISO8859_10, "ISO8859-13": ISO8859_13, "ISO8859-14": ISO8859_14, "ISO8859-15": ISO8859_15, "CodePage437": CodePage437, "CodePage850": CodePage850, "CodePage852": CodePage852, "CodePage855": CodePage855, "CodePage860": CodePage860, "CodePage863": CodePage863, "CodePage865": CodePage865, "CodePage866": CodePage866, "UTF16BE": UTF16BE, }
EncodingByName maps allows to access all the supported encodings by their name as string
var TextCodecs = map[TextEncoding]encoding.Encoding{ ISO8859_1: charmap.ISO8859_1, ISO8859_2: charmap.ISO8859_2, ISO8859_3: charmap.ISO8859_3, ISO8859_4: charmap.ISO8859_4, ISO8859_5: charmap.ISO8859_5, ISO8859_6: charmap.ISO8859_6, ISO8859_7: charmap.ISO8859_7, ISO8859_8: charmap.ISO8859_8, ISO8859_9: charmap.ISO8859_9, ISO8859_10: charmap.ISO8859_10, ISO8859_13: charmap.ISO8859_13, ISO8859_14: charmap.ISO8859_14, ISO8859_15: charmap.ISO8859_15, CodePage437: charmap.CodePage437, CodePage850: charmap.CodePage850, CodePage852: charmap.CodePage852, CodePage855: charmap.CodePage855, CodePage860: charmap.CodePage860, CodePage863: charmap.CodePage863, CodePage865: charmap.CodePage865, CodePage866: charmap.CodePage866, UTF16BE: unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM), }
TextCodecs contains encoding.Encoding instances for all supported text encoding schemes. Beware that not all defined schemes are actually supported here.
Functions ¶
func AppendEncodedPayloadText ¶
func AppendEncodedPayloadText(bytes []byte, bits int, text string, textEncoding TextEncoding) ([]byte, int)
AppendEncodedPayloadText encodes the given payload text using the given text encoding and appends the result to the given byte slice.
func BitsToTextBytes ¶ added in v1.1.0
func BitsToTextBytes(encoding TextEncoding, bits int) int
BitsToTextBytes returns the number of bytes of a text that fit into the given number of bits using the given encoding
func DecodePayloadText ¶
func DecodePayloadText(textEncoding TextEncoding, bytes []byte) (string, error)
DecodePayloadText decodes the actual text content using the given encoding scheme according to [AI] 29.5.4
func DecodeTimestamp ¶
DecodeTimestamp according to [AI] 29.5.4.4
func EncodeTimestampUTC ¶
EncodeTimestampUTC according to [AI] 29.5.4.4, always using timeframe type UTC
func ParseSDSTLPDU ¶
ParseSDSTLPDU parses an SDS-TL PDU from the given bytes according to [AI] 29.4.1. This function currently supports only a subset of the possible protocol identifiers: Simple text messaging (0x02), simple immediate text messaging (0x09), text messaging (0x82), immediate text messaging (0x89), message with user data header (0x8A)
func ParseStatus ¶
ParseStatus from the given bytes.
func RemoveLeadingOPTA ¶
func RemoveTrailingITSI ¶
func RequestMaxMessagePDUBits ¶
RequestMaxMessagePDUBits uses the given RequesterFunc to find out how many bits a message PDU may have (see [PEI] 6.13.2).
func SendMessage ¶
SendMessage according to [PEI] 6.13.2
func SplitLeadingOPTA ¶
func SplitToMaxBits ¶ added in v1.1.0
func SplitToMaxBits(encoding TextEncoding, maxPDUBits int, text string) []string
SplitToMaxBits splits the given text into parts that do not exceed the given maximum number of bits using the given encoding
func SplitTrailingITSI ¶
func TextBytes ¶
func TextBytes(encoding TextEncoding, length int) int
TextBytes returns the length in bytes of an encoded text with the given number of characters and the given encoding
func TextBytesToBits ¶
func TextBytesToBits(encoding TextEncoding, length int) int
TextBytesToBits returns the length in bits of an encoded text with the given number of characters and the given encoding
Types ¶
type ConcatenatedTextSDU ¶
type ConcatenatedTextSDU struct { TextSDU UserDataHeader ConcatenatedTextUDH }
ConcatenatedTextSDU according to [AI] 29.5.10.3
func ParseConcatenatedTextSDU ¶
func ParseConcatenatedTextSDU(bytes []byte) (ConcatenatedTextSDU, error)
ParseConcatenatedTextSDU parses the user data of a message with user data header.
func (ConcatenatedTextSDU) Encode ¶ added in v1.1.0
func (t ConcatenatedTextSDU) Encode(bytes []byte, bits int) ([]byte, int)
Encode this concatenated text SDU
func (ConcatenatedTextSDU) Length ¶
func (t ConcatenatedTextSDU) Length() int
Length returns the length of this encoded concatenated text SDU in bytes.
type ConcatenatedTextUDH ¶
type ConcatenatedTextUDH struct { HeaderLength byte ElementID UDHInformationElementID ElementLength byte MessageReference uint16 TotalNumber byte SequenceNumber byte }
ConcatenatedTextUDH contents according to [AI] 29.5.10.3
func ParseConcatenatedTextUDH ¶
func ParseConcatenatedTextUDH(bytes []byte) (ConcatenatedTextUDH, error)
ParseConcatenatedTextUDH according to [AI] table 29.48
func (ConcatenatedTextUDH) Encode ¶ added in v1.1.0
func (h ConcatenatedTextUDH) Encode(bytes []byte, bits int) ([]byte, int)
Encode this concatenated text UDH
func (ConcatenatedTextUDH) Length ¶
func (h ConcatenatedTextUDH) Length() int
Length returns the length of this header in bytes.
type DeliveryReportRequest ¶
type DeliveryReportRequest byte
DeliveryReportRequest enum according to [AI] 29.4.3.3
const ( NoReportRequested DeliveryReportRequest = 0x00 MessageReceivedReportRequested DeliveryReportRequest = 0x01 MessageConsumedReportRequested DeliveryReportRequest = 0x02 MessageReceivedAndConsumedReportRequested DeliveryReportRequest = 0x03 )
All delivery report requests according to [AI] table 29.17
type DeliveryStatus ¶
type DeliveryStatus byte
DeliveryStatus according to [AI] 29.4.3.2
const ( ReceiptAckByDestination DeliveryStatus = 0x00 ReceiptReportAck DeliveryStatus = 0x01 ConsumedByDestination DeliveryStatus = 0x02 ConsumedReportAck DeliveryStatus = 0x03 MessageForwardedToExternalNetwork DeliveryStatus = 0x04 SentToGroupAckPresented DeliveryStatus = 0x05 ConcatenationPartReceiptAckByDestination DeliveryStatus = 0x06 Congestion DeliveryStatus = 0x20 MessageStored DeliveryStatus = 0x21 DestinationNotReachableMessageStored DeliveryStatus = 0x22 NetworkOverload DeliveryStatus = 0x40 ServicePermanentlyNotAvailable DeliveryStatus = 0x41 ServiceTemporaryNotAvailable DeliveryStatus = 0x42 SourceNotAuthorized DeliveryStatus = 0x43 DestinationNotAuthorzied DeliveryStatus = 0x44 UnknownDestGatewayServiceAddress DeliveryStatus = 0x45 UnknownForwardAddress DeliveryStatus = 0x46 GroupAddressWithIndividualService DeliveryStatus = 0x47 ValidityPeriodExpiredNotReceived DeliveryStatus = 0x48 ValidityPeriodExpiredNotConsumed DeliveryStatus = 0x49 DeliveryFailed DeliveryStatus = 0x4A DestinationNotRegistered DeliveryStatus = 0x4B DestinationQueueFull DeliveryStatus = 0x4C MessageTooLong DeliveryStatus = 0x4D DestinationDoesNotSupportSDSTL DeliveryStatus = 0x4E DestinationHostNotConnected DeliveryStatus = 0x4F ProtocolNotSupported DeliveryStatus = 0x50 DataCodingSchemeNotSupported DeliveryStatus = 0x51 DestinationMemoryFullMessageDiscarded DeliveryStatus = 0x52 DestinationNotAcceptingSDS DeliveryStatus = 0x53 ConcatednatedMessageTooLong DeliveryStatus = 0x54 DestinationAddressProhibited DeliveryStatus = 0x56 CannotRouteToExternalNetwork DeliveryStatus = 0x57 UnknownExternalSubscriberNumber DeliveryStatus = 0x58 NegativeReportAcknowledgement DeliveryStatus = 0x59 DestinationNotReachable DeliveryStatus = 0x5A TextDistributionError DeliveryStatus = 0x5B CorruptInformationElement DeliveryStatus = 0x5C NotAllConcatenationPartsReceived DeliveryStatus = 0x5D DestinationEngagedInAnotherServiceBySwMI DeliveryStatus = 0x5E DestinationEngagedInAnotherServiceByDest DeliveryStatus = 0x5F DestinationMemoryFull DeliveryStatus = 0x60 DestinationMemoryAvailable DeliveryStatus = 0x61 StartPendingMessages DeliveryStatus = 0x62 NoPendingMessages DeliveryStatus = 0x63 StopSending DeliveryStatus = 0x80 StartSending DeliveryStatus = 0x81 )
All DeliveryStatus values according to [AI] table 29.16
func (DeliveryStatus) DataDeliveryFailed ¶
func (s DeliveryStatus) DataDeliveryFailed() bool
DataDeliveryFailed indicates if this status represents a data transfer failure (see [AI] table 29.16).
func (DeliveryStatus) Encode ¶
func (s DeliveryStatus) Encode(bytes []byte, bits int) ([]byte, int)
Encode this delivery status
func (DeliveryStatus) EndToEndControl ¶
func (s DeliveryStatus) EndToEndControl() bool
EndToEndControl indicates if this status represents end to end control information (see [AI] table 29.16).
func (DeliveryStatus) FlowControl ¶
func (s DeliveryStatus) FlowControl() bool
FlowControl indicates if this status represents flow control information (see [AI] table 29.16).
func (DeliveryStatus) Success ¶
func (s DeliveryStatus) Success() bool
Success indicates if this status represents a success (see [AI] table 29.16).
func (DeliveryStatus) TemporaryError ¶
func (s DeliveryStatus) TemporaryError() bool
TemporaryError indicates if this status represents a temporary error (see [AI] table 29.16).
type EncoderFunc ¶
func (EncoderFunc) Encode ¶
func (f EncoderFunc) Encode() ([]byte, int)
type ExternalSubscriberNumber ¶
type ExternalSubscriberNumber []ExternalSubscriberNumberDigit
ExternalSubscriberNumber according to [AI] 29.4.3.6, contains an arbitrary number of digits.
type ExternalSubscriberNumberDigit ¶
type ExternalSubscriberNumberDigit byte // its only 4 bits per digit
ExternalSubscriberNumberDigit represents one digit in the ExternalSubscriberNumber
type ForwardAddressExtension ¶
type ForwardAddressExtension [3]byte
ForwardAddressExtendsion according to [AI] 29.4.3.6
type ForwardAddressSSI ¶
type ForwardAddressSSI [3]byte
ForwardAddressSSI according to [AI] 29.4.3.6
type ForwardAddressType ¶
type ForwardAddressType byte
ForwardAddressType enum according to [AI] 29.4.3.5
const ( ForwardToSNA ForwardAddressType = 0x00 ForwardToSSI ForwardAddressType = 0x01 ForwardToTSI ForwardAddressType = 0x02 ForwardToExternalSubscriberNumber ForwardAddressType = 0x03 NoForwardAddressPresent ForwardAddressType = 0x07 )
All forward address type values according to [AI] table 29.18
type Header ¶
type Header struct { AIService AIService Source tetra.Identity Destination tetra.Identity PDUBits int }
Header represents the information provided with the AT+CTSDSR unsolicited response indicating an incoming SDS. see [PEI] 6.13.3
func ParseHeader ¶
ParseHeader from the given string. The string must include the +CTSDSR: token.
type IncomingMessage ¶
type IncomingMessage struct { Header Header Payload interface{} }
func ParseIncomingMessage ¶
func ParseIncomingMessage(headerString string, pduHex string) (IncomingMessage, error)
ParseIncomingMessage parses an incoming message with the given header and PDU bytes. The message may be part of a concatenated text message with user data header, a simple text message, a text message, or a status.
type Message ¶
type Message struct { ID int Source tetra.Identity Destination tetra.Identity Timestamp time.Time // contains filtered or unexported fields }
func NewMessage ¶
type MessageCallback ¶
type MessageCallback func(Message)
type ProtocolIdentifier ¶
type ProtocolIdentifier byte
ProtocolIdentifier enum according to [AI] 29.4.3.9
const ( SimpleTextMessaging ProtocolIdentifier = 0x02 SimpleImmediateTextMessaging ProtocolIdentifier = 0x09 SimpleConcatenatedSDSMessaging ProtocolIdentifier = 0x0C TextMessaging ProtocolIdentifier = 0x82 ImmediateTextMessaging ProtocolIdentifier = 0x89 UserDataHeaderMessaging ProtocolIdentifier = 0x8A ConcatenatedSDSMessaging ProtocolIdentifier = 0x8C )
All protocol identifiers relevant for SDS handling, according to [AI] table 29.21
func (ProtocolIdentifier) Encode ¶
func (p ProtocolIdentifier) Encode(bytes []byte, bits int) ([]byte, int)
Encode this protocol identifier
func (ProtocolIdentifier) Length ¶ added in v1.1.0
func (p ProtocolIdentifier) Length() int
Length of this protocol identifier in bytes.
type ResponseCallback ¶
type SDSAcknowledge ¶
type SDSAcknowledge struct { DeliveryStatus DeliveryStatus MessageReference MessageReference // contains filtered or unexported fields }
SDSAcknowledge represents the SDS-ACK PDU contents as defined in [AI] 29.4.2.1
func ParseSDSAcknowledge ¶
func ParseSDSAcknowledge(bytes []byte) (SDSAcknowledge, error)
ParseSDSAcknowledge parses a SDS-ACK PDU from the given bytes
type SDSReport ¶
type SDSReport struct { AckRequired bool DeliveryStatus DeliveryStatus MessageReference MessageReference StoreForwardControl StoreForwardControl UserData []byte // contains filtered or unexported fields }
SDSReport represents the SDS-REPORT PDU contents as defined in [AI] 29.4.2.2
func NewSDSReport ¶
func NewSDSReport(sdsTransfer SDSTransfer, ackRequired bool, deliveryStatus DeliveryStatus) SDSReport
NewSDSReport creates a new SDS-REPORT PDU based on the given SDS-TRANSFER PDU without store/forward control information.
func ParseSDSReport ¶
ParseSDSReport parses a SDS-REPORT PDU from the given bytes
type SDSShortReport ¶
type SDSShortReport struct { ReportType ShortReportType MessageReference MessageReference }
SDSShortReport represents the SDS-SHORT-REPORT PDU contents as defined in [AI] 29.4.2.3
func ParseSDSShortReport ¶
func ParseSDSShortReport(bytes []byte) (SDSShortReport, error)
ParseSDSShortReport parses a SDS-SHORT-REPORT PDU from the given bytes
type SDSTLMessageType ¶
type SDSTLMessageType byte
SDSTLMessageType enum according to [AI] 29.4.3.8
const ( SDSTransferMessage SDSTLMessageType = 0 SDSReportMessage SDSTLMessageType = 1 SDSAcknowledgeMessage SDSTLMessageType = 2 )
All SDS-TL message types according to [AI] table 29.20
type SDSTransfer ¶
type SDSTransfer struct { DeliveryReportRequest DeliveryReportRequest ServiceSelectionShortFormReport bool MessageReference MessageReference StoreForwardControl StoreForwardControl UserData interface{} // contains filtered or unexported fields }
SDSTransfer represents the SDS-TRANSFER PDU contents as defined in [AI] 29.4.2.4
func NewConcatenatedMessageTransfer ¶ added in v1.1.0
func NewConcatenatedMessageTransfer(messageReference MessageReference, deliveryReport DeliveryReportRequest, encoding TextEncoding, maxPDUBits int, text string) []SDSTransfer
NewConcatenatedMessageTransfer returns a set of SDS_TRANSFER PDUs for that make up the given text using concatenated text messages with a UDH.
func NewTextMessageTransfer ¶
func NewTextMessageTransfer(messageReference MessageReference, immediate bool, deliveryReport DeliveryReportRequest, encoding TextEncoding, text string) SDSTransfer
NewTextMessageTransfer returns a new SDS-TRANSFER PDU for text messaging with the given parameters
func ParseSDSTransfer ¶
func ParseSDSTransfer(bytes []byte) (SDSTransfer, error)
ParseSDSTransfer parses a SDS-TRANSFER PDU from the given bytes
func (SDSTransfer) ConsumedReportRequested ¶
func (m SDSTransfer) ConsumedReportRequested() bool
ConsumedReportRequested indicates if for this SDS-TRANSFER PDU a delivery report is requested for consumation
func (SDSTransfer) Encode ¶
func (m SDSTransfer) Encode(bytes []byte, bits int) ([]byte, int)
Encode this SDS-TRANSFER PDU
func (SDSTransfer) Immediate ¶
func (m SDSTransfer) Immediate() bool
Immediate indiciates if this message should be displayed/handled immediately by the TE.
func (SDSTransfer) Length ¶ added in v1.1.0
func (m SDSTransfer) Length() int
Length of this SDS-TRANSFER in bytes.
func (SDSTransfer) ReceivedReportRequested ¶
func (m SDSTransfer) ReceivedReportRequested() bool
ReceivedReportRequested indicates if for this SDS-TRANSFER PDU a delivery report is requested for receipt
type ShortReportType ¶
type ShortReportType byte
ShortReportType enum according to [AI] 29.4.3.10
const ( ProtocolOrEncodingNotSupportedShort ShortReportType = 0x00 DestinationMemoryFullShort ShortReportType = 0x01 MessageReceivedShort ShortReportType = 0x02 MessageConsumedShort ShortReportType = 0x03 )
All short report type values accoring to [AI] table 29.22
type SimpleTextMessage ¶
type SimpleTextMessage struct { Encoding TextEncoding Text string // contains filtered or unexported fields }
SimpleTextMessage represents the data of a simple text messaging PDU, according to [AI] 29.5.2.3
func NewSimpleTextMessage ¶
func NewSimpleTextMessage(immediate bool, encoding TextEncoding, text string) SimpleTextMessage
NewSimpleTextMessage returns a new simple text message PDU according to the given parameters
func ParseSimpleTextMessage ¶
func ParseSimpleTextMessage(bytes []byte) (SimpleTextMessage, error)
ParseSimpleTextMessage parses a simple text message PDU
func (SimpleTextMessage) Encode ¶
func (m SimpleTextMessage) Encode(bytes []byte, bits int) ([]byte, int)
Encode this simple text message
func (SimpleTextMessage) Immediate ¶
func (m SimpleTextMessage) Immediate() bool
Immediate indiciates if this message should be displayed/handled immediately by the TE.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
func (*Stack) Put ¶
func (s *Stack) Put(part IncomingMessage) error
func (*Stack) WithMessageCallback ¶
func (s *Stack) WithMessageCallback(callback MessageCallback) *Stack
func (*Stack) WithResponseCallback ¶
func (s *Stack) WithResponseCallback(callback ResponseCallback) *Stack
func (*Stack) WithStatusCallback ¶
func (s *Stack) WithStatusCallback(callback StatusCallback) *Stack
type Status ¶
type Status uint16
Status represents a pre-coded status according to [AI] 14.8.34
const ( Status0 Status = 0x8002 Status1 Status = 0x8003 Status2 Status = 0x8004 Status3 Status = 0x8005 Status4 Status = 0x8006 Status5 Status = 0x8007 Status6 Status = 0x8008 Status7 Status = 0x8009 Status8 Status = 0x800A Status9 Status = 0x800B StatusA Status = 0x80F2 StatusE Status = 0x80F3 StatusC Status = 0x80F4 StatusF Status = 0x80F5 StatusH Status = 0x80F6 StatusJ Status = 0x80F7 StatusL Status = 0x80F8 StatusP Status = 0x80F9 Statusd Status = 0x80FC Statush Status = 0x80FD Statuso Status = 0x80FE Statusu Status = 0x80FF )
Some relevant status values
type StatusCallback ¶
type StatusCallback func(StatusMessage)
type StatusMessage ¶
func (StatusMessage) String ¶
func (s StatusMessage) String() string
type StoreForwardControl ¶
type StoreForwardControl struct { // Valid indicates if this StoreForwardControl instance contains valid data. Valid is false if store and forward control is not used with this message. Valid bool ValidityPeriod ValidityPeriod ForwardAddressType ForwardAddressType ForwardAddressSNA ForwardAddressSNA ForwardAddressSSI ForwardAddressSSI ForwardAddressExtension ForwardAddressExtension ExternalSubscriberNumber ExternalSubscriberNumber }
StoreForwardControl represents the optional store and forward control information contained in the SDS-REPORT and SDS-TRANSFER PDUs.
func ParseStoreForwardControl ¶
func ParseStoreForwardControl(bytes []byte) (StoreForwardControl, error)
ParseStoreForwardControl from the given bytes.
func (StoreForwardControl) Length ¶
func (s StoreForwardControl) Length() int
Length returns the length of this encoded store forward control in bytes.
type TextEncoding ¶
type TextEncoding byte
TextEncoding enum according to [AI] 29.5.4.1
const ( Packed7Bit TextEncoding = iota ISO8859_1 ISO8859_2 ISO8859_3 ISO8859_4 ISO8859_5 ISO8859_6 ISO8859_7 ISO8859_8 ISO8859_9 ISO8859_10 ISO8859_13 ISO8859_14 ISO8859_15 CodePage437 CodePage737 CodePage850 CodePage852 CodePage855 CodePage857 CodePage860 CodePage861 CodePage863 CodePage865 CodePage866 CodePage869 UTF16BE VISCII )
All defined text encoding schemes, according to [AI] table 29.29
type TextHeader ¶
type TextHeader struct { Encoding TextEncoding Timestamp time.Time }
TextHeader represents the meta information for text used in text messages according to [AI] 29.5.3.3 and concatenated text messages according to [AI] 29.5.10.3
func ParseTextHeader ¶
func ParseTextHeader(bytes []byte) (TextHeader, error)
ParseTextHeader in text messages and concatenated text messages.
func (TextHeader) Encode ¶
func (h TextHeader) Encode(bytes []byte, bits int) ([]byte, int)
Encode this text header
func (TextHeader) Length ¶
func (h TextHeader) Length() int
Length returns the length of this text header in bytes.
type TextSDU ¶
type TextSDU struct { TextHeader Text string }
TextSDU according to [AI] 29.5.3.3
func ParseTextSDU ¶
ParseTextSDU parses the user data of a text message.
type UDHInformationElementID ¶
type UDHInformationElementID byte
UDHInformationElementID enum according to [AI] 29.5.9.4.1
const ( ConcatenatedTextMessageWithShortReference UDHInformationElementID = 0x00 ConcatenatedTextMessageWithLongReference UDHInformationElementID = 0x08 )
The relevant UDHInformationElementID values for concatenated text according to [AI] table 29.47.
type ValidityPeriod ¶
ValidityPeriod according to [AI] 29.4.3.14
const InfinitelyValid ValidityPeriod = -1
InfinitelyValid represents the infinite validity period (31).
func ParseValidityPeriod ¶
func ParseValidityPeriod(b byte) ValidityPeriod
DecodeValidityPeriod from a 5 bits value according to [AI] table 29.25
func (ValidityPeriod) Encode ¶
func (p ValidityPeriod) Encode() ([]byte, int)
Encode the validity period into 5 bits, according to [AI] table 29.25