telephonyserverplugins/attestltsy/config/modifyfeaturedb.pl
branchAT_Test_LTSY
changeset 4 3cf043a18b40
child 5 c646ab78f948
equal deleted inserted replaced
3:70f1e1f5dabe 4:3cf043a18b40
       
     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/data/config/features.dat";
       
    27 my $datfile2 = "/epoc32/data/config/features2.dat";
       
    28 my $datfileback = "/epoc32/data/config/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 #
       
    45 #	Device supports GSM cellular stack.
       
    46 #    const TInt KFeatureIdProtocolGsm = 81;
       
    47 #
       
    48 #	Device supports WCDMA cellular stack   
       
    49 # 	const TInt KFeatureIdProtocolWcdma = 82;
       
    50 #
       
    51 #   KFeatureIdOnScreenDialer                            1696
       
    52 #
       
    53 my $ffuid;
       
    54 my $ff;
       
    55 my @tomtab;
       
    56 
       
    57 $tomtab[0] = 81;
       
    58 $tomtab[1] = 82;
       
    59 $tomtab[1] = 1696;
       
    60 
       
    61 foreach $ffuid (@tomtab)
       
    62 #for ($ffuid = 1696; $ffuid <= 1696; $ffuid++)
       
    63 {
       
    64 	$ff = $fmc->GetFeatureFlagByUID($ffuid);
       
    65 	if(ref($ff) ne "FeatureFlag")
       
    66 	{
       
    67 		printf ("Feature flag uid 0x%0x was not already in $datfile, creating it.\n", $ffuid);
       
    68 		#
       
    69 		# Now add a new feature. The three arguments are UID, status flags (not defined
       
    70 		# here) and user data word.
       
    71 		#
       
    72 		$ff = FeatureFlag->new($ffuid, undef, 0x00000000);
       
    73 		die "Couldn't create new feature flag object.\n" unless(ref($ff));
       
    74 			
       
    75 		#
       
    76 		# Add it to our existing feature data.
       
    77 		#
       
    78 		$fmc->AddFeatureFlag($ff) or die "Couldn't add new feature flag..\n";
       
    79 
       
    80 		printf ("Feature flag uid 0x%0x created ok.\n", $ffuid);
       
    81 	} 
       
    82 
       
    83 	$ff->Supported(1);
       
    84 	$ff->Upgradable(0);
       
    85 	$ff->Modifiable(0);
       
    86 	$ff->BlackListed(0);
       
    87 	$ff->Uninitialized(0);
       
    88 	$ff->Persisted(0);
       
    89 }
       
    90 #
       
    91 # Now write out the file to a new location
       
    92 #
       
    93 $fmc->WriteToFile($datfile2) or die "Couldn't write feature data file '$datfile2'\n";
       
    94 
       
    95 rename($datfile, $datfileback) or die "Couldn't backup feature data file '$datfile'\n";
       
    96 rename($datfile2, $datfile) or die "Couldn't copy feature data file '$datfile2'\n";
       
    97 
       
    98 printf ("\tFeature Database setup\n");
       
    99 #
       
   100 # Example code to remove a feature flag.
       
   101 #
       
   102 #$fmc->RemoveFeatureFlagByUID($ffuid) or die "Couldn't remove feature flag\n";
       
   103