24
|
1 |
// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Direct Connection State Machine
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file Nd_dirct.cpp
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "ND_DIRCT.H"
|
|
23 |
#include "ND_SCR.H"
|
|
24 |
#include "ND_DBACC.H"
|
|
25 |
#include "ND_STD.H"
|
|
26 |
#include "SLOGGER.H"
|
|
27 |
#include "ND_DIRECTSTATES.H"
|
|
28 |
|
|
29 |
CDirCtAgXSM* CDirCtAgXSM::NewL(MAgentNotify& aControllerObserver, CDialogProcessor* aDlgPrc, CCommsDbAccess& aDbAccess)
|
|
30 |
/**
|
|
31 |
2 phased constructor, first phase.
|
|
32 |
|
|
33 |
@param aControllerObserver a reference to state machine observer.
|
|
34 |
@param aDlgPrc a pointer to dialog processor.
|
|
35 |
@param aDbAccess a referecen to CommDB accessor
|
|
36 |
@exception Leaves if ConstructL() leaves, or not enough memory is available.
|
|
37 |
@return a new CDirCtAgXSM object.
|
|
38 |
*/
|
|
39 |
{
|
|
40 |
CDirCtAgXSM* r=new(ELeave) CDirCtAgXSM(aControllerObserver,aDlgPrc,aDbAccess);
|
|
41 |
CleanupStack::PushL(r);
|
|
42 |
r->ConstructL();
|
|
43 |
CleanupStack::Pop();
|
|
44 |
return r;
|
|
45 |
}
|
|
46 |
|
|
47 |
CDirCtAgXSM::~CDirCtAgXSM()
|
|
48 |
/**
|
|
49 |
Destructor. Cancels active requests.
|
|
50 |
*/
|
|
51 |
{
|
|
52 |
Cancel();
|
|
53 |
}
|
|
54 |
|
|
55 |
CDirCtAgXSM::CDirCtAgXSM(MAgentNotify& aControllerObserver, CDialogProcessor* aDlgPrc, CCommsDbAccess& aDbAccess)
|
|
56 |
: CNetdialSM(aControllerObserver, aDlgPrc,aDbAccess)
|
|
57 |
/**
|
|
58 |
Private constructor used in the first phase of construction.
|
|
59 |
|
|
60 |
@param aControllerObserver a reference to state machine observer.
|
|
61 |
@param aDlgPrc a pointer to the dialog processor.
|
|
62 |
@param aDbAccess a reference to the database accessor.
|
|
63 |
*/
|
|
64 |
{}
|
|
65 |
|
|
66 |
void CDirCtAgXSM::ConstructL()
|
|
67 |
/**
|
|
68 |
Private constructor used in the first phase of construction.
|
|
69 |
|
|
70 |
@exception Leaves if CommDB accessor or direct connection state machine creation leaves.
|
|
71 |
*/
|
|
72 |
{
|
|
73 |
//Instantiate Member variables
|
|
74 |
iDbAccess=CCommsDbNetDialAccess::NewL(iDb);
|
|
75 |
|
|
76 |
//Start off the state machine with an Initial state which contains no functionality
|
|
77 |
iState=CDirCtInit::NewL(*this,*this);
|
|
78 |
}
|
|
79 |
|
|
80 |
void CDirCtAgXSM::SetUpScriptL()
|
|
81 |
/**
|
|
82 |
Sets up script for direct connection
|
|
83 |
|
|
84 |
@exception Leaves if GetCommPortForDirectConnectL(), GetScriptDetailsL() or script creation leaves.
|
|
85 |
*/
|
|
86 |
{
|
|
87 |
RCall::TCommPort commPort;
|
|
88 |
iDbAccess->GetCommPortForDirectConnectL(commPort);
|
|
89 |
TCommRole role;
|
|
90 |
iDbAccess->GetCommPortRoleL(role);
|
|
91 |
TInt len;
|
|
92 |
iDbAccess->GetScriptDetailsL(iUseScript,len);
|
|
93 |
|
|
94 |
if (!iUseScript || len==0)
|
|
95 |
{ // set them consistently
|
|
96 |
iUseScript=EFalse;
|
|
97 |
}
|
|
98 |
|
|
99 |
if (iNdScript != NULL)
|
|
100 |
{
|
|
101 |
delete iNdScript;
|
|
102 |
iNdScript = NULL;
|
|
103 |
}
|
|
104 |
|
|
105 |
iNdScript=CNetDialScript::NewL(iDbAccess,iDlgPrc,commPort,role,len); // create it whatever because we need other stuff
|
|
106 |
}
|
|
107 |
|
|
108 |
TInt CDirCtAgXSM::Notification(TNifToAgentEventType /*aEvent*/, TAny* /*aInfo*/)
|
|
109 |
/**
|
|
110 |
Not supported by direct connection state machine.
|
|
111 |
*/
|
|
112 |
{
|
|
113 |
return KErrNotSupported;
|
|
114 |
}
|
|
115 |
|
|
116 |
TInt CDirCtAgXSM::IncomingConnectionReceived()
|
|
117 |
/**
|
|
118 |
Not supported by direct connection state machine.
|
|
119 |
*/
|
|
120 |
{
|
|
121 |
return KErrNotSupported;
|
|
122 |
}
|
|
123 |
|