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
Public Member Functions
IMPORT_C voidAbort(TNodeContextBase &, TBool)
IMPORT_C TUint16ActivityId()
TUint ActivitySigId()
IMPORT_C voidCancel(TNodeContextBase &)
IMPORT_C voidClearPostedTo()
TInt Error()
IMPORT_C TIntFindOriginator(const Messages::RNodeInterface &)
IMPORT_C TIntFindOriginator(const Messages::TRuntimeCtxId &)
IMPORT_C TIntFindOriginator(const Messages::TNodePeerId &)
const Messages::TNodePeerId &FirstOriginator()
IMPORT_C TBoolIsIdle()
const Messages::TNodeSignal::TMessageIdKickOffMessageId()
IMPORT_C CNodeActivityBase *NewL(const TNodeActivity &, AMMNodeBase &)
IMPORT_C TBoolNext(TNodeContextBase &)
IMPORT_C voidPostRequestTo(const Messages::RNodeInterface &, const Messages::TSignalBase &, const TBool)
IMPORT_C voidPostRequestTo(const Messages::TNodeId &, const Messages::TSignalBase &, const TBool)
IMPORT_C TBoolPostToOriginator(const Messages::TNodePeerId &, const Messages::TSignalBase &)
IMPORT_C TIntPostToOriginators(const Messages::TSignalBase &, TUint32, TUint32)
IMPORT_C const Messages::TNodeId &PostedToNodeId()
IMPORT_C const Messages::RNodeInterface *PostedToPeer()
IMPORT_C voidRemoveOriginator(TInt)
voidSetError(TInt)
IMPORT_C voidSetIdle()
IMPORT_C voidSetPostedTo(const Messages::TNodeId &)
IMPORT_C voidSetPostedTo(const Messages::RNodeInterface &)
const Messages::TNodePeerId &SoleOriginator()
Protected Member Functions
CNodeActivityBase(const TNodeActivity &, AMMNodeBase &)
~CNodeActivityBase()
const NetStateMachine::TStateTriple *Accept(TNodeContextBase &, const TNodeActivity &, TInt)
IMPORT_C voidAppendActivityL()
IMPORT_C voidAppendPreallocatedActivity()
IMPORT_C TAny *BorrowPreallocatedSpace(AMMNodeBase &, TUint)
voidDestroy()
IMPORT_C NetInterfaces::TInterfaceControl *DoFetchInterfaceControlL(TInt)
IMPORT_C voidInsertPreallocatedDestroyActivity()
IMPORT_C TBoolMatchSender(const TNodeContextBase &)
IMPORT_C voidReturnPreallocatedSpace(TAny *)
TBool Signal(TNodeContextBase &)
IMPORT_C voidStartL(TNodeContextBase &, const Messages::XNodePeerId &, const NetStateMachine::TStateTriple &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Protected Attributes
AMMNodeBase &iNode
RArray< Messages::XNodePeerId >iOriginators
Private Attributes
const TNodeActivity &iActivitySig
TInt iError
class MeshMachine::CNodeActivityBase::RPostedToNodeOrPeeriPostedToId

Constructor & Destructor Documentation

CNodeActivityBase(const TNodeActivity &, AMMNodeBase &)

IMPORT_CCNodeActivityBase(const TNodeActivity &aActivitySig,
AMMNodeBase &aNode
)[protected, explicit]

Constructor for CNodeActivityBase

Parameters

const TNodeActivity & aActivitySigSignature with which to create the activity
AMMNodeBase & aNodeNode 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)

IMPORT_C voidAbort(TNodeContextBase &aContext,
TBoolaIsNodeBeingDestroyed = EFalse
)

Calls cancel on current state. Sends TError to all originators and sets activity idle

Parameters

TNodeContextBase & aContextthe context in which the activity is being executed
TBool aIsNodeBeingDestroyed = EFalseindicate to the activity as to whether the node is being destroyed

Accept(TNodeContextBase &, const TNodeActivity &, TInt)

const NetStateMachine::TStateTriple *Accept(TNodeContextBase &aContext,
const TNodeActivity &aActivitySig,
TIntaTransitionTag
)[protected, static]

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 & aContextthe context in which the activity may be executed
const TNodeActivity & aActivitySigthe activity which we are testing for the accept condition
TInt aTransitionTagthe 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 TUint16ActivityId()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 voidAppendActivityL()[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 voidAppendPreallocatedActivity()[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)

IMPORT_C TAny *BorrowPreallocatedSpace(AMMNodeBase &aNode,
TUintaSize
)[protected, static]

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 & aNodeThe node that owns the preallocated space. This must be the node that the activity runs on.
TUint aSizeSize of buffer to allocate.

Cancel(TNodeContextBase &)

IMPORT_C voidCancel(TNodeContextBase &aContext)[virtual]

Cancels the activity. Only to be called by the meshmachine.

Parameters

TNodeContextBase & aContextthe context in which the activity is being executed

ClearPostedTo()

IMPORT_C voidClearPostedTo()

Clear the postedTo id

Destroy()

voidDestroy()[protected, inline, virtual]

Destroy the activity.

Used primarily by preallocated activities to return extracted space

DoFetchInterfaceControlL(TInt)

IMPORT_C NetInterfaces::TInterfaceControl *DoFetchInterfaceControlL(TIntaInterfaceId)[protected, virtual]

TInterfaceControlAllows to fetch an arbitrary interface instance from the client

Parameters

TInt aInterfaceIdid of requested interface

Error()

TInt Error()const [inline]

Get the current error state for the activity.

FindOriginator(const Messages::RNodeInterface &)

IMPORT_C TIntFindOriginator(const Messages::RNodeInterface &aPeerToFind)const

Find the originator matching the parameters

Parameters

const Messages::RNodeInterface & aPeerToFindMatching criteria

FindOriginator(const Messages::TRuntimeCtxId &)

IMPORT_C TIntFindOriginator(const Messages::TRuntimeCtxId &aPeerToFind)const

Find the originator matching the parameters

Parameters

const Messages::TRuntimeCtxId & aPeerToFindMatching criteria

FindOriginator(const Messages::TNodePeerId &)

IMPORT_C TIntFindOriginator(const Messages::TNodePeerId &aOriginator)const

Find the originator matching the parameters

Parameters

const Messages::TNodePeerId & aOriginatorxx

FirstOriginator()

const Messages::TNodePeerId &FirstOriginator()const [inline]

Get the id of the node that started this activity.

InsertPreallocatedDestroyActivity()

IMPORT_C voidInsertPreallocatedDestroyActivity()[protected]

Insert an activity at the start of the node's list of running activities.

IsIdle()

IMPORT_C TBoolIsIdle()const [virtual]

Check if the activity is running.

KickOffMessageId()

const Messages::TNodeSignal::TMessageIdKickOffMessageId()const [inline]

Get the id of the message that started this activity.

MatchSender(const TNodeContextBase &)

IMPORT_C TBoolMatchSender(const TNodeContextBase &aContext)const [protected]
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'.

Parameters

const TNodeContextBase & aContext

NewL(const TNodeActivity &, AMMNodeBase &)

IMPORT_C CNodeActivityBase *NewL(const TNodeActivity &aActivitySig,
AMMNodeBase &aNode
)[static]

Create a new activity. This should never be called by user code.

Parameters

const TNodeActivity & aActivitySigContext information about how the activity is to be started
AMMNodeBase & aNodeThe node to which this activity will belong.

Next(TNodeContextBase &)

IMPORT_C TBoolNext(TNodeContextBase &aContext)[virtual]

Attempt to advance the activity one entry. Only to be called by the mesh machine

Parameters

TNodeContextBase & aContextthe context in which the activity is being executed

PostRequestTo(const Messages::RNodeInterface &, const Messages::TSignalBase &, const TBool)

IMPORT_C voidPostRequestTo(const Messages::RNodeInterface &aRecepient,
const Messages::TSignalBase &aMessage,
const TBoolaRecipientIdCritical = ETrue
)

Post a request to a node.

PostedToId

Parameters

const Messages::RNodeInterface & aRecepientEndpoint for the message
const Messages::TSignalBase & aMessageMessage to send
const TBool aRecipientIdCritical = ETrueIf 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 voidPostRequestTo(const Messages::TNodeId &aRecepient,
const Messages::TSignalBase &aMessage,
const TBoolaRecipientIdCritical = ETrue
)

Post a request to a node.

PostedToId

Parameters

const Messages::TNodeId & aRecepientEndpoint for the message
const Messages::TSignalBase & aMessageMessage to send
const TBool aRecipientIdCritical = ETrueIf 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 &)

IMPORT_C TBoolPostToOriginator(const Messages::TNodePeerId &aOriginator,
const Messages::TSignalBase &aMessage
)const

Post a message to an originator

Parameters

const Messages::TNodePeerId & aOriginatororiginator to post the message to
const Messages::TSignalBase & aMessagemessage to post

PostToOriginators(const Messages::TSignalBase &, TUint32, TUint32)

IMPORT_C TIntPostToOriginators(const Messages::TSignalBase &aMessageSig,
TUint32aFlagsToSet = 0,
TUint32aFlagsToClear = 0
)

Post a message to all originators

Parameters

const Messages::TSignalBase & aMessageSigthe message to post
TUint32 aFlagsToSet = 0Flags to set on the peer as the message is being sent
TUint32 aFlagsToClear = 0Flags to cleared on the peer as the message is being sent

PostedToNodeId()

IMPORT_C const Messages::TNodeId &PostedToNodeId()const

Get the id of the node that the last request from this activity was sent to.

PostedToPeer()

IMPORT_C const Messages::RNodeInterface *PostedToPeer()const

Get the id of the node that the last request from this activity was sent to.

RemoveOriginator(TInt)

IMPORT_C voidRemoveOriginator(TIntaIndex)

Remove an originator from the originator list.

Parameters

TInt aIndexIndex of originator to remove

ReturnPreallocatedSpace(TAny *)

IMPORT_C voidReturnPreallocatedSpace(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 * aSpaceMemory buffer to return.

SetError(TInt)

voidSetError(TIntaError)[inline]

Set the error state of the activity.

Parameters

TInt aErrorerror code to set

SetIdle()

IMPORT_C voidSetIdle()[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 &)

IMPORT_C voidSetPostedTo(const Messages::TNodeId &aNodeId)

Manually set the postedTo id

Parameters

const Messages::TNodeId & aNodeIdNode id to set the postedTo id to

SetPostedTo(const Messages::RNodeInterface &)

IMPORT_C voidSetPostedTo(const Messages::RNodeInterface &aRecipient)

Manually set the postedTo id

Parameters

const Messages::RNodeInterface & aRecipient

Signal(TNodeContextBase &)

TBool Signal(TNodeContextBase &)[protected, inline, virtual]

Signal the activity that an event has happened in the mesh machine. Used for waking up sleeping activities which use mutexes.

AActivitySemaphore

Parameters

TNodeContextBase & The context in which the activity is being executed

SoleOriginator()

const Messages::TNodePeerId &SoleOriginator()const [inline]

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 &)

IMPORT_C voidStartL(TNodeContextBase &aContext,
const Messages::XNodePeerId &aOriginator,
const NetStateMachine::TStateTriple &aFirst
)[protected, virtual]

Start a new activity. The first transition should have been run within the Accept() method before this is called.

Parameters

TNodeContextBase & aContextThe context to start the activity in
const Messages::XNodePeerId & aOriginatorThe peer that requires this activity to start
const NetStateMachine::TStateTriple & aFirstFirst entry triple in the activity, as returned by Accept()

Member Data Documentation

const TNodeActivity & iActivitySig

const TNodeActivity &iActivitySig[private]

TInt iError

TInt iError[private]

AMMNodeBase & iNode

AMMNodeBase &iNode[protected]

The node the activity is running on

RArray< Messages::XNodePeerId > iOriginators

RArray< Messages::XNodePeerId >iOriginators[protected]

All the nodes that have started the same activity

class MeshMachine::CNodeActivityBase::RPostedToNodeOrPeer iPostedToId

class MeshMachine::CNodeActivityBase::RPostedToNodeOrPeeriPostedToId[private]