INOS
CINOSTaskEx Class Reference
Inheritance diagram for CINOSTaskEx:

Public Types

enum  { eSourceIdMsg = 255 , eSourceIdLua = 254 , eSourceIdFastLoad = 253 }
 predefined source id's
 
enum  {
  eMsgCmd =CINOSTaskExDef::eMsgCmd , eMsgCall =CINOSTaskExDef::eMsgCall , eMsgEvent =CINOSTaskExDef::eMsgEvent , eMsgReply =CINOSTaskExDef::eMsgReply ,
  eMsgUser =CINOSTaskExDef::eMsgUser , eMsgSub =CINOSTaskExDef::eMsgSub , eMsgInternal =CINOSTaskExDef::eMsgInternal , eMsgMessage =CINOSTaskExDef::eMsgMessage
}
 message types
 
enum  ERplId {
  eRplOk =CINOSTaskExDef::eRplOk , eRplSkipped =CINOSTaskExDef::eRplSkipped , eRplInComplete =CINOSTaskExDef::eRplInComplete , eRplIgnored =CINOSTaskExDef::eRplIgnored ,
  eRplPaused =CINOSTaskExDef::eRplPaused , eRplStopped =CINOSTaskExDef::eRplStopped , eRplCanceled =CINOSTaskExDef::eRplCanceled , eRplRejected =CINOSTaskExDef::eRplRejected ,
  eRplFailed =CINOSTaskExDef::eRplFailed , eRplError =CINOSTaskExDef::eRplError , eRplFatal =CINOSTaskExDef::eRplFatal , eRplTimeout =CINOSTaskExDef::eRplTimeout
}
 reply id's
 
enum  {
  eCmdINOSTaskExFirst , eCmdFailure , eCmdStartup , eCmdShutdown ,
  eCmdShutdownRequest , eCmdSwitchCore , eCmdSetFlag , eCmdClrFlag ,
  eCmdStopMsg , eCmdSetIdleTimeout , eCmdINOSTaskExLast
}
 
enum  {
  eUsrINOSTaskExFirst , eUsrMsgDone , eUsrNvUpdate , eUsrIdleTimeout ,
  eUsrINOSTaskExLast
}
 
enum  {
  eIntINOSTaskExFirst , eIntAddCommand , eIntRemCommand , eIntDeleteCommand ,
  eIntGetCommands , eIntGetProp , eIntSetProp , eIntAddProp ,
  eIntGetActual , eIntSetActual , eIntAddActual , eIntINOSTaskExLast
}
 
enum  { eMessageAdd , eMessageRemove , eMessageModify , eMessageAcknowledge }
 
enum  { eEvtTicks , eEvtNs }
 
enum  {
  eStaStartup = DEF_eStaStartup , eStaOff = DEF_eStaOff , eStaWait = DEF_eStaWait , eStaOn = DEF_eStaOn ,
  eStaReady = DEF_eStaReady , eStaBusy = DEF_eStaBusy , eStaError = DEF_eStaError , eStaINOSTaskExLast
}
 
enum  {
  eOptOwner = 0x00000001 , eOptStat = 0x00000002 , eOptMsg = 0x00000004 , eOptNvR = 0x00000008 ,
  eOptOvld = 0x0000010 , eOptCaS = 0x0000020 , eOptResTsk2 = 0x0000040 , eOptResTsk3 = 0x0000080
}
 
enum  {
  eFlgError = 0x00000001 , eFlgFatal = 0x00000002 , eFlgEmergency =0x00000004 , eFlgSTO = 0x00000008 ,
  eFlgResTsk4 = 0x00000010 , eFlgResTsk5 = 0x00000020 , eFlgResTsk6 = 0x00000040 , eFlgResTsk7 = 0x00000080
}
 
enum  {
  eReqResTsk0 = 0x00000001 , eReqResTsk1 = 0x00000002 , eReqResTsk2 = 0x00000004 , eReqResTsk3 = 0x00000008 ,
  eReqResTsk4 = 0x00000010 , eReqResTsk5 = 0x00000020 , eReqResTsk6 = 0x00000040 , eReqResTsk7 = 0x00000080
}
 
enum  {
  eCrtSendMsg = 0x00000001 , eCrtResTsk1 = 0x00000002 , eCrtResTsk2 = 0x00000004 , eCrtResTsk3 = 0x00000008 ,
  eCrtResTsk4 = 0x00000010 , eCrtResTsk5 = 0x00000020 , eCrtResTsk6 = 0x00000040 , eCrtResTsk7 = 0x00000080
}
 
enum  { eDispFlagINCOSync = 0x00000001 }
 
enum  eTaskExMsgFlags { eMsgFlagNone = 0x00000000 , eMsgFlagNoWait = 0x00000001 }
 
enum  EDispatchStyle { eDispatchNone , eDispatchNormal , eDispatchInternal , eDispatchPre }
 
- Public Types inherited from CINOSTask
enum  ETskType {
  eTskTypeBoot = 0 , eTskTypeResource = 1 , eTskTypeSystem = 2 , eTskTypeApplication = 3 ,
  eTskTypeCommunication = 4 , eTskTypeRealtime = 5 , eTskTypeInterrupt = 6 , eTskTypeBackground = 7 ,
  eTskTypeLua = 8 , eTskTypeTest = 9 , eTskTypeReserved0 = 10 , eTskTypeReserved1 = 11 ,
  eTskTypeUser0 = 12 , eTskTypeUser1 = 13 , eTskTypeUser2 = 14 , eTskTypeUser3 = 15
}
 Task types.
 

Public Member Functions

uint32 GetState ()
 get state
 
virtual void SetState (uint32 auState)
 set state
 
bool IsCmdBusy (uintptr auCmdCode)
 return true if task is actual command 'auCmdCode' busy
 
bool IsCmdDeferred (uint32 auCmdCode)
 return true if task has a deferred command 'auCmdCode'
 
virtual bool IsCmdAllowed (CINOSTaskExMsg *apMsg)
 
const charGetParam () const
 get pointer to param
 
const charGetType () const
 get pointer to type
 
const charGetAliasName () const
 get pointer to alias name
 
void SetAliasName (const char *apAlias)
 set alias name
 
virtual const charGetIncoName ()
 get requested inco folder name
 
virtual const charGetTreeName ()
 get requested binary tree name
 
uint32 GetSourceId ()
 get source id
 
CINOSTaskExGetParent () const
 get parent
 
virtual CMcResult Startup (real64 arStage)
 startup task (always asynchronous)
 
bool GetCommand (const char *apName) const
 return true if command 'aName' is requested in params
 
bool GetOption (const char *apName) const
 return true if option 'aName' is requested in params
 
bool GetOption (const char *apBase, const char *apName) const
 return true if option 'apBase=aName' is requested in params
 
bool GetOption (const char *apParams, const char *apBase, const char *apName) const
 return true if option 'apBase=aName' is requested in apParams
 
bool GetOptionEx (const char *apBase) const
 
bool GetOptionStr (const char *apBase, char *apResult, uint32 auSize) const
 return option string belonging to apBase 'apBase=optionstring'
 
bool GetOptionStr (const char *apParams, const char *apBase, char *apResult, uint32 auSize) const
 return option string belonging to apBase 'apBase=optionstring'
 
bool GetOptionNbr (const char *apBase, uintnbr &auNumber) const
 return option number belonging to apBase 'apBase=number'
 
bool GetOptionNbr (const char *apParams, const char *apBase, uintnbr &auNumber) const
 return option number belonging to apBase 'apBase=number'
 
bool GetOption (uint32 auOption) const
 return true if option available
 
bool GetFlag (const char *apName) const
 return true if flag 'aName' is requested in params
 
bool GetFlag (uint64 auFlag) const
 return true if flag available
 
uint64 GetFlags () const
 return all flags
 
bool GetRequest (uint32 auRequest) const
 return true if request set
 
bool GetCritical (uint32 auCritical) const
 return true if critical set
 
virtual CMcResult SetFlag (const char *apName, CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
 set flag apName
 
virtual CMcResult ClrFlag (const char *apName, CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
 clear flag apName
 
virtual CMcResult StopMsg (tMsgId atMsgId, CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
 stop message
 
virtual CMcResult SetIdleTimeout (uint32 auIdleTimeout, CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
 
uint32 GetIdleTimeout () const
 
void SetDispatchFlag (uint32 auFlag)
 
void ClrDispatchFlag (uint32 auFlag)
 clr dispatch flag. see SetDispatchFlag for further information
 
uint32 GetDispatchFlag () const
 set dispatch flag. see SetDispatchFlag for further information
 
virtual uint32 Shutdown (CINOSSync *apSync=DF_INOS_SYNCHRONOUS) override
 shutdown task
 
virtual tMsgId PutCmd (uint32 auCommand)
 put command to queue and return command id
 
virtual CMcResult PutMsg (CINOSTaskExMsg *apMsg, tMsgId aMsgId=0)
 put message to queue and return command id
 
virtual CMcResult PutMsgEx (CINOSTaskExMsg *apMsg, uint32 auFlags, tMsgId aMsgId=0)
 Put a message with flags to adjust behaviour.
 
virtual void PutReply (CINOSTaskExMsg *apMsg, tMsgId aMsgId)
 put reply message to queue
 
virtual CINOSTaskQueueGetMsgQueue ()
 get pointer to message queue
 
CINOSTaskExMsgGetActMsg ()
 get pointer to actually handled message
 
virtual const CINOSTaskExMsgGetCommandMsg (const char *apName)
 get pointer to command apName or NULL if not found
 
virtual CINOSTaskExMsgCreateMsgFromCommand (const char *apName, CINOSSync *apSync=DF_INOS_ASYNCHRONOUS)
 create a new message from command name or NULL if command not found. To call a command directly the template method CallCommand shlould be used instead.
 
template<typename... ParamType>
CMcResult CallCommand (const char *apName, ParamType... aParams, CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
 calls a command given the command name. The function can be called using less than defined parameters, it then uses default parameters unless the parameter is defined to be mandatory. If the command is not found or called with wrong parameters a CMcResult with the according error is returned.
 
virtual const CINOSTaskExCmdHookBaseGetCommandHook (const char *apName)
 get pointer to command hook apName or NULL if not found
 
virtual CINCOObject * GetRegister (CINCOObject *apObject=0)
 get pointer to inco registration
 
virtual CINCOObject * SetCmdObj (CINCOObject *apCmd)
 set pointer to 'Cmd' inco folder and return old one
 
virtual CINCOObject * GetCmdObj ()
 get pointer to 'Cmd' inco folder
 
virtual CINCOObject * GetPropObj ()
 get pointer to 'Prop' inco folder
 
virtual CINCOObject * GetOptionsObj ()
 get pointer to 'Options' inco folder
 
virtual CINCOObject * GetFlagsObj ()
 get pointer to 'Flags' inco folder
 
virtual CINCOObject * GetRequestsObj ()
 get pointer to 'Requests' inco folder
 
virtual CINCOObject * GetCriticalsObj ()
 get pointer to 'Criticals' inco folder
 
virtual CINCOObject * GetActObj ()
 get pointer to 'Act' inco folder
 
virtual CINCOObject * GetStatObj ()
 get pointer to 'Stat' inco folder
 
virtual void AddProp (CINCOItem *apItem)
 add property to the 'Prop' folder
 
virtual void AddProp (const char *apName)
 add object property to the 'Prop' folder
 
virtual void AddProp ()
 add object property to the 'Prop' folder
 
virtual void AddProp (const char *apName, nvreal64 &aMember, real64 arDefault, real64 arMin, real64 arMax, const char *apUnit, uint32 auDigits, uint32 auCharactristics=defCharShowFix)
 add nvreal property to the 'Prop' folder
 
virtual void AddProp (const char *apName, nvuint32 &aMember, uint32 auDefault, uint32 auMin, uint32 auMax, const char *apUnit, uint32 auCharacteristics=defCharShowDec)
 add nvuint32 property to the 'Prop' folder
 
virtual void AddProp (const char *apName, nvstring &aMember, const char *apDefault="", const char *apComboData=NULL)
 add nvstring property to the 'Prop' folder
 
virtual void AddProp (const char *apName, nvlstring &aMember, const char *apDefault="")
 add nvlstring property to the 'Prop' folder
 
virtual void AddProp (const char *apName, nvbool &aMember, bool abDefault, uint32 auCharactristics=defCharShowDec)
 add nvbool property to the 'Prop' folder and register it as checkbox.
 
virtual void RemProp (const char *apName)
 remove object property apName
 
virtual void AddActual (CINCOItem *apItem)
 add actual to the 'Act' folder
 
virtual void AddActual (const char *apName)
 add object property to the 'Act' folder
 
virtual void AddActual ()
 add object property to the 'Act' folder
 
virtual void AddActual (const char *apName, nvreal64 &aMember, real64 arDefault, real64 arMin, real64 arMax, const char *apUnit, uint32 auDigits)
 add nvreal to the 'Act' folder
 
virtual void AddActual (const char *apName, nvuint32 &aMember, uint32 auDefault, uint32 auMin, uint32 auMax, const char *apUnit, uint32 auCharacteristics=defCharShowDec)
 add nvuint32 to the 'Act' folder
 
virtual void AddActual (const char *apName, nvstring &aMember, const char *apDefault=nullptr, const char *apComboData=nullptr)
 add nvstring to the 'Act' folder
 
virtual void AddActual (const char *apName, nvlstring &aMember, const char *apDefault=nullptr)
 add nvlstring to the 'Act' folder
 
virtual void AddActual (const char *apName, nvbool &aMember, bool abDefault, uint32 auCharactristics=defCharShowDec)
 add nvbool property to the 'Act' folder and register it as checkbox.
 
virtual void RemActual (const char *apName)
 remove object actual apName
 
virtual CINOSTaskExMsgCreateMsg (CINOSTaskExMsg *apMsg, CINOSMcDataInst *apData, const char *apAlias)
 create message from apMsg
 
CINOSMcMessage * GetMessageHndEx ()
 get message handler
 
void SetMessageHnd (CINOSMcMessage *apMessageHnd)
 set message handler
 
virtual CMcResult PostMessage (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo=0)
 post message
 
virtual CMcResult PostMessage (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, const char *apText, CINOSMcData *apInfo=0)
 post message
 
virtual CMcResult ModifyMessage (tMsgId aiId, uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo=0, const char *apText=nullptr)
 modify message
 
 CINOSTaskEx (const char *apName, const char *apParam=0, uint32 aStackSize=defDefaultStackSize, uint32 aPriority=defLowestPriority, bool aFloatingPoint=true, uint32 aTimeSlice=defDefaultTimeSlice, bool aInterruptsDisabled=false)
 constructor
 
 CINOSTaskEx (const char *apName, const char *apType, const char *apParam=0, uint32 aStackSize=defDefaultStackSize, uint32 aPriority=defLowestPriority, bool aFloatingPoint=true, uint32 aTimeSlice=defDefaultTimeSlice, bool aInterruptsDisabled=false)
 constructor
 
virtual ~CINOSTaskEx ()
 destructor
 
virtual void PostCreate (void *apParent)
 called after creation
 
virtual bool PreDestroy (bool &bDeleteSelf)
 called before destruction (return false if destruction not allowed)
 
int operator< (CINOSTaskEx &aTaskEx)
 binary tree operators
 
int operator== (CINOSTaskEx &aTaskEx)
 
int operator< (const char *aName)
 
int operator== (const char *aName)
 
virtual void MsgDone (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message done -> reply or signal initiator if requested
 
virtual void MsgDone (CINOSTaskExMsg *apMsg, ERplId aRplId, tMcAppError aAppError=0)
 message done -> reply or signal initiator if requested
 
virtual void MsgDonePnd (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message done (and set 'pending' flag)
 
virtual void MsgDonePnd (CINOSTaskExMsg *apMsg, ERplId aRplId, tMcAppError aAppError=0)
 message done (and set 'pending' flag)
 
virtual void MsgInComplete (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message incomplete
 
virtual void MsgIgnored (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message ignored
 
virtual void MsgPaused (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message paused. Deprecated!
 
virtual void MsgStopped (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message stopped
 
virtual void MsgCanceled (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message canceled
 
virtual void MsgRejected (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message rejected
 
virtual void MsgFailed (CINOSTaskExMsg *apMsg, tMcAppError aAppError=0)
 message failed
 
virtual void MsgError (CINOSTaskExMsg *apMsg, tMcAppError aAppError)
 message error
 
virtual void MsgFatal (CINOSTaskExMsg *apMsg, tMcAppError aAppError)
 message fatal error
 
virtual tMsgId MsgDefer (CINOSTaskExMsg *apMsg, void *apHandler=0, void *apObject=0, bool abHandlesCommands=false)
 defer message and return according MsgId
 
virtual tMsgId MsgDefer (CINOSTaskExMsg *apMsg, tMsgId aMsgId, void *apHandler=0, void *apObject=0, bool abHandlesCommands=false)
 
virtual void AddCommand (const char *apName, uint32 auCode, CINCOProcedure *apProc)
 add inco command
 
virtual void AddCommand (CINOSTaskExMsg *apMsg, uint64 aChar=0, uint16 aKeyLevel=cKeyLevelMin, bool abRegisterInco=true)
 add inco command
 
virtual void AddCommand (CINOSTaskExMsg *apMsg, CINCOObject *apMsgCmdObj)
 add inco command
 
virtual void AddCommand (const char *apName, uint32 auCode, uint32 auType=eMsgCmd)
 add internal command
 
virtual void RemCommand (const char *apName)
 remove command
 
virtual void AddParam (const char *apName, real64 arValue, real64 arMin, real64 arMax, const char *apUnit, uint32 auChar, uint32 auFlags=0)
 add param to command. You can use REAL64MIN/MAX to allow all possible values.
 
virtual void AddParam (const char *apName, const char *apValue, uint32 auFlags=0)
 add param to command
 
virtual void AddParam (const char *apName, const char *apValue, const char *apComboData, uint32 auFlags=0)
 add string param with combobox data
 
virtual void AddParam (const char *apName, const char *apUnit, uint32 auValue, uint32 auMin, uint32 auMax, uint32 auChar, uint32 auFlags=0)
 Add uint32 parameter to command. You can use UINT32MIN/MAX to allow all possible values.
 
virtual void AddParam_int32 (const char *apName, const char *apUnit, int32 aiValue, int32 aiMin, int32 aiMax, uint32 auChar, uint32 auFlags=0)
 Add int32 parameter to command. You can use INT32MIN/MAX to allow all possible values.
 
virtual void AddParam_uint64 (const char *apName, const char *apUnit, uint64 auValue, uint64 auMin, uint64 auMax, uint32 auChar, uint32 auFlags=0)
 Add uint64 parameter to command. You can use UINT64MIN/MAX to allow all possible values.
 
virtual void AddParam_int64 (const char *apName, const char *apUnit, int64 aiValue, int64 aiMin, int64 aiMax, uint32 auChar, uint32 auFlags=0)
 Add int64 parameter to command. You can use INT64MIN/MAX to allow all possible values.
 
virtual void AddParam (const char *apName, const char *apComboData, uint32 auValue, uint32 auMin, uint32 auMax, const char *apUnit, uint32 auChar, uint32 auFlags=0)
 Add combo box parameter to command. You can use UINT32MIN/MAX to allow all possible values.
 
virtual void AddParam (const char *apName, bool abValue, uint32 auChar, uint32 auFlags=0)
 Add parameter of type bool to command.
 
template<typename T >
void AddParam (CINCOItem *apItem, T aValue, uint32 auFlags=0)
 
void ProcedureArgCheck (CINCOObject &aObject, const char *apParamName, const uint32 auExpectedIncoType)
 
virtual void AddEllipsis ()
 Add ellipsis to command.
 
virtual void AddChildCommand (const char *apModuleName, const char *apFunctionName, CINOSTaskExMsg *apCmdMsg, bool abRegisterInco=true)
 add child command
 
virtual void RemChildCommand (const char *apModuleName, const char *apFunctionName)
 remove child command
 
virtual void AddChildModule (const char *apModuleName)
 add child command
 
virtual void RemChildModule (const char *apModuleName)
 remove child command
 
void RegisterCommand (CINOSTaskExCmdBase *apCommand)
 register a command that will be added at startup (depending in the option)
 
void RegisterHook (CINOSTaskExCmdHookBase *apHook)
 register a command hook which can be set to a command later
 
- Public Member Functions inherited from CINOSTask
 CINOSTask (char *apName=nullptr, uint32 auStackSize=defDefaultStackSize, uint32 auPriority=DF_INOS_TASK_PRIO_LOWEST, bool abFloatingPoint=true, uint32 auTimeSlice=defDefaultTimeSlice, bool abInterruptsDisabled=false, void *apHandler=0, void *apObject=0)
 Create a task with given properties. One needs to Resume the task after creation to get it running.
 
 CINOSTask (std::function< void(void *)> aFunction, void *apParam=nullptr, uint8 auPriority=DF_INOS_TASK_PRIO_LOWEST)
 Create a task with given properties. One needs to Resume the task after creation to get it running.
 
 CINOSTask (const char *apName, std::function< void(void *)> aFunction, void *apParam=nullptr, uint8 auPriority=DF_INOS_TASK_PRIO_LOWEST)
 Create a task with given properties. One needs to Resume the task after creation to get it running.
 
virtual ~CINOSTask ()
 Destroy task.
 
virtual uint32 Join ()
 Join task or in other words, wait till it terminates.
 
virtual void Detach ()
 Detach task from parent. One uses this method if one doesn't want this task to be shut down if the parent shuts down.
 
virtual void Exit ()
 Terminate myself. Exit code is INOS_OK or the code previously set with SetExitCode.
 
virtual void Exit (uint32 auExitCode)
 Terminate myself.
 
virtual void SetExitCode (uint32 auExitCode)
 Set exit code.
 
virtual uint32 GetExitCode ()
 Get exit code.
 
virtual bool CheckShutdown ()
 Check if a shutdown is pending.
 
virtual void SetSuspendHook (void *apSuspendHook)
 Set Suspend hook.
 
virtual void ClrSuspendHook ()
 Clear Suspend hook.
 
virtual voidGetSuspendHook ()
 Get Suspend hook if any.
 
INOS_INLINE ETskType GetTskType ()
 Get task type.
 
INOS_INLINE ETskType SetTskType (ETskType aeType)
 Set task type.
 

Static Public Member Functions

static tMsgId GetMsgId ()
 get system wide unique message id
 
static tMsgId GetMsgId (uint32 auId, uint32 auMask)
 
static constexpr int GetLastCmd ()
 return last taskex command id
 
static constexpr int GetLastUsr ()
 return last taskex user id
 
static CINOSHookAddMsgDoneHook (void *apHandler, void *apObject=NULL)
 Add a hook to call some member function when MsgDone() gets called. This function is thread-safe.
 
static void RemoveMsgDoneHook (CINOSHook *apHook)
 Remove a previously added MsgDone() hook. This function is thread-safe.
 
static uint32 EncodeReplyCode (uint32 auReply, tMcAppError aAppError)
 

Protected Member Functions

void Create ()
 do main creation work
 
virtual void Action () override
 main action
 
virtual bool PreDispatchMsg (CINOSTaskExMsg *apMsg)
 Pre dispatcher.
 
virtual void PostDispatchMsg ()
 PostDispatchMsg.
 
virtual bool DispatchCmd (CINOSTaskExMsg *apMsg)
 dispatch command message
 
virtual bool DispatchTmd (CINOSTaskExMsg *apMsg)
 dispatch triggered command message
 
virtual bool DispatchEvent (CINOSTaskExMsg *apMsg)
 dispatch event message
 
virtual bool DispatchReply (CINOSTaskExMsg *apMsg)
 dispatch reply message
 
virtual bool DispatchUser (CINOSTaskExMsg *apMsg)
 dispatch user message
 
virtual bool DispatchSub (CINOSTaskExMsg *apMsg)
 dispatch sub message
 
virtual bool DispatchInternal (CINOSTaskExMsg *apMsg)
 dispatch internal message
 
virtual bool DispatchMessage (CINOSTaskExMsg *apMsg)
 dispatch message message
 
virtual bool DispatchOther (CINOSTaskExMsg *apMsg)
 dispatch other message
 
virtual void iFailure (CINOSTaskExMsg *apMsg)
 internal command handling failure
 
virtual void iStartup (CINOSTaskExMsg *apMsg)
 internal startup task
 
virtual void iStartup (real64 arStage)
 internal startup task
 
virtual bool iPostStartup ()
 internal post startup
 
virtual uint32 iAddRegisteredCommands ()
 add registered commands (done between startup and post startup)
 
virtual void iShutdown (CINOSTaskExMsg *apMsg)
 internal shutdown task
 
virtual void iShutdownRequest (CINOSTaskExMsg *apMsg)
 
virtual void iSetFlag (CINOSTaskExMsg *apMsg)
 internal switch core
 
virtual void iiSetFlag (const char *apName)
 
virtual void iClrFlag (CINOSTaskExMsg *apMsg)
 internal clear flag
 
virtual void iStopMsg (CINOSTaskExMsg *apMsg)
 stop message
 
virtual void iSetIdleTimeout (CINOSTaskExMsg *apMsg)
 internal set idle timeout
 
virtual void iHandleIdleTimeout ()
 internal handle idle timeout
 
void iCheckIdleTimeout ()
 internal check idle timeout
 
virtual void iCancelDeferred ()
 internal cancel all deferred messages
 
virtual void iAddCommand (CINOSTaskExMsg *apMsg)
 internal add command
 
virtual void iRemCommand (CINOSTaskExMsg *apMsg)
 internal add command
 
virtual void iDeleteCommand (CINOSTaskExMsg *apMsg)
 internal delete command (only used for commands of type call)
 
virtual void iGetCommands (CINOSTaskExMsg *apMsg)
 internal get commands
 
virtual void iGetProp (CINOSTaskExMsg *apMsg)
 internal get property
 
virtual void iSetProp (CINOSTaskExMsg *apMsg)
 internal set property
 
virtual void iAddProp (CINOSTaskExMsg *apMsg)
 internal set property
 
virtual void iGetActual (CINOSTaskExMsg *apMsg)
 internal get actual
 
virtual void iSetActual (CINOSTaskExMsg *apMsg)
 internal set actual
 
virtual void iAddActual (CINOSTaskExMsg *apMsg)
 reply to actual message
 
virtual void iMessageAdd (CINOSTaskExMsg *apMsg)
 internal message add
 
virtual void iMessageRemove (CINOSTaskExMsg *apMsg)
 internal message remove
 
virtual void iMessageModify (CINOSTaskExMsg *apMsg)
 internal message modify
 
virtual void iMessageAcknowledge (CINOSTaskExMsg *apMsg)
 internal message acknowledge
 
void Reply (CINOSTaskExMsg *apMsg, uint32 auReply, tMcAppError aAppError=0)
 reply to actual message
 
template<class T >
void ReplyParam (uint32 auReply, T)
 reply to actual message with param
 
virtual void SetTreeName (const char *apTreeName)
 set requested binary tree name
 
virtual const charGetStateText ()
 return actual state text
 
virtual void MsgDone (tMsgId aMsgId, tMcAppError aAppError=0)
 message done (used for deferred messages)
 
virtual void iUsrMsgDone (CINOSTaskExMsg *apMsg)
 internal user message done, used to handle message dones from other
 
virtual void FlushTmd (tMsgId aId=0)
 remove triggered messages auId of type eMsgCmd or all if auId==0
 
virtual void _AddCommand (CINOSTaskExMsg *apMsg, CINCOObject *apMsgCmdObj, int16 aiOrder=0)
 add inco command
 
virtual void AdjTrigger (CINOSTaskExMsg *apMsg)
 adjust trigger
 
CINOSTaskExDeferredMsgGetDeferredMsg (tMsgId auReplyId)
 get pointer to deferred message with given reply id
 
void RemDeferredMsg (CINOSTaskExDeferredMsg *apDef)
 remove deferred message from list
 
CINOSTaskExMsgGetDeferredMsgCmd (uint32 auCmdCode)
 get pointer to deferred message with given command code
 
charGetMsgName (CINOSTaskExMsg *apMsg)
 get message name
 
void SetParent (CINOSTaskEx *apParent)
 set parent pointer
 
void MptHook ()
 measure hook
 
void NvUpdate ()
 nvram update
 
virtual void iNvUpdate (CINOSTaskExMsg *apMsg)
 
virtual void SetFlag (uint64 auFlag, bool abUpdateState=false)
 set flag
 
virtual void ClrFlag (uint64 auFlag, bool abUpdateState=false)
 clr flag
 
virtual void SetRequest (uint32 auRequest)
 set request
 
virtual void ClrRequest (uint32 auRequest)
 clr request
 
void SetCritical (uint32 auCritical)
 set critical
 
void ClrCritical (uint32 auCritical)
 clr critical
 
virtual CINOSSyncGetSync () override
 get task sync object
 
virtual void SetCallResult (CMcResult aResult) override
 set sync call result
 
virtual CMcResult GetCallResult () override
 get sync call result
 
void RequestCritical ()
 request critical section
 
void ReleaseCritical ()
 release critical section
 
bool AddToInputQueue (CINOSTaskExMsg *apMsg, uint32 auFlags=0)
 
virtual void MsgCompleted (CINOSTaskExMsg *&apMsg)
 
uint8 GetRequestedPriority ()
 get requested priority
 
void SetRequestedPriority (uint8 auPrio)
 set requested priority
 
void HandleTriggerMsg (CINOSTaskExMsg *apMsg, EDispatchStyle aeDispStyle)
 handle message with a trigger
 
CINOSTaskExMsgGetTmpMsg ()
 Get temporary message (used for subclasses overriding AddCommand)
 

Static Protected Member Functions

static uint32 iSetIncoItemsFromParamStruct (CINCOItem *apIncoItem, long alOffset, CINOSTaskExMsgParam *apParams, bool abOverwrite, inosName128 &oErrorItemName)
 Helper function for commands that set INCO items from a parameter stucture.
 
static void INCOItemToMessageResult (CINCOItem *apItem, const char *apParentPath, CINOSTaskExMsg *apMsg)
 Add value of INCO item to results of apMsg.
 
static void INCOItemsToMessageResults (CINCOItem *apItem, const char *apParentPath, CINOSTaskExMsg *apMsg)
 Add the value of the INCO item apItem and all its children (if any) as named results to the message (apMsg).
 
static void CallMsgDoneHooks (CINOSTaskExMsg *apMsg, ERplId aRplId, tMcAppError aAppError)
 Call hooks to notify observers about MsgDone, passing all arguments for inspection. This function is thread-safe.
 

Protected Attributes

CINCOObject * m_pRegister
 pointer to my inco registration
 
uint32 m_uOptions
 task options
 
std::atomic< uint64 > m_uFlags
 task flags
 
uint32 m_uRequests
 task requests
 
uint32 m_uCriticals
 task critical sections
 
uint32 m_uState
 task state
 
CINCOObject * m_pNvInitObj
 pointer to temporary nvobj
 
uint32 m_uPropOrder
 prop folder order
 
uint32 m_uActOrder
 act folder order
 

Friends

class CINOSTaskExState
 
class CINOSMcSync
 
class CINOSMcModule
 
class CINOSMcRobot
 
class CINOSMcLua
 
class CINOSMcMessage
 
class CINOSTaskExMsg
 
class CINOSTaskExMsgTest
 
class CINOSEventLogger
 
CINOSMcMessage * GetMessageHnd (bool abSearch)
 get message handler
 
tMcAppError SendMessage (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo)
 send message
 
tMcAppError SendMessage (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, const char *apText, CINOSMcData *apInfo)
 send message
 
tMcAppError SendMessageEx (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, const char *apProperties)
 send message
 
tMcAppError SendMessageEx (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo, const char *apProperties)
 send message
 
CMcResult PostMessage (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo)
 post message
 
CMcResult PostMessage (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, const char *apText, CINOSMcData *apInfo)
 post message
 
CMcResult PostMessageEx (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, const char *apProperties)
 post message
 
CMcResult PostMessageEx (uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo, const char *apProperties)
 post message
 
CMcResult ModifyMessage (tMsgId aiId, uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo, const char *apText)
 modify message
 
CMcResult ModifyMessageEx (tMsgId aiId, uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, const char *apProperties)
 modify message
 
CMcResult ModifyMessageEx (tMsgId aiId, uint32 auMsgType, uint32 auMsgCode, uint32 auFlags, CINOSMcData *apInfo, const char *apProperties)
 modify message
 
CMcResult AckMessage (tMsgId aMsgId, uint32 auFlags)
 ack message
 
CMcResult AckMessageDelayed (tMsgId aMsgId, uint32 auFlags, uint32 auTime)
 
CMcResult AckMessage (uint32 auMsgCode, uint32 auFlags, uint32 auMask)
 ack message
 
CMcResult AckMessageDelayed (uint32 auMsgCode, uint32 auFlags, uint32 auMask, uint32 auTime)
 
CMcResult AckMessage (const CINOSTask *apOwner, uint32 auMsgType, uint32 auFlag)
 ack message
 
CMcResult RequestListen (uint32 auMsgType, uint32 auSetId, uint32 auAckId)
 request listen
 
CMcResult ReleaseListen ()
 request listen
 
CINOSMcNvRamGrpGetNvRamGrp (bool abSearch)
 get nvram group
 
void _INI_0000_CINOSTaskEx ()
 
void _INI_0201_CINOSTaskEx ()
 
void _INI_0510_CINOSTaskEx ()
 
void MsgEvent (CINOSTaskExMsg *apMsg, const char *apName, uint64 auTicks, uint8 auBusId)
 return an informational event to the sender of apMsg
 
void MsgEventFlg (CINOSTaskExMsg *apMsg, const char *apName, uint64 auTicks, uint8 auBusId, uint32 auFlags)
 return an informational event to the sender of apMsg
 
void MsgEvent (CINOSTaskExMsg *apMsg, const char *apName, uint32 auMs)
 put event
 
void MsgEventFlg (CINOSTaskExMsg *apMsg, const char *apName, uint32 auFlags, uint32 auMs)
 put event
 

Member Function Documentation

◆ Action()

virtual void CINOSTaskEx::Action ( )
overrideprotectedvirtual

main action

Reimplemented from CINOSTask.

◆ AddChildCommand()

virtual void CINOSTaskEx::AddChildCommand ( const char apModuleName,
const char apFunctionName,
CINOSTaskExMsg apCmdMsg,
bool  abRegisterInco = true 
)
inlinevirtual

add child command

Reimplemented in CINOSMcModule.

◆ AddChildModule()

virtual void CINOSTaskEx::AddChildModule ( const char apModuleName)
inlinevirtual

add child command

Reimplemented in CINOSMcModule.

◆ AddCommand() [1/3]

virtual void CINOSTaskEx::AddCommand ( CINOSTaskExMsg apMsg,
uint64  aChar = 0,
uint16  aKeyLevel = cKeyLevelMin,
bool  abRegisterInco = true 
)
virtual

add inco command

Reimplemented in CINOSMcModule.

◆ AddCommand() [2/3]

virtual void CINOSTaskEx::AddCommand ( const char apName,
uint32  auCode,
CINCOProcedure *  apProc 
)
virtual

add inco command

Reimplemented in CINOSMcModule.

◆ AddCommand() [3/3]

virtual void CINOSTaskEx::AddCommand ( const char apName,
uint32  auCode,
uint32  auType = eMsgCmd 
)
virtual

add internal command

Reimplemented in CINOSMcModule.

◆ AddMsgDoneHook()

static CINOSHook * CINOSTaskEx::AddMsgDoneHook ( void apHandler,
void apObject = NULL 
)
static

Add a hook to call some member function when MsgDone() gets called. This function is thread-safe.

Parameters
apHandlerThe function to call, use P_TYP_CLS_FCT for member functions.
apObjectThe instance object.
Returns
A new hook object required to finally remove the hook using RemoveMsgDoneHook().

◆ AddParam()

template<typename T >
void CINOSTaskEx::AddParam ( CINCOItem apItem,
T  aValue,
uint32  auFlags = 0 
)
inline

Add parameter of any type having an already existing INCO item. Among others, this function may be handy if having multiple commands with "the same" argument. Such as: Multiple functions which act on an axis and therefore have an "AxisName" parameter. By registering the same CINCOItem for all these commands, if the user changes the axis name in the INCOExplorer, all commands will take over that new axis name.

◆ AddToInputQueue()

bool CINOSTaskEx::AddToInputQueue ( CINOSTaskExMsg apMsg,
uint32  auFlags = 0 
)
protected

Helper function used to add a task message into the tasks queue. Note that the function also sets the "message queue put time stamp" and the "message receiver task" properties. Therefore, the function should usually not be used when 'reputting' a message object into the same queue again.

Parameters
apMsgMessage to add to queue.
auFlagseTaskExMsgFlags to control behaviour of adding.
Returns
True if message was added, false if it was deleted.

◆ CallCommand()

template<typename... ParamType>
CMcResult CINOSTaskEx::CallCommand ( const char apName,
ParamType...  aParams,
CINOSSync apSync = DF_INOS_SYNCHRONOUS 
)
inline

calls a command given the command name. The function can be called using less than defined parameters, it then uses default parameters unless the parameter is defined to be mandatory. If the command is not found or called with wrong parameters a CMcResult with the according error is returned.

Parameters
apNameName of the command of which a message should be called.
aParamsThe parameters of the calle, must be of the correct type defined in the template parameters.
apSyncSynch pointer for the call.
Returns
Result that stores the ticked on async call or the results on sync call. In case of an error it stores the error code.

◆ ClrFlag()

virtual void CINOSTaskEx::ClrFlag ( uint64  auFlag,
bool  abUpdateState = false 
)
inlineprotectedvirtual

clr flag

Reimplemented in CINOSMcModule.

◆ CreateMsgFromCommand()

virtual CINOSTaskExMsg * CINOSTaskEx::CreateMsgFromCommand ( const char apName,
CINOSSync apSync = DF_INOS_ASYNCHRONOUS 
)
virtual

create a new message from command name or NULL if command not found. To call a command directly the template method CallCommand shlould be used instead.

Parameters
apNameName of the command of which a message should be created.
apSyncSynch pointer for the created message, this parameter will be forwarded to the constructor of CINOSTaskExMsg.
Returns
Pointer to the created message object or nullptr if the command was not found.

◆ DispatchCmd()

virtual bool CINOSTaskEx::DispatchCmd ( CINOSTaskExMsg apMsg)
protectedvirtual

dispatch command message

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ DispatchEvent()

virtual bool CINOSTaskEx::DispatchEvent ( CINOSTaskExMsg apMsg)
protectedvirtual

dispatch event message

Reimplemented in CINOSMcModule.

◆ DispatchInternal()

virtual bool CINOSTaskEx::DispatchInternal ( CINOSTaskExMsg apMsg)
protectedvirtual

dispatch internal message

Reimplemented in CINOSMcModule.

◆ DispatchReply()

virtual bool CINOSTaskEx::DispatchReply ( CINOSTaskExMsg apMsg)
protectedvirtual

dispatch reply message

Reimplemented in CINOSMcRobot, and CINOSMcModule.

◆ DispatchTmd()

virtual bool CINOSTaskEx::DispatchTmd ( CINOSTaskExMsg apMsg)
protectedvirtual

dispatch triggered command message

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ DispatchUser()

virtual bool CINOSTaskEx::DispatchUser ( CINOSTaskExMsg apMsg)
protectedvirtual

dispatch user message

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ GetMsgId()

static tMsgId CINOSTaskEx::GetMsgId ( uint32  auId,
uint32  auMask 
)
static

get system wide unique message id, the returned id needs to fullfill id == auId & auMask

◆ GetOptionEx()

bool CINOSTaskEx::GetOptionEx ( const char apBase) const

return true if option 'aName' is requested in params if a '=' is part of aName the sting is split into Base=Name.

◆ GetStateText()

virtual const char * CINOSTaskEx::GetStateText ( )
protectedvirtual

return actual state text

Reimplemented in CINOSMcRobot.

◆ iCancelDeferred()

virtual void CINOSTaskEx::iCancelDeferred ( )
protectedvirtual

internal cancel all deferred messages

Reimplemented in CINOSMcRobot.

◆ INCOItemsToMessageResults()

static void CINOSTaskEx::INCOItemsToMessageResults ( CINCOItem apItem,
const char apParentPath,
CINOSTaskExMsg apMsg 
)
staticprotected

Add the value of the INCO item apItem and all its children (if any) as named results to the message (apMsg).

The values of the INCO items will be added to the message as a named results, where the names are the full path, e.g. "Prop.ParamX", where "Prop" would be apParentPath and "ParamX" would be the name of the INCO item (apItem)

Parameters
apItemThe "root" INCO item which's value shall be added to the message. If apItem is a CINCOObject, all it's children and their childrens-children, etc. will be added as well.
apParentPathThe parent path of apItem. That parent path will be prefixed to the name of the INCO (apItem), which is used as the name of the "named result" when adding the INCO item value to the message.
apMsgThe message object to which the INCO value item shall be added

◆ INCOItemToMessageResult()

static void CINOSTaskEx::INCOItemToMessageResult ( CINCOItem apItem,
const char apParentPath,
CINOSTaskExMsg apMsg 
)
staticprotected

Add value of INCO item to results of apMsg.

The value of the INCO item will be added to the message as a named result, where the name is the full path, e.g. "Prop.ParamX", where "Prop" would be apParentPath and "ParamX" would be the name of the INCO item (apItem)

Parameters
apItemThe INCO item of which the value shall be added to apMsg
apParentPathThe INCO parent path to apItem. E.g. if apItem is a child of "Module.Prop", Then apParentPath will be set "Module.Prop".
apMsgThe message object to which the INCO value item shall be added

◆ iPostStartup()

virtual bool CINOSTaskEx::iPostStartup ( )
protectedvirtual

internal post startup

Reimplemented in CINOSMcModule.

◆ IsCmdAllowed()

virtual bool CINOSTaskEx::IsCmdAllowed ( CINOSTaskExMsg apMsg)
inlinevirtual

return true if apMsg command is currently allowed (although we're currently owned by another user)

◆ iSetFlag()

virtual void CINOSTaskEx::iSetFlag ( CINOSTaskExMsg apMsg)
protectedvirtual

internal switch core

internal set flag

◆ iShutdown()

virtual void CINOSTaskEx::iShutdown ( CINOSTaskExMsg apMsg)
protectedvirtual

internal shutdown task

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ iStartup() [1/2]

virtual void CINOSTaskEx::iStartup ( CINOSTaskExMsg apMsg)
protectedvirtual

internal startup task

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ iStartup() [2/2]

virtual void CINOSTaskEx::iStartup ( real64  arStage)
protectedvirtual

internal startup task

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ MsgCompleted()

virtual void CINOSTaskEx::MsgCompleted ( CINOSTaskExMsg *&  apMsg)
protectedvirtual

This function should be called whenever handling of apMsg has been completed. The function takes care of putting the message into the message history (if that feature is enabled). Ownership of apMsg will be given to MsgCompleted. Means: The caller of the function is not allowed to use it anymore. Therefore, apMsg will become NULL.

◆ MsgDefer()

virtual tMsgId CINOSTaskEx::MsgDefer ( CINOSTaskExMsg apMsg,
tMsgId  aMsgId,
void apHandler = 0,
void apObject = 0,
bool  abHandlesCommands = false 
)
virtual

defer message until a reply with auMsgId arrives, call obj::handler if available

◆ MsgDone() [1/2]

virtual void CINOSTaskEx::MsgDone ( CINOSTaskExMsg apMsg,
ERplId  aRplId,
tMcAppError  aAppError = 0 
)
virtual

message done -> reply or signal initiator if requested

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ MsgDone() [2/2]

virtual void CINOSTaskEx::MsgDone ( CINOSTaskExMsg apMsg,
tMcAppError  aAppError = 0 
)
virtual

message done -> reply or signal initiator if requested

Reimplemented in CINOSMcModule, and CINOSMcRobot.

◆ PostCreate()

virtual void CINOSTaskEx::PostCreate ( void apParent)
virtual

called after creation

Reimplemented in CINOSMcModule.

◆ PreDestroy()

virtual bool CINOSTaskEx::PreDestroy ( bool bDeleteSelf)
virtual

called before destruction (return false if destruction not allowed)

Reimplemented in CINOSMcModule.

◆ PreDispatchMsg()

virtual bool CINOSTaskEx::PreDispatchMsg ( CINOSTaskExMsg apMsg)
protectedvirtual

Pre dispatcher.

Reimplemented in CINOSMcModule.

◆ PutMsg()

virtual CMcResult CINOSTaskEx::PutMsg ( CINOSTaskExMsg apMsg,
tMsgId  aMsgId = 0 
)
virtual

put message to queue and return command id

Reimplemented in CINOSMcModule.

◆ PutMsgEx()

virtual CMcResult CINOSTaskEx::PutMsgEx ( CINOSTaskExMsg apMsg,
uint32  auFlags,
tMsgId  aMsgId = 0 
)
virtual

Put a message with flags to adjust behaviour.

Parameters
apMsgMessage to add to queue.
auFlagseTaskExMsgFlags to control behaviour of adding.
aMsgIdMessage id to use, 0 to automatically create a new id.
Returns
Result of message or reply code if adding failed.

◆ RemChildCommand()

virtual void CINOSTaskEx::RemChildCommand ( const char apModuleName,
const char apFunctionName 
)
inlinevirtual

remove child command

Reimplemented in CINOSMcModule.

◆ RemChildModule()

virtual void CINOSTaskEx::RemChildModule ( const char apModuleName)
inlinevirtual

remove child command

Reimplemented in CINOSMcModule.

◆ RemCommand()

virtual void CINOSTaskEx::RemCommand ( const char apName)
virtual

remove command

Reimplemented in CINOSMcModule.

◆ RemoveMsgDoneHook()

static void CINOSTaskEx::RemoveMsgDoneHook ( CINOSHook apHook)
static

Remove a previously added MsgDone() hook. This function is thread-safe.

Parameters
apHookThe hook returned by AddMsgDoneHook().

◆ SetDispatchFlag()

void CINOSTaskEx::SetDispatchFlag ( uint32  auFlag)
inline

set dispatch flag. used by the dispatching mechanism to decide whether calls performed by INCO must be executed sync or async (which is, among others, useful for executing callprocedures defined in streamfils).

◆ SetFlag()

virtual void CINOSTaskEx::SetFlag ( uint64  auFlag,
bool  abUpdateState = false 
)
inlineprotectedvirtual

set flag

Reimplemented in CINOSMcModule.

◆ SetIdleTimeout()

virtual CMcResult CINOSTaskEx::SetIdleTimeout ( uint32  auIdleTimeout,
CINOSSync apSync = DF_INOS_SYNCHRONOUS 
)
virtual

get/set idle timeout (in microseconds) of this task. This determines the interval (more precisely, a lower bound for it) for calling iHandleIdleTimeout(), which can be implemented by subclasses for doing periodic background tasks.

◆ Shutdown()

virtual uint32 CINOSTaskEx::Shutdown ( CINOSSync apSync = DF_INOS_SYNCHRONOUS)
overridevirtual

shutdown task

Reimplemented from CINOSTask.


The documentation for this class was generated from the following file: