cbsref/telephonyrefplugins/atltsy/config/modifycenrep.pl
author hgs
Tue, 22 Jun 2010 11:02:32 +0100
changeset 44 8b72faa1200f
permissions -rw-r--r--
201024_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     1
#!perl -w
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     2
# Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     3
# All rights reserved.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     4
# This component and the accompanying materials are made available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     6
# which accompanies this distribution, and is available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     8
#
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     9
# Initial Contributors:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    10
# Symbian Foundation - initial contribution.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    11
#
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    12
# Contributors:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    13
#
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    14
# Description:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    15
# This script modifies the CCE plugin cenrep file to use the CS plugin rather than the VCC one.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    16
# 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    17
#
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    18
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    19
use strict;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    20
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    21
# Open the cenrep files
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    22
my $cenrep = "/epoc32/release/winscw/UDEB/z/private/10202be9/10282E7F.txt";
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    23
my $newcenrep = "/epoc32/release/winscw/UDEB/z/private/10202be9/10282E7F.tmp";
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    24
my $cenrepbak = "/epoc32/release/winscw/UDEB/z/private/10202be9/10282E7F.bak";
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    25
my $file2string;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    26
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    27
# Open the file in UNICODE-16 and read the whole contents into a string
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    28
open(my $CENREPREAD, "<:raw:encoding(UTF-16LE):crlf:utf8", $cenrep) or die "Couldn't open current cenrep file";
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    29
{
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    30
$/ =undef;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    31
$file2string = <$CENREPREAD>;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    32
}
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    33
close($CENREPREAD);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    34
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    35
# Modify the crucial line to the new UID for CS calls rather than VCC
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    36
$file2string =~ s/0x9001 string \"536924074\"/0x9001 string \"271067365\"/g;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    37
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    38
# Write out the contents into a new UNICODE-16 encoded file
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    39
open(my $CENREPOUT, ">:raw:encoding(UTF-16LE):crlf:utf8", $newcenrep) or die "Couldn't open new cenrep file for output";
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    40
print $CENREPOUT $file2string;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    41
close($CENREPOUT);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    42
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    43
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    44
# Now backup the old and copy the new files
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    45
rename($cenrep, $cenrepbak) or die "Couldn't backup feature data file '$cenrep'\n" unless (-e $cenrepbak); # OK for this to fail as it probably just means there's already a backup
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    46
rename($newcenrep, $cenrep) or die "Couldn't copy feature data file '$newcenrep'\n";
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    47
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    48
print "\tCCE CenRep Setup\n";