sds

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 11 Imported by: 1

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

View Source
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"
)
View Source
const SDSShortReportPDUIdentifier byte = 0x7A

SDSShortReportPDUIdentifier for SDS-SHORT-REPORT PDUs

Variables

View Source
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

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

func DecodeTimestamp(bytes []byte) (time.Time, error)

DecodeTimestamp according to [AI] 29.5.4.4

func EncodeTimestampUTC

func EncodeTimestampUTC(timestamp time.Time) []byte

EncodeTimestampUTC according to [AI] 29.5.4.4, always using timeframe type UTC

func ParseSDSTLPDU

func ParseSDSTLPDU(bytes []byte) (interface{}, error)

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

func ParseStatus(bytes []byte) (interface{}, error)

ParseStatus from the given bytes.

func RemoveLeadingOPTA

func RemoveLeadingOPTA(s string) string

func RemoveTrailingITSI

func RemoveTrailingITSI(s string) string

func RequestMaxMessagePDUBits

func RequestMaxMessagePDUBits(ctx context.Context, requester tetra.Requester) (int, error)

RequestMaxMessagePDUBits uses the given RequesterFunc to find out how many bits a message PDU may have (see [PEI] 6.13.2).

func SendMessage

func SendMessage(destination tetra.Identity, message Encoder) string

SendMessage according to [PEI] 6.13.2

func SplitLeadingOPTA

func SplitLeadingOPTA(s string) (string, string)

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 SplitTrailingITSI(s string) (string, string)

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 AIService

type AIService string

AIService enum according to [PEI] 6.17.3

const (
	SDS1Service   AIService = "9"
	SDS2Service   AIService = "10"
	SDS3Service   AIService = "11"
	SDSTLService  AIService = "12"
	StatusService AIService = "13"
)

All AI services relevant for SDS handling, according to [PEI] 6.17.3

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 Encoder

type Encoder interface {
	Encode([]byte, int) ([]byte, int)
}

type EncoderFunc

type EncoderFunc func() ([]byte, int)

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 ForwardAddressSNA

type ForwardAddressSNA byte

ForwardAddressSNA 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 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

func ParseHeader(s string) (Header, error)

ParseHeader from the given string. The string must include the +CTSDSR: token.

func (Header) PDUBytes

func (h Header) PDUBytes() int

PDUBytes returns the size of the following PDU in bytes.

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

func NewMessage(id int, source tetra.Identity, destination tetra.Identity, timestamp time.Time, parts int) Message

func (Message) Complete

func (m Message) Complete() bool

func (*Message) SetPart

func (m *Message) SetPart(i int, text string)

func (Message) String

func (m Message) String() string

func (Message) Text

func (m Message) Text() string

type MessageCallback

type MessageCallback func(Message)

type MessageReference

type MessageReference byte

MessageReference according to [AI] 29.4.3.7

func (MessageReference) Encode

func (m MessageReference) Encode(bytes []byte, bits int) ([]byte, int)

Encode this message reference

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 ResponseCallback func([]string) error

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

func ParseSDSReport(bytes []byte) (SDSReport, error)

ParseSDSReport parses a SDS-REPORT PDU from the given bytes

func (SDSReport) Encode

func (r SDSReport) Encode(bytes []byte, bits int) ([]byte, int)

Encode this SDS-REPORT PDU

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

func (SDSShortReport) Encode

func (r SDSShortReport) Encode(bytes []byte, bits int) ([]byte, int)

Encode this SDS-SHORT-REPORT PDU

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 NewStack

func NewStack() *Stack

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

func (Status) Bytes

func (s Status) Bytes() []byte

Bytes returns this status as byte slice.

func (Status) Encode

func (s Status) Encode(bytes []byte, bits int) ([]byte, int)

Encode this status

func (Status) Length

func (s Status) Length() int

Length returns the length of this encoded status in bytes.

type StatusCallback

type StatusCallback func(StatusMessage)

type StatusMessage

type StatusMessage struct {
	Source      tetra.Identity
	Destination tetra.Identity
	Value       Status
}

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

func ParseTextSDU(bytes []byte) (TextSDU, error)

ParseTextSDU parses the user data of a text message.

func (TextSDU) Encode

func (t TextSDU) Encode(bytes []byte, bits int) ([]byte, int)

Encode this text SDU

func (TextSDU) Length

func (t TextSDU) Length() int

Length returns the length of this encoded text SDU in bytes.

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

type ValidityPeriod time.Duration

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL