|
1 // Copyright (c) 2006-2009 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 // |
|
15 |
|
16 #include <dummystates.h> |
|
17 #include <dummyactivities.h> |
|
18 #include "Node2Factory.h" |
|
19 #include "Node2.h" |
|
20 |
|
21 using namespace Messages; |
|
22 using namespace MeshMachine; |
|
23 using namespace Dummy; |
|
24 |
|
25 #ifdef SYMBIAN_TRACE_ENABLE |
|
26 _LIT8(KNode2Tag, "Node2"); |
|
27 #endif |
|
28 |
|
29 namespace Node2StartActivity |
|
30 { |
|
31 |
|
32 DECLARE_SMELEMENT_HEADER( TMarkSenderActive, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext ) |
|
33 virtual void DoL() |
|
34 { |
|
35 iContext.iPeer->SetFlags(TDummyClientType::EActive); |
|
36 } |
|
37 DECLARE_SMELEMENT_FOOTER( TMarkSenderActive ) |
|
38 |
|
39 DECLARE_AGGREGATED_TRANSITION2( |
|
40 TPostStartedAndMarkActive, |
|
41 MeshMachine::TPostMessageToSender<TStartProtocol::TStarted>, |
|
42 Node2StartActivity::TMarkSenderActive |
|
43 ) |
|
44 } |
|
45 |
|
46 namespace Node2StartActivity |
|
47 { |
|
48 DECLARE_DEFINE_NODEACTIVITY(EActivityStart, Node2Start, TStartProtocol::TStart) |
|
49 NODEACTIVITY_ENTRY(KNoTag, TPostStartedAndMarkActive, DummyStates::TAwaitingStart, MeshMachine::TNoTag) |
|
50 NODEACTIVITY_END() |
|
51 } |
|
52 |
|
53 namespace DummyActivities |
|
54 { |
|
55 DECLARE_DEFINE_ACTIVITY_MAP(node2Activities) |
|
56 ACTIVITY_MAP_ENTRY(Node2StartActivity, Node2Start) |
|
57 ACTIVITY_MAP_END_BASE(DummyActivities, dummyActivities) |
|
58 } |
|
59 |
|
60 //-========================================================= |
|
61 // |
|
62 // CNode2 methods |
|
63 // |
|
64 //-========================================================= |
|
65 CNode2* CNode2::NewL(CNode2Factory& aFactory) |
|
66 { |
|
67 CNode2* provider = new (ELeave) CNode2(aFactory); |
|
68 CleanupStack::PushL(provider); |
|
69 provider->ConstructL(); |
|
70 CleanupStack::Pop(provider); |
|
71 return provider; |
|
72 } |
|
73 |
|
74 CNode2::CNode2(CNode2Factory& aFactory) |
|
75 : CTestNodeBase(aFactory, DummyActivities::node2Activities::Self()) |
|
76 { |
|
77 NM_LOG_NODE_CREATE(KNode2Tag, CNode2); |
|
78 } |
|
79 |
|
80 CNode2::~CNode2() |
|
81 { |
|
82 NM_LOG_NODE_DESTROY(KNode2Tag, CNode2); |
|
83 } |
|
84 |
|
85 void CNode2::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) |
|
86 { |
|
87 //Uncomment below if you want to see the error handling |
|
88 //if (aMessage.IsMessage<TDummyMessage::TStart>()) |
|
89 // { |
|
90 // User::Leave(KErrNoMemory); |
|
91 // } |
|
92 CTestNodeBase::ReceivedL(aSender, aRecipient, aMessage); |
|
93 } |
|
94 |
|
95 TUid CNode2::ServiceProviderUid() const |
|
96 { |
|
97 User::Invariant(); //Never supposed to be called! |
|
98 return TUid::Uid(0x00000000); |
|
99 } |
|
100 |