Nokia::File::NFB - Create, Read and Write Nokia nfb/nfc phone backup files.
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');
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
Create a new Nokia::File::NFB. It takes no parameters.
my $nfb = new Nokia::File::NFB;
Reads in an NFB or NFC format file. Pass a scalar containing the filename to read.
Writes out an NFB or NFC file. Pass a scalar containing the filename to write out.
Gets or sets the phone model type in the NFB file.
my $phone = $nfb->phone(); $nfb->phone("PerlPhone");
Gets or sets the NFB file version.
my $version = $nfb->version(); $nfb->version(3);
NOTE: On my tests this is always version 3.
Gets or sets the firmware of the phone that is backed up in the NFB file.
my $firmware = $nfb->firmware(); $nfb->firmware('Perl');
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);
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();
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.
Nokia PC Suite - http://www.nokia.com/
Python based parser - http://www.dryfish.org/projects/nfb.html
Robert Price, <firstname.lastname@example.org>
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.