sdkcreationmw/sdkruntimes/AsyStub/src/AsyStubService.cpp
author Shabe Razvi <shaber@symbian.org>
Thu, 04 Nov 2010 17:22:05 +0000
changeset 4 b3b823debf08
parent 0 b26acd06ea60
permissions -rw-r--r--
Workaround for Bug 3917 - CWinsockInterface::DataSent calls NotifyDataSent which is not implemented.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
// INCLUDE FILES
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#include "ASYStubObserver.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#include "TfAccessoryTestControlTypes.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
#include <AccConGenericID.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#include <AccPolProprietaryNameValuePairs.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
// ----------------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
// CASYStubService::CASYStubService() 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
// ----------------------------------------------------------------------------------	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
CASYStubService::CASYStubService() 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
	{			
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
	}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
// ----------------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
// CASYStubService::ConstructL() 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
// ----------------------------------------------------------------------------------	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
void CASYStubService::ConstructL(void) 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
	{					
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
	TInt err(KErrNone);	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
	err = iAccessoryServer.Connect();                
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
	if ( err != KErrNone )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
        User::Leave( err );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
	err = iAccessoryControl.CreateSubSession( iAccessoryServer ); 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
	if ( err != KErrNone )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
        User::Leave( err );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
        }    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
	}	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
//
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
// ----------------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
// CASYStubService::~CASYStubService()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
// ----------------------------------------------------------------------------------	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
CASYStubService::~CASYStubService()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
	{				  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
    iAccessoryControl.CloseSubSession();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
    iAccessoryServer.Close();   
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
	}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
//
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
// ----------------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
// CASYStubService::Service()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
// ----------------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
void CASYStubService::Service(  TTFASYReference aMethod, TInt64 aParam1 )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
    switch ( aMethod )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
        case ETFAsyConn:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
            {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
            TRequestStatus status;		   			    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
            CAccConfigFileParser* accConfigFileParser = CAccConfigFileParser::NewL( _L("Configuration file"));	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
            
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
            TBuf<12> HWModelID;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
            HWModelID.Num(aParam1);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
            CAccConGenericID* genericID = CAccConGenericID::NewL();   
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
            CleanupStack::PushL( genericID);	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
            accConfigFileParser->FindL( genericID, aParam1, HWModelID );			
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
            
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
            iAccessoryControl.ConnectAccessory( status, genericID, EFalse);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
            
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
            User::WaitForRequest(status);	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
            TInt retval = status.Int();	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
            
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
            iGenericId = genericID->GenericID();	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
            CleanupStack::PopAndDestroy( genericID);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
            delete accConfigFileParser;		
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
                            
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
            }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    96
        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    97
        case ETFAsyDisc:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    98
            {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    99
            TRequestStatus status;		   			    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   100
            iAccessoryControl.DisconnectAccessory(status, iGenericId);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   101
            User::WaitForRequest(status);	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   102
            TInt retval = status.Int();						
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   103
            }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   104
            break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   105
        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   106
        default:		 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   107
            break;			
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   108
        }           
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   109
    }    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   110
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   111
//
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   112
// ----------------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   113
// CASYStubService::GetTestCaseID()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   114
// ----------------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   115
 TTFCapability CASYStubService::GetAndRemoveCapability()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   116
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   117
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   118
    TTFCapability aCapabilityS; // Jihuu
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   119
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   120
    if( iCapabilityArray.Count() != 0 )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   121
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   122
        aCapabilityS.iCapability = iCapabilityArray[0].iCapability;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   123
        aCapabilityS.iValue  = iCapabilityArray[0].iValue;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   124
        aCapabilityS.iTimeMs = iCapabilityArray[0].iTimeMs;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   125
        iCapabilityArray.Remove(0);    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   126
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   127
    else
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   128
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   129
        aCapabilityS.iCapability = 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   130
        aCapabilityS.iValue = 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   131
        aCapabilityS.iTimeMs = 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   132
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   133
        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   134
    return aCapabilityS;     
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   135
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   136
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   137
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   138
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   139