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 void Abort ( TNodeContextBase &, TBool )
IMPORT_C TUint16 ActivityId ()
TUint ActivitySigId ()
IMPORT_C void Cancel ( TNodeContextBase &)
IMPORT_C void ClearPostedTo ()
TInt Error ()
IMPORT_C TInt FindOriginator (const Messages::RNodeInterface &)
IMPORT_C TInt FindOriginator (const Messages::TRuntimeCtxId &)
IMPORT_C TInt FindOriginator (const Messages::TNodePeerId &)
const Messages::TNodePeerId & FirstOriginator ()
IMPORT_C TBool IsIdle ()
const Messages::TNodeSignal::TMessageId KickOffMessageId ()
IMPORT_C CNodeActivityBase * NewL (const TNodeActivity &, AMMNodeBase &)
IMPORT_C TBool Next ( TNodeContextBase &)
IMPORT_C void PostRequestTo (const Messages::RNodeInterface &, const Messages::TSignalBase &, const TBool )
IMPORT_C void PostRequestTo (const Messages::TNodeId &, const Messages::TSignalBase &, const TBool )
IMPORT_C TBool PostToOriginator (const Messages::TNodePeerId &, const Messages::TSignalBase &)
IMPORT_C TInt PostToOriginators (const Messages::TSignalBase &, TUint32 , TUint32 )
IMPORT_C const Messages::TNodeId & PostedToNodeId ()
IMPORT_C const Messages::RNodeInterface * PostedToPeer ()
IMPORT_C void RemoveOriginator ( TInt )
void SetError ( TInt )
IMPORT_C void SetIdle ()
IMPORT_C void SetPostedTo (const Messages::TNodeId &)
IMPORT_C void SetPostedTo (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 void AppendActivityL ()
IMPORT_C void AppendPreallocatedActivity ()
IMPORT_C TAny * BorrowPreallocatedSpace ( AMMNodeBase &, TUint )
void Destroy ()
IMPORT_C NetInterfaces::TInterfaceControl * DoFetchInterfaceControlL ( TInt )
IMPORT_C void InsertPreallocatedDestroyActivity ()
IMPORT_C TBool MatchSender (const TNodeContextBase &)
IMPORT_C void ReturnPreallocatedSpace ( TAny *)
TBool Signal ( TNodeContextBase &)
IMPORT_C void StartL ( 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::RPostedToNodeOrPeer iPostedToId

Constructor & Destructor Documentation

CNodeActivityBase(const TNodeActivity &, AMMNodeBase &)

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

Constructor for CNodeActivityBase

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)

IMPORT_C void Abort ( TNodeContextBase & aContext,
TBool aIsNodeBeingDestroyed = EFalse
)

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)

const NetStateMachine::TStateTriple * Accept ( TNodeContextBase & aContext,
const TNodeActivity & aActivitySig,
TInt aTransitionTag
) [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 & 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)

IMPORT_C TAny * BorrowPreallocatedSpace ( AMMNodeBase & aNode,
TUint aSize
) [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 & 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 &)

IMPORT_C void Cancel ( TNodeContextBase & aContext ) [virtual]

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

Parameters

TNodeContextBase & aContext the context in which the activity is being executed

ClearPostedTo()

IMPORT_C void ClearPostedTo ( )

Clear the postedTo id

Destroy()

void Destroy ( ) [protected, inline, virtual]

Destroy the activity.

Used primarily by preallocated activities to return extracted space

DoFetchInterfaceControlL(TInt)

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

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

IMPORT_C TInt FindOriginator ( const Messages::RNodeInterface & aPeerToFind ) const

Find the originator matching the parameters

Parameters

const Messages::RNodeInterface & aPeerToFind Matching criteria

FindOriginator(const Messages::TRuntimeCtxId &)

IMPORT_C TInt FindOriginator ( const Messages::TRuntimeCtxId & aPeerToFind ) const

Find the originator matching the parameters

Parameters

const Messages::TRuntimeCtxId & aPeerToFind Matching criteria

FindOriginator(const Messages::TNodePeerId &)

IMPORT_C TInt FindOriginator ( const Messages::TNodePeerId & aOriginator ) const

Find the originator matching the parameters

Parameters

const Messages::TNodePeerId & aOriginator xx

FirstOriginator()

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

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

const Messages::TNodeSignal::TMessageId KickOffMessageId ( ) const [inline]

Get the id of the message that started this activity.

MatchSender(const TNodeContextBase &)

IMPORT_C TBool MatchSender ( 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 & aActivitySig Context information about how the activity is to be started
AMMNodeBase & aNode The node to which this activity will belong.

Next(TNodeContextBase &)

IMPORT_C TBool Next ( TNodeContextBase & aContext ) [virtual]

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

Parameters

TNodeContextBase & aContext the context in which the activity is being executed

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

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

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

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

IMPORT_C void SetPostedTo ( const Messages::TNodeId & aNodeId )

Manually set the postedTo id

Parameters

const Messages::TNodeId & aNodeId Node id to set the postedTo id to

SetPostedTo(const Messages::RNodeInterface &)

IMPORT_C void SetPostedTo ( 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 void StartL ( 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 & aContext The context to start the activity in
const Messages::XNodePeerId & aOriginator The peer that requires this activity to start
const NetStateMachine::TStateTriple & aFirst First 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::RPostedToNodeOrPeer iPostedToId [private]