The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Data::MEID - Convert, check, and inspect mobile MEID values.

VERSION

Version 0.02

SYNOPSIS

Quick summary of what the module does.

    use Data::MEID qw(
        meid_to_hex
        meid_to_dec
        meid_is_valid
        meid_is_hex
        meid_is_dec
        meid_check_digit
        meid_to_pesn
        manu_code_dec
        manu_code_hex
        serial_num_dec
        serial_num_hex
    );

    #  convert Decimal MEID to Hex
    my $hex_meid = meid_to_hex( '270113177609606898' );

    #  convert Hex MEID to Decimal
    my $decimal_meid = meid_to_dec( 'A10000009296F2' );

    #  check to see if a MEID is a valid in Hex or Decimal form
    return 1 if meid_is_valid( 'A10000009296F2' );

    #  check to see if a MEID is in proper Hex form
    print "Hex MEID Detected" if meid_is_hex( 'A10000009296F2' );

    #  check to see if a MEID is in proper Decimal form
    print "Decimal MEID Detected" if meid_is_dec( '270113177609606898' );

    #  calculate the MEID check digit using 3GPP2 X.S0008-0 v3.0
    my $hex_cd = meid_check_digit( 'A10000009296F2' );
    my $dec_cd = meid_check_digit( '270113177609606898' );

    #  calculate Pseudo ESN
    my $pseudo_esn = meid_to_pesn( 'A10000009296F2' );

    #  get Decimal manufacturers code
    my $manufacturer_code = manu_code_dec( 'A10000009296F2' );

    #  get Hex manufacturers code
    my $manufacturers_code = manu_code_hex( 'A10000009296F2' );

    #  get Decimal serial number
    serial_num_dec( 'A10000009296F2' );

    #  get Hex serial number
    serial_num_hex( 'A10000009296F2' );

EXPORT

    meid_to_hex
    meid_to_dec
    meid_is_valid
    meid_is_hex
    meid_is_dec
    meid_check_digit
    meid_to_pesn
    manu_code_dec
    manu_code_hex
    serial_num_dec
    serial_num_hex

SUBROUTINES/METHODS

meid_to_hex

Convert a decimal MEID to Decimal. If an invalid Decimal MEID is used, then it will throw a warning and return 0.

meid_to_dec

Convert a Hex MEID to Decimal. If an invalid Hex MEID is used, then it will throw a warning and return 0.

meid_is_valid

Check to see if the MEID looks like a valid MEID, either Decimal or Hex. If it looks like a Decimal MEID, it returns "dec". If it looks like a Hex ESN it returns "hex". If it doesn't match either it returns 0

meid_is_hex

Return 1 if MEID looks like valid HEX MEID: RRXXXXXXZZZZZZ. Otherwise return 0. RR = A0 ~ FF, XXXXXX = 000000 ~ FFFFFF, ZZZZZZ = 000000 ~ FFFFFF

meid_is_dec

Return 1 if MEID looks like valid Decimal MEID. Otherwise return 0.

hex_meid_check_digit

Calculates the MEID check digit value as described in 3GPP2 X.S0008-0 v3.0. Per the spec, AF 01 23 45 0A BC DE has a check digit of 'C'. MEID 293608736500703710 has a check digit of '0'.

If a Hex MEID is passed, a Hex check digit is returned. if a Decimal MEID is passed, a Decimal check digit is returned.

meid_to_pesn

Calculate the pESN ( Pseudo ESN ) from Decimal or Hex MEID.

Output is Hex ESN. Use Data::ESN if Decimal ESN's are needed.

manu_code_dec

Return the manufacturer code in Decimal form from the MEID. If we have a MEID that looks bad, then return 0.

manu_code_hex

Return the manufacturer code in Hex form from the MEID. If we have a MEID that looks bad, then return 0.

serial_num_dec

Return the serial number in Decimal form from the MEID. If we have a MEID that looks bad, then return 0.

serial_num_hex

Return the serial number in hex form from the MEID. If we have a MEID that looks bad, then return 0.

AUTHOR

Adam Wohld, <adam at spatialsystems.org>

BUGS

Please report any bugs or feature requests to bug-data-meid at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-MEID. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Data::MEID

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2012 Adam Wohld.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.