author | Tom Pritchard <tomp@symbian.org> |
Tue, 23 Feb 2010 20:17:55 +0000 | |
branch | AT_Test_LTSY |
changeset 4 | 3cf043a18b40 |
child 5 | c646ab78f948 |
permissions | -rw-r--r-- |
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 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
26 |
my $datfile = "/epoc32/data/config/features.dat"; |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
27 |
my $datfile2 = "/epoc32/data/config/features2.dat"; |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
28 |
my $datfileback = "/epoc32/data/config/features.bak"; |
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 |
|
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
44 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
45 |
# Device supports GSM cellular stack. |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
46 |
# const TInt KFeatureIdProtocolGsm = 81; |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
47 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
48 |
# Device supports WCDMA cellular stack |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
49 |
# const TInt KFeatureIdProtocolWcdma = 82; |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
50 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
51 |
# KFeatureIdOnScreenDialer 1696 |
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 |
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
|
54 |
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
|
55 |
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
|
56 |
|
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
57 |
$tomtab[0] = 81; |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
58 |
$tomtab[1] = 82; |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
59 |
$tomtab[1] = 1696; |
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 |
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
|
62 |
#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
|
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 = $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
|
65 |
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
|
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 |
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
|
68 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
69 |
# 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
|
70 |
# 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
|
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 |
$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
|
73 |
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
|
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 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
76 |
# 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
|
77 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
78 |
$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
|
79 |
|
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
80 |
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
|
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 |
$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
|
84 |
$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
|
85 |
$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
|
86 |
$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
|
87 |
$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
|
88 |
$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
|
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 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
91 |
# 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
|
92 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
93 |
$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
|
94 |
|
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
95 |
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
|
96 |
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
|
97 |
|
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
98 |
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
|
99 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
100 |
# 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
|
101 |
# |
3cf043a18b40
Adding config script - now you should be able to run ConfigAtModem from this folder
Tom Pritchard <tomp@symbian.org>
parents:
diff
changeset
|
102 |
#$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
|
103 |