44
|
1 |
#!perl -w
|
|
2 |
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of "Eclipse Public License v1.0"
|
|
6 |
# which accompanies this distribution, and is available
|
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
#
|
|
9 |
# Initial Contributors:
|
|
10 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
# This simple script shows how to modify the content of a feature manager
|
|
16 |
# data file.
|
|
17 |
#
|
|
18 |
#
|
|
19 |
|
|
20 |
use strict;
|
|
21 |
use FMCreate;
|
|
22 |
|
|
23 |
#
|
|
24 |
# Hardwire the datafile - this is only an example.
|
|
25 |
#
|
|
26 |
my $datfile = "/epoc32/release/winscw/udeb/z/private/10205054/features.dat";
|
|
27 |
my $datfile2 = "/epoc32/release/winscw/udeb/z/private/10205054/features2.dat";
|
|
28 |
my $datfileback = "/epoc32/release/winscw/udeb/z/private/10205054/features.bak";
|
|
29 |
|
|
30 |
#
|
|
31 |
# Create an object that represents a feature data file.
|
|
32 |
#
|
|
33 |
my $fmc = FMCreate->new();
|
|
34 |
|
|
35 |
#
|
|
36 |
# Load the content of the data file into our FMCreate object.
|
|
37 |
# Note that this will die if the content does not seem to be a feature set
|
|
38 |
# file. This can happen if the first four bytes aren't 'feat' or if reading
|
|
39 |
# the file fails at any point. This will also happen if the file is the wrong
|
|
40 |
# size.
|
|
41 |
#
|
|
42 |
$fmc->LoadUp($datfile) or die "Failed to load up data from '$datfile'\n";
|
|
43 |
|
|
44 |
# Setup an array of all the features we need to switch on.
|
|
45 |
my $ffuid;
|
|
46 |
my $ff;
|
|
47 |
my @tomtab;
|
|
48 |
|
|
49 |
$tomtab[0] = 81; # KFeatureIdProtocolGsm
|
|
50 |
$tomtab[1] = 82; # KFeatureIdProtocolWcdma
|
|
51 |
$tomtab[1] = 1696; # KFeatureIdOnScreenDialer
|
|
52 |
|
|
53 |
foreach $ffuid (@tomtab)
|
|
54 |
#for ($ffuid = 1696; $ffuid <= 1696; $ffuid++)
|
|
55 |
{
|
|
56 |
$ff = $fmc->GetFeatureFlagByUID($ffuid);
|
|
57 |
if(ref($ff) ne "FeatureFlag")
|
|
58 |
{
|
|
59 |
printf ("Feature flag uid 0x%0x was not already in $datfile, creating it.\n", $ffuid);
|
|
60 |
#
|
|
61 |
# Now add a new feature. The three arguments are UID, status flags (not defined
|
|
62 |
# here) and user data word.
|
|
63 |
#
|
|
64 |
$ff = FeatureFlag->new($ffuid, undef, 0x00000000);
|
|
65 |
die "Couldn't create new feature flag object.\n" unless(ref($ff));
|
|
66 |
|
|
67 |
#
|
|
68 |
# Add it to our existing feature data.
|
|
69 |
#
|
|
70 |
$fmc->AddFeatureFlag($ff) or die "Couldn't add new feature flag..\n";
|
|
71 |
|
|
72 |
printf ("Feature flag uid 0x%0x created ok.\n", $ffuid);
|
|
73 |
}
|
|
74 |
|
|
75 |
$ff->Supported(1);
|
|
76 |
$ff->Upgradable(0);
|
|
77 |
$ff->Modifiable(0);
|
|
78 |
$ff->BlackListed(0);
|
|
79 |
$ff->Uninitialized(0);
|
|
80 |
$ff->Persisted(0);
|
|
81 |
}
|
|
82 |
#
|
|
83 |
# Now write out the file to a new location
|
|
84 |
#
|
|
85 |
$fmc->WriteToFile($datfile2) or die "Couldn't write feature data file '$datfile2'\n";
|
|
86 |
|
|
87 |
rename($datfile, $datfileback) or die "Couldn't backup feature data file '$datfile'\n";
|
|
88 |
rename($datfile2, $datfile) or die "Couldn't copy feature data file '$datfile2'\n";
|
|
89 |
|
|
90 |
printf ("\tFeature Database setup\n");
|
|
91 |
#
|
|
92 |
# Example code to remove a feature flag.
|
|
93 |
#
|
|
94 |
#$fmc->RemoveFeatureFlagByUID($ffuid) or die "Couldn't remove feature flag\n";
|
|
95 |
|