applications/SymbianLogo_TextShell/SymbianLogo.cpp
author John Kern <johnk@symbian.org>
Thu, 12 Nov 2009 09:14:36 -0800
changeset 21 05914789ab43
parent 19 2dd1d22cb0f3
permissions -rw-r--r--
merged branch into tip
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     1
/*******************************************************************************
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     2
* Copyright (c) 2009 Accenture
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     3
* All rights reserved. This program and the accompanying materials
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     4
* are made available under the terms of the Eclipse Public License v1.0
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     5
* which accompanies this distribution, and is available at
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     6
* http://www.eclipse.org/legal/epl-v10.html
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     7
*
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     8
* Contributors:
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
     9
* Accenture - Johnathan White
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    10
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    11
*******************************************************************************/
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    12
// SymbianLogo.cpp
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    13
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    14
#include <e32std.h>
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    15
#include <e32cons.h>
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    16
#include <f32file.h>
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    17
#include <hal.h>
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    18
#include <S32FILE.H> 
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    19
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    20
void SetupConsoleL();
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    21
void DisplayLogoL(CConsoleBase* aConsole);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    22
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    23
CConsoleBase* console;
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    24
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    25
GLDEF_C TInt E32Main()									
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    26
    {
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    27
	CTrapCleanup* cleanup=CTrapCleanup::New();			
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    28
	TRAPD(error,SetupConsoleL());	
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    29
	if(error)
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    30
		RDebug::Printf("SymbianLogo SetupError %d", error);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    31
	delete cleanup;										
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    32
	return 0;									
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    33
    }
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    34
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    35
void SetupConsoleL()									
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    36
    {
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    37
	console=Console::NewL(_L("SymbianLogo"),
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    38
	TSize(KConsFullScreen,KConsFullScreen));
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    39
	
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    40
	CleanupStack::PushL(console);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    41
	TRAPD(error,DisplayLogoL(console));					
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    42
	if(error)
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    43
		RDebug::Printf("SymbianLogo DisplayLogo Error %d", error);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    44
	CleanupStack::PopAndDestroy();						
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    45
    }
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    46
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    47
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    48
GLDEF_C void DisplayLogoL(CConsoleBase* aConsole)
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    49
    {
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    50
	TInt err =KErrNone;
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    51
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    52
	//Connect to FileServer
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    53
    RFs fs;
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    54
    err = fs.Connect();
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    55
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    56
	User::LeaveIfError(err);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    57
    
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    58
	//Open file 
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    59
	
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    60
	/*
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    61
	File \sf\adaptation\qemu\baseport\syborg\syborg.dts contains board model description, the hostfs@0 block defines both the host path
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    62
	and target drive. The hostpath is by default set to \svphostfs\ and default drive number is 19 (S:\). If you would like to change this 
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    63
	edit the dts file and use arm-none-symbianelf-dtc.exe to create updated dtb file
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    64
	*/
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    65
    RFile file; 
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    66
    err = file.Open(fs, _L("S:\\symbian_logo.bmp"), EFileRead);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    67
    
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    68
	User::LeaveIfError(err);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    69
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    70
	//Use to read stream from file on HostFs, first 54 bytes are header so skip
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    71
	/*
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    72
	symbian_logo.bmp is a 480*480 bmp file
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    73
	*/
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    74
    RFileReadStream filestream(file, 54);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    75
    
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    76
	
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    77
	//Obtain base address of framebuffer which will copy bitmap data into to display
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    78
    TInt iScreenAddress;
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    79
    HAL::Get(HAL::EDisplayMemoryAddress, iScreenAddress);
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    80
	TUint8* pointer = (TUint8*)iScreenAddress;
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    81
    
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    82
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    83
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    84
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    85
    pointer+=640*479*4; //bitmap is 480*480 where as display is 640 *640, start by incrementing display pointer to last line required
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    86
	for(TInt i=0;i<480;i++)
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    87
		{
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    88
		for(TInt j=0;j<1920;j++)
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    89
    		{
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    90
			*pointer = filestream.ReadUint8L(); //reads byte from file into correct offset in framebuffer
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    91
			pointer++;
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    92
    		}
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    93
		
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    94
		pointer-=1920; //decrement over offset between each line
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    95
		pointer-=640*4; //decrement to start of next line    
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    96
	}
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    97
    
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    98
    //Wait for User to press key then return
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
    99
	aConsole->Getch();
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
   100
	return;
2dd1d22cb0f3 Add TextShell example application, enable display pointer, fix issue with abstract class in sounddriver
johnathan.white@2718R8BGH51
parents:
diff changeset
   101
	}