Device::Gsm::Pdu(3pm)

πŸ“¦
version 1.61 Β· 2 versions
  • 1.61 Β· debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.61 Β· arch rolling
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 πŸ’–


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