--- a/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp Sat Feb 20 00:01:55 2010 +0200
+++ b/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -697,7 +697,6 @@
iRetryingForMessageId = msg.iErrResponse.iMessageId;
aActivity.ACore::DoCurrent(storedContext);
aContext.Node().HandleMessageReturnValue(*storedContext);
- iContextDesc.Zero();
}
//-=========================================================
--- a/commsfwsupport/commselements/testing/ElementServer/src/StateMachineStep.cpp Sat Feb 20 00:01:55 2010 +0200
+++ b/commsfwsupport/commselements/testing/ElementServer/src/StateMachineStep.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -16,7 +16,7 @@
//
#include "StateMachineStep.h"
-#include <testexecutelog.h>
+#include <test/testexecutelog.h>
void CElementStateMachineTestBase::Setup()
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/NMExample1/data/utddefs.txt Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,108 @@
+//
+// Node Messages basic message and message signature definitions
+//
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+// Define ENUM TStateChangeStage before including this file
+// Define ENUM ActivityId before including this file
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+CONST KNodeMessagesImplementationUid = 0x10285F38
+CONST KWhisperRealmId = 0x2002984C
+
+ENUM NM_SignatureId : UINT32
+ ESignalBase =0
+ ENodeSignal =1
+ ESignatureBase =2
+ ESignatureNumber =3
+ ESignatureUid =4
+ ESignatureErrContext =5
+ ESignatureErrResponse =6
+
+ ESignatureNodeId =8
+ ESignatureNodeIdNumber =9
+ ESignatureNodeIdNumberNumber =10
+ ESignatureMessageIdNumber =11
+ ESignatureAnyNumber =12
+ ESignatureMetaDataPtr =13
+ ESignatureNumberNumberNumber =14
+ ESignatureRMessage2 =15
+ ESignatureNumberRMessage2 =16
+ ESignatureAny =17
+ ESignatureNumberNumber =18
+ ESignatureNodeIdAny =19
+ ESignatureNodeIdNodeId =20
+ ESignatureNodeIdNodeIdNumber =21
+ ESignatureNumberNumberNumberNumber =22
+ ESignatureUidNumber =23
+ ESignatureNumberUidNumber =24
+ ESignatureNodeIdClientType =25
+ ESignatureClientTypeUidClientType =26
+ ESignatureClientType =27
+ ESignatureClientTypeUid =28
+ ESignatureMessageId =29
+ ESignatureNodeIdNumberNumberNumber =30
+ ESignatureTypeId =31
+END ENUM
+
+ENUM Whisper_SignatureId : UINT32
+ EStringSigId =1
+END ENUM
+
+CONTEXT Context_RuntimeCtxId
+// UINT8 iSize
+// UINT8 iSalt
+// UINT16 iThread
+// UINT32 iScope
+ PAD 8
+END CONTEXT
+
+CONTEXT Context_NodeId : Context_RuntimeCtxId
+ UINT32 iPtr
+END CONTEXT
+
+ALIAS CONTEXT TCommsId = Context_NodeId
+
+STRUCT STypeId
+ UINT32 iUid
+ UINT32 iTypeId
+END STRUCT
+
+SIGNATURE TSignalBase
+ TYPEID = KNodeMessagesImplementationUid:ESignalBase
+END SIGNATURE
+
+SIGNATURE TNodeSignal : TSignalBase
+ TYPEID = KNodeMessagesImplementationUid:ENodeSignal
+ TMessageId iMessageId
+END SIGNATURE
+
+// Synonymous with TSigVoid
+SIGNATURE TSignatureBase : TNodeSignal
+ TYPEID = KNodeMessagesImplementationUid:ESignatureBase
+END SIGNATURE
+
+SIGNATURE TSigNumber : TSignatureBase
+ TYPEID = KNodeMessagesImplementationUid:ESignatureNumber
+ UINT32 iValue
+END SIGNATURE
+
+ALIAS SIGNATURE TSigVoid = TSignatureBase
+
+SIGNATURE TSigString : TSignatureBase
+ TYPEID = KWhisperRealmId:EStringSigId
+ PAD 0x30
+END SIGNATURE
+
+ENUM Whisper_MessageId : UINT16
+ EWhisper = 1
+END ENUM
+
+MESSAGE Whisper
+ SIGNATURE = TSigString
+ MESSAGEID = KWhisperRealmId:EWhisper
+END MESSAGE
+
+
+
+
--- a/commsfwsupport/commselements/testing/examplecode/NMExample1/group/bld.inf Sat Feb 20 00:01:55 2010 +0200
+++ b/commsfwsupport/commselements/testing/examplecode/NMExample1/group/bld.inf Fri Mar 12 15:49:41 2010 +0200
@@ -15,5 +15,9 @@
PRJ_PLATFORMS
BASEDEFAULT
+
+PRJ_EXPORTS
+../data/utddefs.txt /epoc32/tools/commsfw/nmexample1.definition.txt
+
PRJ_MMPFILES
NMExample1
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/data/utddefs.txt Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,133 @@
+//
+// Node Messages basic message and message signature definitions
+//
+
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+// Define ENUM TStateChangeStage before including this file
+// Define ENUM ActivityId before including this file
+// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+CONST KNodeMessagesImplementationUid = 0x10285F38
+
+
+ENUM ActivityId : UINT8
+ ActivityTimer = 1
+ ActivityTrafficLight = 2
+ ActivityController = 3
+END ENUM
+
+ENUM NM_SignatureId : UINT32
+ ESignalBase =0
+ ENodeSignal =1
+ ESignatureBase =2
+ ESignatureNumber =3
+ ESignatureUid =4
+ ESignatureErrContext =5
+ ESignatureErrResponse =6
+
+ ESignatureNodeId =8
+ ESignatureNodeIdNumber =9
+ ESignatureNodeIdNumberNumber =10
+ ESignatureMessageIdNumber =11
+ ESignatureAnyNumber =12
+ ESignatureMetaDataPtr =13
+ ESignatureNumberNumberNumber =14
+ ESignatureRMessage2 =15
+ ESignatureNumberRMessage2 =16
+ ESignatureAny =17
+ ESignatureNumberNumber =18
+ ESignatureNodeIdAny =19
+ ESignatureNodeIdNodeId =20
+ ESignatureNodeIdNodeIdNumber =21
+ ESignatureNumberNumberNumberNumber =22
+ ESignatureUidNumber =23
+ ESignatureNumberUidNumber =24
+ ESignatureNodeIdClientType =25
+ ESignatureClientTypeUidClientType =26
+ ESignatureClientType =27
+ ESignatureClientTypeUid =28
+ ESignatureMessageId =29
+ ESignatureNodeIdNumberNumberNumber =30
+ ESignatureTypeId =31
+END ENUM
+
+
+CONTEXT Context_RuntimeCtxId
+// UINT8 iSize
+// UINT8 iSalt
+// UINT16 iThread
+// UINT32 iScope
+ PAD 8
+END CONTEXT
+
+CONTEXT Context_NodeId : Context_RuntimeCtxId
+ UINT32 iPtr
+END CONTEXT
+
+CONTEXT Context_NodeCtxId : Context_NodeId
+ ActivityId iNodeCtx // low byte of activity id
+ PAD 1 // high byte of activity id
+ PAD 2 // 2-byte padding
+END CONTEXT
+
+ALIAS CONTEXT TCommsId = Context_NodeId
+
+STRUCT STypeId
+ UINT32 iUid
+ UINT32 iTypeId
+END STRUCT
+
+SIGNATURE TSignalBase
+ TYPEID = KNodeMessagesImplementationUid:ESignalBase
+END SIGNATURE
+
+SIGNATURE TNodeSignal : TSignalBase
+ TYPEID = KNodeMessagesImplementationUid:ENodeSignal
+ TMessageId iMessageId
+END SIGNATURE
+
+// Synonymous with TSigVoid
+SIGNATURE TSignatureBase : TNodeSignal
+ TYPEID = KNodeMessagesImplementationUid:ESignatureBase
+END SIGNATURE
+
+SIGNATURE TSigNumber : TSignatureBase
+ TYPEID = KNodeMessagesImplementationUid:ESignatureNumber
+ UINT32 iValue
+END SIGNATURE
+
+ALIAS SIGNATURE TSigVoid = TSignatureBase
+
+
+CONST KExampleRealmId = 0x2002D4B3
+
+ENUM Base_MessageId : UINT16
+ EGoGreen = 1
+ EGoneRed = 2
+ EWait = 3
+ EGo = 4
+END ENUM
+
+MESSAGE GoGreen
+ SIGNATURE = TSignatureBase
+ MESSAGEID = KExampleRealmId:EGoGreen
+END MESSAGE
+
+MESSAGE GoneRed
+ SIGNATURE = TSignatureBase
+ MESSAGEID = KExampleRealmId:EGoneRed
+END MESSAGE
+
+MESSAGE Wait
+ SIGNATURE = TSigNumber
+ MESSAGEID = KExampleRealmId:EWait
+END MESSAGE
+
+MESSAGE Go
+ SIGNATURE = TSignatureBase
+ MESSAGEID = KExampleRealmId:EGo
+END MESSAGE
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/group/bld.inf Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,22 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+PRJ_PLATFORMS
+BASEDEFAULT
+
+PRJ_EXPORTS
+../data/utddefs.txt /epoc32/tools/commsfw/mmexample1.definition.txt
+
+PRJ_MMPFILES
+MMExample1
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/group/mmexample1.mmp Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,37 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+target MMExample1.exe
+targettype exe
+
+UID 0x1000007A 0x2002D4B3
+VENDORID 0x70000001
+
+sourcepath ../src
+source MMExample1.cpp
+source MMExample1nodes.cpp
+source MMExample1states.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+userinclude ../inc
+library euser.lib
+library nodemessages.lib
+library meshmachine.lib
+library commsfw.lib
+library netmeta.lib
+library virtualconstructors.lib
+
+CAPABILITY None
+
+SMPSAFE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/src/mmexample1.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,165 @@
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+#include <e32base.h>
+#include <e32std.h>
+#include <e32cons.h>
+#include <e32def.h>
+
+#include <elements/cftransport.h>
+#include <elements/nm_common.h>
+#include <elements/nm_node.h>
+#include <elements/nm_log.h>
+#include <elements/nm_address.h>
+#include <elements/nm_signatures.h>
+#include <elements/nm_messages_base.h>
+#include <elements/nm_interfaces.h>
+
+#include <elements/mm_node.h>
+#include <elements/mm_activities.h>
+
+#include <MMExample1states.h>
+
+class TMyWorkerThreadRegister;
+LOCAL_D CConsoleBase* console;
+
+_LIT8(KLoggingTag, "MMExample1");
+
+_LIT(KJunctionPanicCat, "Junction");
+
+const TInt KPanicUnknownMessage = 1;
+
+/**
+ This classes records information about a worker thread, which is useful
+ when nodemessages is running across multiple threads. In this example,
+ nodemessages is running in a single thread.
+
+ Most users of node messages will never need to use this as they will be
+ using node messages from within serverden which does all this setup for
+ you.
+ */
+class TMyWorkerThreadRegister : public CommsFW::MWorkerThreadRegister
+ {
+public:
+ CommsFW::TWorkerId SelfWorkerId() const
+ { return 1; }
+ CommsFW::TWorkerId UpperBoundWorkerId() const
+ { return 1; }
+
+ RAllocator& WorkerHeap(CommsFW::TWorkerId /*aWorkerId*/) const
+ {
+ return User::Allocator();
+ }
+
+ void PanicWorker(CommsFW::TWorkerId /*aWorkerId*/, const TDesC& aCategory, TInt aReason) const
+ {
+ User::Panic(aCategory, aReason);
+ }
+ };
+
+_LIT(KNorth, "North");
+_LIT(KSouth, "South");
+_LIT(KEast, "East");
+_LIT(KWest, "West");
+
+LOCAL_C void MainL ()
+ {
+ /**
+ Setup the environment for passing messages.
+ */
+ TMyWorkerThreadRegister workerregister;
+ Messages::CGlobals* globals = &Messages::TlsGlobals::InstallGlobalsL();
+
+ CommsFW::CCommsTransport* transport = CommsFW::CCommsTransport::NewL(workerregister, globals->VirtualCtor(), NULL);
+ globals->SetTransportSender(&transport->GetSender());
+ globals->SetTransportReceiver(&transport->GetReceiver());
+ CleanupStack::PushL(transport);
+
+ CClock* clock = new(ELeave)CClock();
+ CleanupStack::PushL(clock);
+
+ CController* controller = new(ELeave)CController();
+ CleanupStack::PushL(controller);
+
+ CTrafficLight* north = new(ELeave)CTrafficLight(console, KNorth());
+ CleanupStack::PushL(north);
+ north->AddClientL(clock->Id(), Messages::TClientType(EClock));
+ clock->AddClientL(north->Id(), Messages::TClientType(ETrafficLight));
+ north->AddClientL(controller->Id(), Messages::TClientType(EController));
+ controller->AddClientL(north->Id(), Messages::TClientType(ETrafficLight, ENorth));
+
+ CTrafficLight* south = new(ELeave)CTrafficLight(console, KSouth());
+ CleanupStack::PushL(south);
+ south->AddClientL(clock->Id(), Messages::TClientType(EClock));
+ clock->AddClientL(south->Id(), Messages::TClientType(ETrafficLight));
+ south->AddClientL(controller->Id(), Messages::TClientType(EController));
+ controller->AddClientL(south->Id(), Messages::TClientType(ETrafficLight, ESouth));
+
+ CTrafficLight* east = new(ELeave)CTrafficLight(console, KEast());
+ CleanupStack::PushL(east);
+ east->AddClientL(clock->Id(), Messages::TClientType(EClock));
+ clock->AddClientL(east->Id(), Messages::TClientType(ETrafficLight));
+ east->AddClientL(controller->Id(), Messages::TClientType(EController));
+ controller->AddClientL(east->Id(), Messages::TClientType(ETrafficLight, EEast));
+
+ CTrafficLight* west = new(ELeave)CTrafficLight(console, KWest());
+ CleanupStack::PushL(west);
+ west->AddClientL(clock->Id(), Messages::TClientType(EClock));
+ clock->AddClientL(west->Id(), Messages::TClientType(ETrafficLight));
+ west->AddClientL(controller->Id(), Messages::TClientType(EController));
+ controller->AddClientL(west->Id(), Messages::TClientType(ETrafficLight, EWest));
+
+ Messages::RNodeInterface::OpenPostMessageClose(controller->Id(), controller->Id(), TGo().CRef());
+ CActiveScheduler::Start();
+ CleanupStack::PopAndDestroy(7, transport);
+
+ Messages::TlsGlobals::UnInstallGlobals();
+ }
+
+LOCAL_C void DoStartL ()
+ {
+ CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+ CleanupStack::PushL (scheduler);
+ CActiveScheduler::Install (scheduler);
+
+ MainL ();
+
+ CleanupStack::PopAndDestroy (scheduler);
+ }
+
+GLDEF_C TInt E32Main()
+ {
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+
+ TRAPD(createError, console = Console::NewL(_L("Mesh Machine Junction Example"), TSize(KConsFullScreen,KConsFullScreen)));
+ if (createError)
+ {
+ return createError;
+ }
+
+ TRAPD(mainError, DoStartL());
+ if (mainError)
+ {
+ console->Printf(_L(" failed, leave code = %d"), mainError);
+ }
+ console->Printf(_L(" [press any key]\n"));
+ console->Getch();
+
+ delete console;
+ delete cleanup;
+ __UHEAP_MARKEND;
+ return KErrNone;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/src/mmexample1nodes.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,140 @@
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include <elements/mm_activities.h>
+#include <elements/mm_states.h>
+
+#include "MMExample1states.h"
+#include "MMExample1nodes.h"
+
+_LIT8(KLoggingTag, "MMExample1");
+
+enum TMMExample1ActivityIds
+ {
+ ETimerActivity = 1,
+ ETrafficLightActivity = 2,
+ ETrafficLightControllerActivity = 3
+ };
+
+namespace ClockActivities
+{
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ETimerActivity, Timer, TWait, Clock::CTimerActivity::NewL)
+ FIRST_NODEACTIVITY_ENTRY(MeshMachine::TAwaitingMessageState<TWait>, MeshMachine::TNoTag)
+ NODEACTIVITY_ENTRY(MeshMachine::KNoTag, Clock::TKickOffTimer, MeshMachine::TAwaitingMessageState<TGo>, MeshMachine::TNoTag)
+ LAST_NODEACTIVITY_ENTRY(MeshMachine::KNoTag, MeshMachine::TForwardMessageToOriginators)
+NODEACTIVITY_END()
+}
+
+DECLARE_DEFINE_ACTIVITY_MAP(ClockActivityMap)
+ ACTIVITY_MAP_ENTRY(ClockActivities, Timer)
+ACTIVITY_MAP_END()
+
+CClock::CClock() : MeshMachine::AMMNodeBase(ClockActivityMap::iSelf, Messages::ANodeId::Id())
+ {
+ NM_LOG_NODE_CREATE(KLoggingTag, CClock);
+ }
+
+void CClock::ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aCFMessage)
+ {
+ Messages::TNodeSignal::TMessageId noPeerIds[] = { Messages::TNodeSignal::TMessageId() };
+
+ MeshMachine::TNodeContext<CClock> ctx(*this, aCFMessage, aSender, aRecipient);
+
+ MeshMachine::AMMNodeBase::Received(noPeerIds, ctx);
+ MeshMachine::AMMNodeBase::PostReceived(ctx);
+ User::LeaveIfError(ctx.iReturn);
+ }
+
+
+namespace TrafficLightActivities
+{
+DECLARE_DEFINE_NODEACTIVITY(ETrafficLightActivity, TrafficLight, TGoGreen)
+ FIRST_NODEACTIVITY_ENTRY(MeshMachine::TAwaitingMessageState<TGoGreen>, MeshMachine::TNoTag)
+ NODEACTIVITY_ENTRY(MeshMachine::KNoTag, TrafficLightStates::TGoAmber, MeshMachine::TAwaitingMessageState<TGo>, MeshMachine::TNoTag)
+ NODEACTIVITY_ENTRY(MeshMachine::KNoTag, TrafficLightStates::TGoGreen, MeshMachine::TAwaitingMessageState<TGo>, MeshMachine::TNoTag)
+ NODEACTIVITY_ENTRY(MeshMachine::KNoTag, TrafficLightStates::TGoAmber, MeshMachine::TAwaitingMessageState<TGo>, MeshMachine::TNoTag)
+ LAST_NODEACTIVITY_ENTRY(MeshMachine::KNoTag, TrafficLightStates::TGoRedAndSendGoneRed)
+NODEACTIVITY_END()
+}
+
+DECLARE_DEFINE_ACTIVITY_MAP(TrafficLightActivityMap)
+ ACTIVITY_MAP_ENTRY(TrafficLightActivities, TrafficLight)
+ACTIVITY_MAP_END()
+
+CTrafficLight::CTrafficLight(CConsoleBase* aConsole, const TDesC& aPositionText) : MeshMachine::AMMNodeBase(TrafficLightActivityMap::iSelf, Messages::ANodeId::Id()), iConsole(aConsole), iPositionText(aPositionText)
+ {
+ NM_LOG_NODE_CREATE(KLoggingTag, CTrafficLight);
+
+ SetColour(ERed);
+ }
+
+void CTrafficLight::ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::SignatureBase& aCFMessage)
+ {
+ Messages::TNodeSignal::TMessageId noPeerIds[] = { Messages::TNodeSignal::TMessageId() };
+
+ MeshMachine::TNodeContext<CTrafficLight> ctx(*this, aCFMessage, aSender, aRecipient);
+
+ MeshMachine::AMMNodeBase::Received(noPeerIds, ctx);
+ MeshMachine::AMMNodeBase::PostReceived(ctx);
+ User::LeaveIfError(ctx.iReturn);
+ }
+
+void CTrafficLight::SetColour(TColour aColour)
+ {
+ iColour = aColour;
+
+ switch (aColour)
+ {
+ case ERed:
+ iConsole->Printf(_L("%S set to RED\n"), &iPositionText);
+ break;
+ case EAmber:
+ iConsole->Printf(_L("%S set to AMBER\n"), &iPositionText);
+ break;
+ case EGreen:
+ iConsole->Printf(_L("%S set to GREEN\n"), &iPositionText);
+ break;
+ }
+ }
+
+namespace ControllerActivities
+{
+DECLARE_DEFINE_NODEACTIVITY(ETrafficLightControllerActivity, TrafficLightController, TGo)
+ FIRST_NODEACTIVITY_ENTRY(MeshMachine::TAwaitingMessageState<TGo>, MeshMachine::TNoTag)
+ NODEACTIVITY_ENTRY(ControllerStates::KStart, ControllerStates::TEastAndWestGreen, ControllerStates::TAwaitingAllRed, MeshMachine::TNoTag)
+ NODEACTIVITY_ENTRY(MeshMachine::KNoTag, ControllerStates::TNorthAndSouthGreen, ControllerStates::TAwaitingAllRed, MeshMachine::TTag<ControllerStates::KStart|NetStateMachine::EBackward>)
+NODEACTIVITY_END()
+}
+
+DECLARE_DEFINE_ACTIVITY_MAP(ControllerActivityMap)
+ ACTIVITY_MAP_ENTRY(ControllerActivities, TrafficLightController)
+ACTIVITY_MAP_END()
+
+CController::CController() : MeshMachine::AMMNodeBase(ControllerActivityMap::iSelf, Messages::ANodeId::Id())
+ {
+ NM_LOG_NODE_CREATE(KLoggingTag, CController);
+ }
+
+void CController::ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aCFMessage)
+ {
+ Messages::TNodeSignal::TMessageId noPeerIds[] = { TGo::Id(), Messages::TNodeSignal::TMessageId() };
+
+ MeshMachine::TNodeContext<CController> ctx(*this, aCFMessage, aSender, aRecipient);
+
+ MeshMachine::AMMNodeBase::Received(noPeerIds, ctx);
+ MeshMachine::AMMNodeBase::PostReceived(ctx);
+ User::LeaveIfError(ctx.iReturn);
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/src/mmexample1nodes.h Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,79 @@
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+#ifndef MMEXAMPLE1NODES_H
+#define MMEXAMPLE1NODES_H
+
+#include <e32cons.h>
+#include <elements/nm_node.h>
+#include <elements/mm_node.h>
+
+class CClock : public Messages::ASimpleNodeIdBase,
+ public MeshMachine::AMMNodeBase
+ {
+ // has a parallel activity for timers
+public:
+ CClock();
+
+ virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aCFMessage);
+
+ const Messages::TNodeId& Id() const
+ {
+ return NodeId();
+ }
+
+ };
+
+class CTrafficLight : public Messages::ASimpleNodeIdBase,
+ public MeshMachine::AMMNodeBase
+ {
+public:
+ enum TColour {
+ ERed = 1,
+ EAmber = 2,
+ EGreen = 3
+ };
+
+ CTrafficLight(CConsoleBase* aConsole, const TDesC& aPositionText);
+
+ virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aCFMessage);
+
+ void SetColour(TColour aColour);
+
+ const Messages::TNodeId& Id() const
+ {
+ return NodeId();
+ }
+
+private:
+ TColour iColour;
+ CConsoleBase* iConsole; // for reporting
+ const TDesC& iPositionText;
+ };
+
+class CController : public Messages::ASimpleNodeIdBase,
+ public MeshMachine::AMMNodeBase
+ {
+public:
+ CController();
+ virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aCFMessage);
+
+ const Messages::TNodeId& Id() const
+ {
+ return NodeId();
+ }
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/src/mmexample1states.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,157 @@
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "MMExample1states.h"
+#include <elements/nm_interfaces.h>
+
+using namespace Clock;
+
+CTimerCallback* CTimerCallback::NewL(Messages::TNodeCtxId aOriginator)
+ {
+ CTimerCallback* t = new (ELeave)CTimerCallback(aOriginator);
+ CleanupStack::PushL(t);
+ t->ConstructL();
+ CleanupStack::Pop(t);
+ return t;
+ }
+
+CTimerCallback::CTimerCallback(Messages::TNodeCtxId aOriginator)
+ : CTimer(EPriorityStandard), iOriginator(aOriginator)
+ {
+ }
+
+void CTimerCallback::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+void CTimerCallback::RunL()
+ {
+ Messages::TNodeId nodeid = iOriginator;
+ Messages::RNodeInterface::OpenPostMessageClose(nodeid, iOriginator, TGo().CRef());
+ }
+
+MeshMachine::CNodeActivityBase* CTimerActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode )
+ {
+ TUint c = GetNextActivityCountL(aActivitySig,aNode);
+ return new (ELeave) CTimerActivity( aActivitySig, aNode, c);
+ }
+
+CTimerActivity::CTimerActivity( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode, TUint aNextActivityCount )
+ : CNodeParallelActivityBase(aActivitySig, aNode, aNextActivityCount), iTimer(NULL)
+ {
+ }
+
+CTimerActivity::~CTimerActivity()
+ {
+ if (iTimer)
+ {
+ iTimer->Cancel();
+ }
+ }
+
+DEFINE_SMELEMENT(Clock::TKickOffTimer, NetStateMachine::MStateTransition, Clock::TContext)
+void Clock::TKickOffTimer::DoL()
+ {
+ ASSERT(iContext.iNodeActivity);
+ CTimerActivity* activity = static_cast<CTimerActivity*>(iContext.iNodeActivity);
+
+ ASSERT(!activity->iTimer);
+
+ TWait& msg = Messages::message_cast<TWait>(iContext.iMessage);
+ activity->iTimer = CTimerCallback::NewL(Messages::TNodeCtxId(iContext.ActivityId(), iContext.NodeId()));
+ activity->iTimer->After(msg.iValue * 1000000);
+ activity->SetPostedTo(iContext.NodeId());
+ }
+
+using namespace TrafficLightStates;
+
+DEFINE_SMELEMENT(TrafficLightStates::TGoGreen, NetStateMachine::MStateTransition, TrafficLightStates::TContext)
+void TrafficLightStates::TGoGreen::DoL()
+ {
+ iContext.Node().SetColour(CTrafficLight::EGreen);
+
+ Messages::RNodeInterface* clock = iContext.Node().GetFirstClient<Messages::TDefaultClientMatchPolicy>(Messages::TClientType(EClock));
+ iContext.iNodeActivity->PostRequestTo(*clock, TWait(10).CRef());
+ }
+
+DEFINE_SMELEMENT(TrafficLightStates::TGoAmber, NetStateMachine::MStateTransition, TrafficLightStates::TContext)
+void TrafficLightStates::TGoAmber::DoL()
+ {
+ iContext.Node().SetColour(CTrafficLight::EAmber);
+
+ Messages::RNodeInterface* clock = iContext.Node().GetFirstClient<Messages::TDefaultClientMatchPolicy>(Messages::TClientType(EClock));
+ iContext.iNodeActivity->PostRequestTo(*clock, TWait(3).CRef());
+ }
+
+DEFINE_SMELEMENT(TrafficLightStates::TGoRedAndSendGoneRed, NetStateMachine::MStateTransition, TrafficLightStates::TContext)
+void TrafficLightStates::TGoRedAndSendGoneRed::DoL()
+ {
+ iContext.Node().SetColour(CTrafficLight::ERed);
+
+ iContext.iNodeActivity->PostToOriginators(TGoneRed());
+ }
+
+using namespace ControllerStates;
+
+DEFINE_SMELEMENT(ControllerStates::TAwaitingAllRed, NetStateMachine::MState, ControllerStates::TContext)
+TBool ControllerStates::TAwaitingAllRed::Accept()
+ {
+ if (!iContext.iMessage.IsMessage<TGoneRed>())
+ {
+ return EFalse;
+ }
+
+ if (iContext.iPeer)
+ {
+ iContext.iPeer->ClearFlags(EGreenFlag);
+ }
+
+ if (iContext.Node().CountClients<Messages::TFlagsOnlyClientMatchPolicy>(Messages::TClientType(0, EGreenFlag)))
+ {
+ iContext.iMessage.ClearMessageId();
+ return EFalse;
+ }
+ else
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+DEFINE_SMELEMENT(ControllerStates::TEastAndWestGreen, NetStateMachine::MStateTransition, ControllerStates::TContext)
+void ControllerStates::TEastAndWestGreen::DoL()
+ {
+ Messages::TNodeCtxId from(iContext.ActivityId(), iContext.NodeId());
+ TGoGreen msg;
+
+ iContext.Node().PostToClients<Messages::TDefaultClientMatchPolicy>(from, msg, Messages::TClientType(ETrafficLight, EWest), Messages::TClientType::NullType(), EGreenFlag);
+ iContext.Node().PostToClients<Messages::TDefaultClientMatchPolicy>(from, msg, Messages::TClientType(ETrafficLight, EEast), Messages::TClientType::NullType(), EGreenFlag);
+ }
+
+DEFINE_SMELEMENT(ControllerStates::TNorthAndSouthGreen, NetStateMachine::MStateTransition, ControllerStates::TContext)
+void ControllerStates::TNorthAndSouthGreen::DoL()
+ {
+ Messages::TNodeCtxId from(iContext.ActivityId(), iContext.NodeId());
+ TGoGreen msg;
+
+ ASSERT(!from.IsNull());
+
+ iContext.Node().PostToClients<Messages::TDefaultClientMatchPolicy>(from, msg, Messages::TClientType(ETrafficLight, ENorth), Messages::TClientType::NullType(), EGreenFlag);
+ iContext.Node().PostToClients<Messages::TDefaultClientMatchPolicy>(from, msg, Messages::TClientType(ETrafficLight, ESouth), Messages::TClientType::NullType(), EGreenFlag);
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commsfwsupport/commselements/testing/examplecode/mmexample1/src/mmexample1states.h Fri Mar 12 15:49:41 2010 +0200
@@ -0,0 +1,135 @@
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+#ifndef MMEXAMPLE1STATES_H
+#define MMEXAMPLE1STATES_H
+
+#include <e32base.h>
+#include <elements/nm_address.h>
+#include <elements/mm_activities.h>
+#include <elements/mm_states.h>
+
+#include "MMExample1nodes.h"
+
+/**
+ * Definition of constants for whisper message.
+ */
+const TInt KJunctionMessageRealm = 0x2002D4B3; // used to group messages, UID allocated from symbian signed
+
+enum
+ {
+ EGoGreen = 1,
+ EGoneRed = 2,
+ EWait = 3,
+ EGo = 4
+ };
+
+/**
+ * Defines the actual concrete message used in the example.
+ */
+typedef Messages::TMessageSigVoid<EGoGreen, KJunctionMessageRealm> TGoGreen;
+typedef Messages::TMessageSigVoid<EGoneRed, KJunctionMessageRealm> TGoneRed;
+typedef Messages::TMessageSigNumber<EWait, KJunctionMessageRealm> TWait;
+typedef Messages::TMessageSigVoid<EGo, KJunctionMessageRealm> TGo;
+
+enum TClientTypes
+ {
+ EClock = 0x00000100,
+ EController = 0x00000200,
+ ETrafficLight = 0x00000400,
+ };
+
+enum TClientFlags
+ {
+ EGreenFlag = 0x80000000,
+ ENorth = 0x40000000,
+ ESouth = 0x20000000,
+ EEast = 0x10000000,
+ EWest = 0x08000000
+ };
+
+namespace Clock
+{
+typedef MeshMachine::TNodeContext<CClock> TContext;
+
+class CTimerCallback : public CTimer
+ {
+public:
+ static CTimerCallback* NewL(Messages::TNodeCtxId aOriginator);
+ void ConstructL();
+
+ void RunL();
+
+private:
+ CTimerCallback(Messages::TNodeCtxId aOriginator);
+
+ Messages::TNodeCtxId iOriginator;
+ };
+
+class CTimerActivity : public MeshMachine::CNodeParallelActivityBase
+ {
+public:
+ static CNodeActivityBase* NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode );
+ ~CTimerActivity();
+
+protected:
+ CTimerActivity( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode, TUint aNextActivityCount );
+
+public:
+ CTimerCallback* iTimer;
+ };
+
+DECLARE_SMELEMENT_HEADER( TKickOffTimer, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TKickOffTimer )
+}
+
+namespace TrafficLightStates
+{
+typedef MeshMachine::TNodeContext<CTrafficLight> TContext;
+
+DECLARE_SMELEMENT_HEADER( TGoAmber, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TGoAmber )
+
+DECLARE_SMELEMENT_HEADER( TGoGreen, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TGoGreen )
+
+DECLARE_SMELEMENT_HEADER( TGoRedAndSendGoneRed, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TGoRedAndSendGoneRed )
+
+}
+
+namespace ControllerStates
+{
+const TInt KStart = 1;
+
+typedef MeshMachine::TNodeContext<CController> TContext;
+
+DECLARE_SMELEMENT_HEADER( TAwaitingAllRed, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
+ virtual TBool Accept();
+DECLARE_SMELEMENT_FOOTER( TAwaitingAllRed )
+
+DECLARE_SMELEMENT_HEADER( TEastAndWestGreen, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TEastAndWestGreen )
+
+DECLARE_SMELEMENT_HEADER( TNorthAndSouthGreen, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+ virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TNorthAndSouthGreen )
+}
+
+#endif
--- a/commsprocess/commsrootserverconfig/etc/c32start.ini Sat Feb 20 00:01:55 2010 +0200
+++ b/commsprocess/commsrootserverconfig/etc/c32start.ini Fri Mar 12 15:49:41 2010 +0200
@@ -2,7 +2,7 @@
# mbuf manager memory constraints - no bearing on the pools; the key name has been kept for backward compatibility
# - minSize has no meaning when using mbuf manager's RHeap/user-chunk model, for the DChunk model it is completely ignored
# - format = min/init total memory size (in bytes)
-MBufPoolSize=393216,393216
+MBufPoolSize=524288,524288
# mbuf size allocation information
# - mbuf size guidelines;
--- a/commsprocess/commsrootserverconfig/etc/t_c32start.ini Sat Feb 20 00:01:55 2010 +0200
+++ b/commsprocess/commsrootserverconfig/etc/t_c32start.ini Fri Mar 12 15:49:41 2010 +0200
@@ -2,8 +2,7 @@
# mbuf manager memory constraints - no bearing on the pools; the key name has been kept for backward compatibility
# - minSize has no meaning when using mbuf manager's RHeap/user-chunk model, for the DChunk model it is completely ignored
# - format = min/init total memory size (in bytes)
-MBufPoolSize=393216,393216
-#MBufPoolSize=262144,262144
+MBufPoolSize=524288,524288
# mbuf size allocation information
# - mbuf size guidelines;
--- a/datacommsserver/esockserver/ssock/ss_conn.cpp Sat Feb 20 00:01:55 2010 +0200
+++ b/datacommsserver/esockserver/ssock/ss_conn.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -194,7 +194,7 @@
// complete the message upon return from the blocked activity.
THROUGH_NODEACTIVITY_ENTRY(KNoTag, SubSessStates::TAcquireMessageOwnership, CoreNetStates::TActiveOrNoTagBlockedByGoneDown)
THROUGH_NODEACTIVITY_ENTRY(KActiveTag, ConnStates::TCancelStartOrAttachConnection, ConnStates::TNoTagOrNoBearerBlockedByStartOrAttach)
- THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TNoTag)
+ THROUGH_NODEACTIVITY_ENTRY(KNoTag, SubSessStates::TCancelAndCloseClientExtIfaces, MeshMachine::TNoTag)
THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TCancelAllLegacyRMessage2Activities, ConnStates::TNoTagBlockedByLegacyRMessage2Activities)
NODEACTIVITY_ENTRY(KNoTag, ConnStates::TSendStopConnection, TECABState<CoreNetStates::TAwaitingStopped>, MeshMachine::TNoTag)
THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionDownProgress, MeshMachine::TNoTag)
--- a/datacommsserver/esockserver/ssock/ss_connstates.cpp Sat Feb 20 00:01:55 2010 +0200
+++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -730,6 +730,11 @@
{
msg->iStateChange.iStage = KConnectionUp; // KLinkLayerOpen
}
+ //TODO: Verify if this (connection) is the right place to translate the error
+ if (msg->iStateChange.iError == KErrForceDisconnected)
+ {
+ msg->iStateChange.iError = KErrDisconnected;
+ }
if (selectedProgressStage == KConnProgressDefault
|| selectedProgressStage == msg->iStateChange.iStage
|| KErrNone != msg->iStateChange.iError)
--- a/datacommsserver/esockserver/ssock/ss_roles.cpp Sat Feb 20 00:01:55 2010 +0200
+++ b/datacommsserver/esockserver/ssock/ss_roles.cpp Fri Mar 12 15:49:41 2010 +0200
@@ -1776,7 +1776,15 @@
if(err == KErrNone)
{
- err = aRedShirt.Create(KNullDesC, RESockCleanupThreadFunction, 8192, static_cast<RHeap*>(heap), startupInfo);
+ // Attempt to create the RedShirt with a useful diagnostic name, to reduce the
+ // likelihood that time is wasted debugging a problem in it rather than in the original
+ // crashed worker
+ TBuf<KMaxKernelName> threadName;
+ _LIT(KNameFmt, "IgnoreMe_PostCrashCleanupHelper_%x");
+ TWorkerThreadRegister* deadInfo = aDeadWorker.WorkerProperties(aDeadWorker.WorkerId());
+ TUint deadThreadId = deadInfo? (TUint) deadInfo->iThreadId: User::TickCount();
+ threadName.Format(KNameFmt, deadThreadId);
+ err = aRedShirt.Create(threadName, RESockCleanupThreadFunction, 8192, static_cast<RHeap*>(heap), startupInfo);
}
// If any error occured, delete the startup info structure.
if(err != KErrNone)