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