Device::Gsm::Pdu(3pm)
π Device::Gsm::Pdu π
okay bestie, so this is the manual page for Device::Gsm::Pdu(3pm) β a lil Perl library that handles PDU encoded data for GSM messaging β¨ (yes, the text-message sorcery, we're doing it) π
π¨ WARNING π¨
not me having to say this but: this is BETA software, fr fr. it still needs extensive testing and support for custom GSM commands, so use it at your own risk, and without ANY warranty! have fun π«Ά π
like, genuinely. no warranty. none. zero. ok bye.
π NOTICE π
this module is meant to be used internally by the Device::Gsm class, so you probably do not want to use it directly π it's giving backstage-pass-only energy.
β¨ SYNOPSIS β¨
use Device::Gsm::Pdu;
# DA is destination address
$DA = Device::Gsm::Pdu::encode_address('+39347101010');
$number = Device::Gsm::Pdu::decode_address( $DA );
# Encode 7 bit text to send messages
$text = Device::Gsm::Pdu::encode_text7('hello');
πΈ DESCRIPTION πΈ
Device::Gsm::Pdu includes a few basic functions to deal with SMS in PDU mode β think encoding GSM addresses (phone numbers) and, for now only, 7 bit text. lowkey iconic, highkey niche π
π FUNCTIONS π
decode_address( pdu_encoded_address )
takes a PDU encoded address and decodes it into a human-readable mobile number π¦ and if the number type is international, the result gets a + sign slapped on the front. periodt.
clearly, it is intended as an internal function (iykyk).
Example
print Device::Gsm::Pdu::decode_address( '0B919343171010F0' );
# prints `+39347101010';
encode_address( mobile_number )
takes a mobile number and encodes it as DA (destination address) π
and if it begins with a +, like in +39328101010, it's treated as an international number.
Example
print Device::Gsm::Pdu::encode_address( '+39347101010' );
# prints `0B919343171010F0'
encode_text7( text_string )
encodes some text ASCII string in 7 bits PDU format, including a header byte which tells you the length is in septets β¨ this is the only 100% supported mode to encode text, so likeβ¦ it's the main character here π
Example
print Device::Gsm::Pdu::encode_text7( 'hellohello' );
# prints `0AE832...'
pdu_to_latin1($pdu)
converts a PDU (without the initial length octet) into a latin1 string π yes bestie, no length octet, don't @ me.
Example
my $pdu = 'CAFA9C0E0ABBDF7474590E8296E56C103A3C5E97E5';
print Device::Gsm::Pdu::pdu_to_latin1($pdu);
# prints `Just another Perl hacker'
latin1_to_pdu($text)
converts a text string in latin1 encoding (ISO-8859-1) into a PDU string π₯ it's the flip side of the function above, we love a symmetrical queen.
Example
my $text = "Just another Perl hacker";
print Device::Gsm::Pdu::latin1_to_pdu($text);
# prints `CAFA9C0E0ABBDF7474590E8296E56C103A3C5E97E5'
π AUTHOR π
Cosimo Streppone, cosimo@cpan.org π
π COPYRIGHT π
this library is free software; you can redistribute it and/or modify it only under the terms of Perl itself. slay, open source.
π¦ SEE ALSO π¦
and that's the whole vibe check bestie π this was perl v5.32.0, dated 2021-01-19, and the manual page is Device::Gsm::Pdu(3pm) β go forth and encode responsibly πβ¨
π¦ where this page comes from
- debian bookworm: libdevice-gsm-perl 1.61-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdevice-gsm-perl 1.61-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libdevice-gsm-perl 1.61-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdevice-gsm-perl 1.61-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdevice-gsm-perl 1.61-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdevice-gsm-perl 1.61-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms