MeshMachine::CNodeActivityBase Class Reference
class MeshMachine::CNodeActivityBase : public CBase
|
Base class for all node activity objects. Non custom node activities will use this by default.
Inherits from
-
MeshMachine::CNodeActivityBase
Nested Classes and Structures
Constructor & Destructor Documentation
CNodeActivityBase(const TNodeActivity &, AMMNodeBase &)
Parameters
const
TNodeActivity
& aActivitySig
|
Signature with which to create the activity
|
AMMNodeBase
& aNode
|
Node which will own the activity
|
~CNodeActivityBase()
IMPORT_C
|
~CNodeActivityBase
|
(
|
)
|
[protected, virtual]
|
Destructor. If the Activity is running in error mode, a message is sent to the originator.
Member Functions Documentation
Abort(TNodeContextBase &, TBool)
Calls cancel on current state. Sends TError to all originators and sets activity idle
Parameters
TNodeContextBase
& aContext
|
the context in which the activity is being executed
|
TBool
aIsNodeBeingDestroyed = EFalse
|
indicate to the activity as to whether the node is being destroyed
|
Accept(TNodeContextBase &, const TNodeActivity &, TInt)
Test whether a activity can start given the current context. If it can, the first transition will be executed. Note that this is a static method, and as such the activity hasn't been instanciated when this is called
Parameters
TNodeContextBase
& aContext
|
the context in which the activity may be executed
|
const
TNodeActivity
& aActivitySig
|
the activity which we are testing for the accept condition
|
TInt
aTransitionTag
|
the condition which must be matched by the first entry for the activity to be accepted. Set to KExecuteAlways to skip this check
|
ActivityId()
IMPORT_C
TUint16
|
ActivityId
|
(
|
)
|
const [virtual]
|
Get the
id
of the activity.
ActivitySigId()
TUint
|
ActivitySigId
|
(
|
)
|
const [inline]
|
Return the activity signature id of the activity. This may not necessarily be the same as the activity id in the case of parallel activities, where the activity id will be [8 bit unique id|8 bit activity sig]
AppendActivityL()
IMPORT_C void
|
AppendActivityL
|
(
|
)
|
[protected]
|
Append self to the node's list of running activities.
Should only be accessed from
Activity::NewL
. Generally activities can choose to be inserted or appended (if they do not choose they are appended by default). When inserting, extreme caution must be taken, as this behavior is reserved for destroying activities.
AppendPreallocatedActivity()
IMPORT_C void
|
AppendPreallocatedActivity
|
(
|
)
|
[protected]
|
Append self to the node's list of running activities. This should only be called if you are certain that the activity list has space for the append.
BorrowPreallocatedSpace(AMMNodeBase &, TUint)
Borrow some preallocated memory from the node. This preallocated memory is used for activities that absolutely cannot fail in any scenario, such as for Destroying the node. For this reason, when the node is created, some memory is allocated so that a destroying activity can't even fail in an out of memory situation.
This method is static as the memory must be borrowed before the activity object is constructed.
The memory is returned using
ReturnPreallocatedSpace()
.
Parameters
AMMNodeBase
& aNode
|
The node that owns the preallocated space. This must be the node that the activity runs on.
|
TUint
aSize
|
Size of buffer to allocate.
|
Cancel(TNodeContextBase &)
Cancels the activity. Only to be called by the meshmachine.
ClearPostedTo()
IMPORT_C void
|
ClearPostedTo
|
(
|
)
|
|
Destroy()
void
|
Destroy
|
(
|
)
|
[protected, inline, virtual]
|
Destroy the activity.
Used primarily by preallocated activities to return extracted space
DoFetchInterfaceControlL(TInt)
TInterfaceControlAllows to fetch an arbitrary interface instance from the client
Parameters
TInt
aInterfaceId
|
id of requested interface
|
Error()
TInt
|
Error
|
(
|
)
|
const [inline]
|
Get the current error state for the activity.
FindOriginator(const Messages::RNodeInterface &)
Find the originator matching the parameters
FindOriginator(const Messages::TRuntimeCtxId &)
Find the originator matching the parameters
FindOriginator(const Messages::TNodePeerId &)
Find the originator matching the parameters
FirstOriginator()
Get the id of the node that started this activity.
InsertPreallocatedDestroyActivity()
IMPORT_C void
|
InsertPreallocatedDestroyActivity
|
(
|
)
|
[protected]
|
Insert an activity at the start of the node's list of running activities.
IsIdle()
IMPORT_C
TBool
|
IsIdle
|
(
|
)
|
const [virtual]
|
Check if the activity is running.
KickOffMessageId()
Get the id of the message that started this activity.
MatchSender(const TNodeContextBase &)
Test whether aContext carries a message that is to be expected by 'this' in its current state. The method is effectivelly a filter that hides the messages flowing throught the node, but not intended for 'this'. The method will check:
-
if aContext carries a message from PostedToId (if set) then the message should be presented to 'this'.
-
if aContext carries a message from one of the originators then the message should be presented to 'this'.
NewL(const TNodeActivity &, AMMNodeBase &)
Create a new activity. This should never be called by user code.
Parameters
const
TNodeActivity
& aActivitySig
|
Context information about how the activity is to be started
|
AMMNodeBase
& aNode
|
The node to which this activity will belong.
|
Next(TNodeContextBase &)
Attempt to advance the activity one entry. Only to be called by the mesh machine
PostRequestTo(const Messages::RNodeInterface &, const Messages::TSignalBase &, const TBool)
IMPORT_C void
|
PostRequestTo
|
(
|
const
Messages::RNodeInterface
&
|
aRecepient,
|
|
const
Messages::TSignalBase
&
|
aMessage,
|
|
const
TBool
|
aRecipientIdCritical = ETrue
|
|
)
|
|
Post a request to a node.
PostedToId
Parameters
const
Messages::RNodeInterface
& aRecepient
|
Endpoint for the message
|
const
Messages::TSignalBase
& aMessage
|
Message to send
|
const
TBool
aRecipientIdCritical = ETrue
|
If true, the postedTo id is set to the id of the recipient. If false, the postedTo id is set to null.
|
PostRequestTo(const Messages::TNodeId &, const Messages::TSignalBase &, const TBool)
IMPORT_C void
|
PostRequestTo
|
(
|
const
Messages::TNodeId
&
|
aRecepient,
|
|
const
Messages::TSignalBase
&
|
aMessage,
|
|
const
TBool
|
aRecipientIdCritical = ETrue
|
|
)
|
|
Post a request to a node.
PostedToId
Parameters
const
Messages::TNodeId
& aRecepient
|
Endpoint for the message
|
const
Messages::TSignalBase
& aMessage
|
Message to send
|
const
TBool
aRecipientIdCritical = ETrue
|
If true, the postedTo id is set to the id of the recipient. If false, the postedTo id is set to null.
|
PostToOriginator(const Messages::TNodePeerId &, const Messages::TSignalBase &)
Post a message to an originator
Parameters
const
Messages::TNodePeerId
& aOriginator
|
originator to post the message to
|
const
Messages::TSignalBase
& aMessage
|
message to post
|
PostToOriginators(const Messages::TSignalBase &, TUint32, TUint32)
IMPORT_C
TInt
|
PostToOriginators
|
(
|
const
Messages::TSignalBase
&
|
aMessageSig,
|
|
TUint32
|
aFlagsToSet = 0,
|
|
TUint32
|
aFlagsToClear = 0
|
|
)
|
|
Post a message to all originators
Parameters
const
Messages::TSignalBase
& aMessageSig
|
the message to post
|
TUint32
aFlagsToSet = 0
|
Flags to set on the peer as the message is being sent
|
TUint32
aFlagsToClear = 0
|
Flags to cleared on the peer as the message is being sent
|
PostedToNodeId()
Get the id of the node that the last request from this activity was sent to.
PostedToPeer()
Get the id of the node that the last request from this activity was sent to.
RemoveOriginator(TInt)
IMPORT_C void
|
RemoveOriginator
|
(
|
TInt
|
aIndex
|
)
|
|
Remove an originator from the originator list.
Parameters
TInt
aIndex
|
Index of originator to remove
|
ReturnPreallocatedSpace(TAny *)
IMPORT_C void
|
ReturnPreallocatedSpace
|
(
|
TAny
*
|
aSpace
|
)
|
[protected]
|
Return preallocated space to the node. The node does not have to be passed in as a parameter as it will already be a member of the activity.
Parameters
TAny
* aSpace
|
Memory buffer to return.
|
SetError(TInt)
void
|
SetError
|
(
|
TInt
|
aError
|
)
|
[inline]
|
Set the error state of the activity.
Parameters
TInt
aError
|
error code to set
|
SetIdle()
IMPORT_C void
|
SetIdle
|
(
|
)
|
[virtual]
|
Put the activity into the idle state. This stops the activity running and notifies the mesh machine that it's ok to delete this activity.
SetPostedTo(const Messages::TNodeId &)
Manually set the postedTo id
SetPostedTo(const Messages::RNodeInterface &)
Manually set the postedTo id
Signal(TNodeContextBase &)
Signal the activity that an event has happened in the mesh machine. Used for waking up sleeping activities which use mutexes.
AActivitySemaphore
SoleOriginator()
In essence the same as
FirstOriginator()
. This should be used in preference in situations where the activity should be run in parallel, and therefore only ever have one originator.
StartL(TNodeContextBase &, const Messages::XNodePeerId &, const NetStateMachine::TStateTriple &)
Start a new activity. The first transition should have been run within the
Accept()
method before this is called.
Member Data Documentation
const TNodeActivity & iActivitySig
AMMNodeBase & iNode
The node the activity is running on
RArray< Messages::XNodePeerId > iOriginators
All the nodes that have started the same activity
class MeshMachine::CNodeActivityBase::RPostedToNodeOrPeer iPostedToId
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.