Robert Price > Nokia-File-NFB > Nokia::File::NFB

Download:
Nokia-File-NFB-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Nokia::File::NFB - Create, Read and Write Nokia nfb/nfc phone backup files.

SYNOPSIS ^

  use Nokia::File::NFB;

  my $nfb = new Nokia::File::NFB;

  ## read in the file 'phone_backup.nfb'.
  $nfb->read('phone_backup.nfb');

  ## print out the phone model the backup file is of.
  print "Phone model is ", $nfb->phone(), "\n";

  ## change the phone model to 'PerlPhone'.
  $nfb->phone("PerlPhone");

  ## write out the file as 'new_phone_backup.nfb'.
  $nfb->write('new_phone_backup.nfb');

DESCRIPTION ^

This is used to parse existing or create new files in Nokia NFB or NFC format. NFB is the format used by the Nokia PC Suite Backup and Restore software.

The most interesting part is probably the elements() method. This is used to return each internal file backed up in the NFB file as a Nokia::File::NFB::Element object. These are useful things such as photos, contacts and calendar files.

I don't actually know what the letters NFB or NFC actually stand for, but they are the suffixes used on the backup and copy file created by the Backup and Restore program.

This is based on some Python code found at http://www.dryfish.org/projects/nfb.html

METHODS ^

new()

Create a new Nokia::File::NFB. It takes no parameters.

        my $nfb = new Nokia::File::NFB;

read()

Reads in an NFB or NFC format file. Pass a scalar containing the filename to read.

        $nfb->read("backup.nfb");

write()

Writes out an NFB or NFC file. Pass a scalar containing the filename to write out.

        $nfb->write();

phone()

Gets or sets the phone model type in the NFB file.

        my $phone = $nfb->phone();
        $nfb->phone("PerlPhone");

version()

Gets or sets the NFB file version.

        my $version = $nfb->version();
        $nfb->version(3);

NOTE: On my tests this is always version 3.

firmware()

Gets or sets the firmware of the phone that is backed up in the NFB file.

        my $firmware = $nfb->firmware();
        $nfb->firmware('Perl');

elements()

Gets or sets a reference to a list of Nokia::File::NFB::Element objects. These are the actual files in backed up in the NFB file.

        my $elements = $nfb->elements();
        $nfb->elements($new_elements);

binary()

Returns the NFB file in binary format. This method is used by the write() method when it outputs a file. It takes no parameters.

        my $rawdata = $nfb->binary();

INTERNALS NOTES ^

Internally, the NFB data is stored in little endian format. All strings are the little endian version of UCS2 and are encoded or decoded using the Encode module. The file checksum is just a CRC32, so we use this function from the Compress::Zlib module.

I have tested this module using data backed up using PC Suite 6 from a Nokia 7250 and a Nokia 7610. They both parse correctly.

SEE ALSO ^

Nokia::File::NFB::File

Nokia PC Suite - http://www.nokia.com/

Python based parser - http://www.dryfish.org/projects/nfb.html

AUTHOR ^

Robert Price, <rprice@cpan.org>

http://www.robertprice.co.uk/

COPYRIGHT AND LICENSE ^

Copyright (C) 2004 by Robert Price

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: