CMSDK  2.0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
cmlabs::PsyAPI Struct Reference
Inheritance diagram for cmlabs::PsyAPI:

Public Member Functions

 PsyAPI (PsySpace *space)
 
 ~PsyAPI ()
 
bool setAutoDelete (bool autodel)
 
bool isRunning ()
 
bool shouldContinue ()
 
bool getModuleName (char *name, uint32 maxSize)
 
std::string getCommandlineBasedir ()
 
bool setCommandlineBasedir (const char *cmdlineBasedir)
 
std::string getModuleName ()
 
std::string getOtherModuleName (uint32 id)
 
uint32 getInputQueueSize ()
 
std::string typeToText (PsyType type)
 
std::string contextToText (PsyContext context)
 
bool getCurrentScriptLanguage (char *language, uint32 maxSize)
 
bool getCurrentScript (char *script, uint32 maxSize)
 
bool getCurrentScriptFilename (char *filename, uint32 maxSize)
 
std::string getCurrentScriptLanguage ()
 
std::string getCurrentScript ()
 
std::string getCurrentScriptFilename ()
 
std::set< std::string > getCurrentPostNames ()
 
bool hasCurrentSignalName (const char *name)
 
bool hasCurrentQueryName (const char *name)
 
bool hasCurrentRetrieveName (const char *name)
 
bool hasCurrentPostName (const char *name)
 
DataMessagewaitForNewMessage (uint32 ms)
 
std::string getCurrentTriggerName ()
 
PsyContext getCurrentTriggerContext ()
 
DataMessagewaitForNewMessage (uint32 ms, const char *&triggerName)
 
uint64 getCurrentMessageReceiveTime ()
 
int32 postOutputMessage (const char *postName=NULL, DataMessage *msg=NULL)
 
int32 postOutputMessage (PsyType msgType, DataMessage *msg=NULL)
 
bool emitSignal (const char *name, DataMessage *msg=NULL)
 
DataMessagewaitForSignal (const char *name, uint32 timeout, uint64 lastReceivedTime=0)
 
DataMessageretrieveAllSystemIDs ()
 
bool addSubscription (const char *xml)
 
bool addPsyProbeCustomView (const char *name, const char *templateURL)
 
bool removePsyProbeCustomView (const char *name)
 
bool setPrivateData (const char *name, const char *data, uint64 size, const char *mimetype=NULL)
 
uint64 getPrivateDataSize (const char *name)
 
char * getPrivateDataCopy (const char *name, uint64 &size)
 
bool getPrivateData (const char *name, char *data, uint64 maxSize)
 
bool deletePrivateData (const char *name)
 
bool createParameter (const char *name, const char *val, const char *defaultValue=NULL)
 
bool createParameter (const char *name, const char *val, uint32 count, uint32 defaultIndex)
 
bool createParameter (const char *name, std::vector< std::string > values, const char *defaultValue=NULL)
 
bool createParameter (const char *name, int64 *val, uint32 count, uint32 defaultIndex)
 
bool createParameter (const char *name, std::vector< std::string > values, int64 defaultValue)
 
bool createParameter (const char *name, std::vector< int64 > values, int64 defaultValue=0)
 
bool createParameter (const char *name, float64 *val, uint32 count, uint32 defaultIndex)
 
bool createParameter (const char *name, std::vector< std::string > values, float64 defaultValue)
 
bool createParameter (const char *name, std::vector< float64 > values, float64 defaultValue=0)
 
bool createParameter (const char *name, int64 val, int64 min=0, int64 max=0, int64 interval=0)
 
bool createParameter (const char *name, float64 val, float64 min=0, float64 max=0, float64 interval=0)
 
bool hasParameter (const char *name)
 
bool deleteParameter (const char *name)
 
uint8 getParameterDataType (const char *name)
 
uint32 getParameterValueSize (const char *name)
 
bool getParameter (const char *name, char *val, uint32 maxSize)
 
std::string getParameterString (const char *name)
 
bool getParameterAsBool (const char *name)
 
int64 getParameterInt (const char *name)
 
float64 getParameterFloat (const char *name)
 
bool getParameter (const char *name, int64 &val)
 
bool getParameter (const char *name, float64 &val)
 
bool setParameter (const char *name, const char *val)
 
bool setParameter (const char *name, int64 val)
 
bool setParameter (const char *name, float64 val)
 
bool resetParameter (const char *name)
 
bool tweakParameter (const char *name, int32 tweak)
 
uint8 retrieve (std::list< DataMessage *> &result, const char *name, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
 
uint8 retrieveTimeParam (std::list< DataMessage *> &result, const char *name, uint64 startTime, uint64 endTime=0, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
 
uint8 retrieveStringParam (std::list< DataMessage *> &result, const char *name, const char *startString, const char *endString=NULL, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
 
uint8 retrieveIntegerParam (std::list< DataMessage *> &result, const char *name, int64 startInteger, int64 endInteger=INT64_NOVALUE, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
 
uint8 retrieveFloatParam (std::list< DataMessage *> &result, const char *name, float64 startFloat, float64 endFloat=FLOAT64_NOVALUE, uint32 maxcount=0, uint32 maxage=0, uint32 timeout=5000)
 
uint8 retrieve (std::list< DataMessage *> &result, RetrieveSpec *spec, uint32 timeout=5000)
 
uint8 queryCatalog (char **result, uint32 &resultsize, const char *name, const char *query, const char *operation=NULL, const char *data=NULL, uint32 datasize=0, uint32 timeout=5000)
 
uint8 queryCatalog (DataMessage **resultMsg, const char *name, DataMessage *msg, uint32 timeout=5000)
 
uint8 queryRemoteCatalog (DataMessage **resultMsg, const char *componentName, const char *ipAddress, uint16 port, DataMessage *msg, uint32 timeout=5000)
 
uint8 queryRemoteCatalog (DataMessage **resultMsg, const char *componentName, uint32 ipAddress, uint16 port, DataMessage *msg, uint32 timeout=5000)
 
uint8 queryRemoteCatalog (DataMessage **resultMsg, uint32 &chosenAddress, const char *componentName, uint32 *ipAddresses, uint32 numAddresses, uint16 port, DataMessage *msg, uint32 timeout=5000)
 
bool queryReply (uint32 id, uint8 status, char *data, uint32 size, uint32 count)
 
bool queryReply (uint32 id, uint8 status, DataMessage *msg=NULL)
 
bool logPrint (uint8 level, const char *formatstring,...)
 

Static Public Member Functions

static PsyAPIfromPython (unsigned long long ptr)
 
static const char * fromPythonAddressOf (unsigned long long ptr)
 

Static Public Attributes

static struct PsyType CTRL_SYSTEM_READY
 
static struct PsyType CTRL_PROCESS_INITIALISE
 
static struct PsyType CTRL_PROCESS_GREETING
 
static struct PsyType CTRL_PROCESS_SHUTDOWN
 
static struct PsyType CTRL_CONTEXT_CHANGE
 
static struct PsyType CTRL_SYSTEM_SHUTDOWN
 
static struct PsyType CTRL_SYSTEM_SHUTTINGDOWN
 
static struct PsyType CTRL_TRIGGER
 
static struct PsyType CTRL_QUERY
 
static struct PsyType CTRL_QUERY_REPLY
 
static struct PsyType CTRL_PULLCOMPONENTDATA
 
static struct PsyType CTRL_CREATECUSTOMPAGE
 
static struct PsyType CTRL_ADDSUBSCRIPTION
 
static struct PsyType CTRL_RETRIEVESYSTEMIDS
 
static struct PsyType CTRL_INTERSYSTEM_QUERY
 
static struct PsyType CTRL_INTERSYSTEM_QUERY_REPLY
 

Friends

class PsySpace
 

Constructor & Destructor Documentation

◆ PsyAPI()

cmlabs::PsyAPI::PsyAPI ( PsySpace space)

Constructor from a PsySpace

Parameters
spaceThe space in which the PsyAPI shall be created

◆ ~PsyAPI()

cmlabs::PsyAPI::~PsyAPI ( )

Destructor for the PsyAPI

Member Function Documentation

◆ addPsyProbeCustomView()

bool cmlabs::PsyAPI::addPsyProbeCustomView ( const char *  name,
const char *  templateURL 
)

Add a custom module view tab for the PsyProbe web interface by providing a template file

  • this file will need to use PsyProbe javascript to work - see the PsyProbe documentation for more info.
Parameters
namename of the custom module view tab
templateURLThe path to the template file
Returns
true if successful

◆ addSubscription()

bool cmlabs::PsyAPI::addSubscription ( const char *  xml)

This function adds triggers and posts to an existing registration

Parameters
xml<registration name="modulename"><trigger.../>...<post.../></registration>
Returns
true if successful

◆ contextToText()

std::string cmlabs::PsyAPI::contextToText ( PsyContext  context)

Get textual representation of the context

Parameters
contextcontext as PsyContext object
Returns
context as string

◆ createParameter() [1/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
const char *  val,
const char *  defaultValue = NULL 
)
inline

Creates a new string parameter

Parameters
namename of the parameter
valvalue of the parameter
defaultValuedefault value when resetting parameter, NULL if val should be used
Returns
true if creation was successful

◆ createParameter() [2/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
const char *  val,
uint32  count,
uint32  defaultIndex 
)
inline

Creates a new string list parameter with room for count entries

Parameters
namename of the parameter
valvalue array of the parameter, separed by binary \0
countnumber of entries in the array
defaultIndexan int value that sets the default index in the list
Returns
true if creation was successful

◆ createParameter() [3/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
std::vector< std::string >  values,
const char *  defaultValue = NULL 
)
inline

Creates a new string parameter with a list of values

Parameters
namename of the parameter
valuesvector of values of the parameter
defaultValuedefault value or NULL for the first entry
Returns
true if creation was successful

◆ createParameter() [4/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
int64 *  val,
uint32  count,
uint32  defaultIndex 
)
inline

Creates a new integer list parameter with room for count entries

Parameters
namename of the parameter
valarray of values of the parameter
countnumber of entries in the array
defaultIndexan int value that sets the default index in the list
Returns
true if creation was successful

◆ createParameter() [5/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
std::vector< std::string >  values,
int64  defaultValue 
)
inline

Creates a new String parameter with list of integer values (?)

Parameters
namename of the parameter
valuesvector with values of the parameter
defaultValuedefault as int
Returns
true if creation was successful

◆ createParameter() [6/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
std::vector< int64 >  values,
int64  defaultValue = 0 
)
inline

Creates a new integer parameter with list of values

Parameters
namename of the parameter
valuesvector of values of the parameter
defaultValuedefault is 0
Returns
true if creation was successful

◆ createParameter() [7/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
float64 *  val,
uint32  count,
uint32  defaultIndex 
)
inline

Creates a new float parameter

Parameters
namename of the parameter
valarray of value of the parameter
defaultIndexan int value that sets the default index in the list
Returns
true if creation was successful

◆ createParameter() [8/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
std::vector< std::string >  values,
float64  defaultValue 
)
inline

Creates a new string parameter with list of float values (?)

Parameters
namename of the parameter
valuesvector of values of the parameter
defaultValuefloat value as default
Returns
true if creation was successful

◆ createParameter() [9/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
std::vector< float64 >  values,
float64  defaultValue = 0 
)
inline

Creates a new float parameter with list of float values (?)

Parameters
namename of the parameter
valuesvector of values of the parameter
defaultValuedefault is 0
Returns
true if creation was successful

◆ createParameter() [10/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
int64  val,
int64  min = 0,
int64  max = 0,
int64  interval = 0 
)
inline

Creates a new integer parameter

Parameters
namename of the parameter
valvalue of the parameter
minthe minimum value
maxthe maximum value interval limit, amount to jump on every tweak
Returns
true if creation was successful

◆ createParameter() [11/11]

bool cmlabs::PsyAPI::createParameter ( const char *  name,
float64  val,
float64  min = 0,
float64  max = 0,
float64  interval = 0 
)
inline

Creates a new float parameter with min, max and interval limits for allowed values

Parameters
namename of the parameter
valvalue of the parameter
minminimum value
maxmaximum value interval limit, amount to jump on every tweak
Returns
true if creation was successful

◆ deleteParameter()

bool cmlabs::PsyAPI::deleteParameter ( const char *  name)
inline

Deletes a named parameter

Parameters
namename of the parameter
Returns
true if deletion was successful

◆ deletePrivateData()

bool cmlabs::PsyAPI::deletePrivateData ( const char *  name)
inline

Deletes a private data chunk by name.

Parameters
namethe name of the chunk to be deleted
Returns
true if deletion was successful

◆ emitSignal()

bool cmlabs::PsyAPI::emitSignal ( const char *  name,
DataMessage msg = NULL 
)

This function call triggers the sending of a signal by name. If no message is provided an empty one will be created.

Parameters
namename of the signal to be sent
msgmessage to be sent, empty message if NULL
Returns
true if successful

◆ fromPython()

PsyAPI * cmlabs::PsyAPI::fromPython ( unsigned long long  ptr)
static

Internal use only

◆ getCommandlineBasedir()

std::string cmlabs::PsyAPI::getCommandlineBasedir ( )

Get the base dir that Psyclone is running from

Returns
the base dir as a string

◆ getCurrentMessageReceiveTime()

uint64 cmlabs::PsyAPI::getCurrentMessageReceiveTime ( )

Get current message receive time

Returns
current message receive time

◆ getCurrentPostNames()

std::set< std::string > cmlabs::PsyAPI::getCurrentPostNames ( )

Get a list of post names currently active - i.e. the post names that can be used right now

Returns
the post names as a list of strings

◆ getCurrentScript() [1/2]

bool cmlabs::PsyAPI::getCurrentScript ( char *  script,
uint32  maxSize 
)

Internal use only

◆ getCurrentScript() [2/2]

std::string cmlabs::PsyAPI::getCurrentScript ( )

Internal use only

◆ getCurrentScriptFilename() [1/2]

bool cmlabs::PsyAPI::getCurrentScriptFilename ( char *  filename,
uint32  maxSize 
)

Internal use only

◆ getCurrentScriptFilename() [2/2]

std::string cmlabs::PsyAPI::getCurrentScriptFilename ( )

Internal use only

◆ getCurrentScriptLanguage() [1/2]

bool cmlabs::PsyAPI::getCurrentScriptLanguage ( char *  language,
uint32  maxSize 
)

Internal use only

◆ getCurrentScriptLanguage() [2/2]

std::string cmlabs::PsyAPI::getCurrentScriptLanguage ( )

Internal use only

◆ getCurrentTriggerContext()

PsyContext cmlabs::PsyAPI::getCurrentTriggerContext ( )

Get the context of the current trigger, just retrieved using waitForNewMessage()

Returns
Context as PsyContext

◆ getCurrentTriggerName()

std::string cmlabs::PsyAPI::getCurrentTriggerName ( )

Get the name of the current trigger, just retrieved using waitForNewMessage()

Returns
Triggername as String

◆ getInputQueueSize()

uint32 cmlabs::PsyAPI::getInputQueueSize ( )

Get the size of the input queue, i.e. how many unprocessed trigger messages waiting to be processed

Returns
size of the input queue

◆ getModuleName() [1/2]

bool cmlabs::PsyAPI::getModuleName ( char *  name,
uint32  maxSize 
)

Get the name of the module written into the memory of name and return size

Parameters
namethe chunk of memory that the name of the module will be written into
maxSizethe size of the memory chunk of tha name parameter
Returns
true if module with that name exists and the size of the name is smaller than maySize

◆ getModuleName() [2/2]

std::string cmlabs::PsyAPI::getModuleName ( )

Get the module name

Returns
module name as String

◆ getOtherModuleName()

std::string cmlabs::PsyAPI::getOtherModuleName ( uint32  id)

Get the name of another module by id

Parameters
idthe id of the other module
Returns
module name as String

◆ getParameter() [1/3]

bool cmlabs::PsyAPI::getParameter ( const char *  name,
char *  val,
uint32  maxSize 
)
inline

Read string parameter into existing data chunk val, maximum size maxSize.

Parameters
namename of the parameter
valvalue of the parameter
maxSizemaximal size of the parameter to be read
Returns
true if reading was successful

◆ getParameter() [2/3]

bool cmlabs::PsyAPI::getParameter ( const char *  name,
int64 &  val 
)
inline

Read integer parameter value

Parameters
namename of the parameter
valvalue of the parameter
Returns
true if reading was successful

◆ getParameter() [3/3]

bool cmlabs::PsyAPI::getParameter ( const char *  name,
float64 &  val 
)
inline

Read float parameter value

Parameters
namename of the parameter
valvalue of the parameter
Returns
true if reading was successful

◆ getParameterAsBool()

bool cmlabs::PsyAPI::getParameterAsBool ( const char *  name)
inline

Read and interpret value of parameter by name as boolean True: String 'Yes', Integer and Float non-zero False: String not 'Yes', Integer and Float zero

Parameters
namename of the parameter
Returns
boolean interpretation of value of the paramer

◆ getParameterDataType()

uint8 cmlabs::PsyAPI::getParameterDataType ( const char *  name)
inline

Gets the parameter type

#define PARAM_STRING 1

#define PARAM_INTEGER 2

#define PARAM_FLOAT 3

#define PARAM_STRING_COLL 4

#define PARAM_INTEGER_COLL 5

#define PARAM_FLOAT_COLL 6

#define PARAM_TYPE_COLL 7

Parameters
namename of the parameter
Returns
1 for String, 2 for int, 3 for float, 4 for String Collection, 5 for int collection, 6 for florat collection, 7 for type collection

◆ getParameterFloat()

float64 cmlabs::PsyAPI::getParameterFloat ( const char *  name)
inline

Read and return value of parameter by name

Parameters
namename of the parameter
Returns
value of the paramer

◆ getParameterInt()

int64 cmlabs::PsyAPI::getParameterInt ( const char *  name)
inline

Read and return value of parameter by name

Parameters
namename of the parameter
Returns
value of the paramer

◆ getParameterString()

std::string cmlabs::PsyAPI::getParameterString ( const char *  name)
inline

Read and return value of parameter by name

Parameters
namename of the parameter
Returns
value of the paramer

◆ getParameterValueSize()

uint32 cmlabs::PsyAPI::getParameterValueSize ( const char *  name)
inline

Return the amount of memory in bytes used by the parameter

Parameters
namename of the parameter
Returns
amount of memory in bytes

◆ getPrivateData()

bool cmlabs::PsyAPI::getPrivateData ( const char *  name,
char *  data,
uint64  maxSize 
)
inline

Reads a private chunk from the system into existing data space, maximum size is maxSize.

Parameters
namename of the data chunk
datapointer to an already allocated memory chunk
maxSizemaximum size of the already allocated memory chunk
Returns
true if reading was successful

◆ getPrivateDataCopy()

char* cmlabs::PsyAPI::getPrivateDataCopy ( const char *  name,
uint64 &  size 
)
inline

Returns a new data chunk copy of a private entry, with the size written into size.

Parameters
namename of the data chunk
sizememory size of the data returned
Returns
new data chunk copy of a private entry

◆ getPrivateDataSize()

uint64 cmlabs::PsyAPI::getPrivateDataSize ( const char *  name)
inline

This returns the size of the private data chunk previously saved by the crank.

Parameters
namename of the data chunk
Returns
size of the private data chunk

◆ hasCurrentPostName()

bool cmlabs::PsyAPI::hasCurrentPostName ( const char *  name)

Check to see if the post name is currently active - i.e. can this post be used right now

Returns
true if the post name is active, otherwise false

◆ hasCurrentQueryName()

bool cmlabs::PsyAPI::hasCurrentQueryName ( const char *  name)

Check to see if the query name is currently active - i.e. can this query be used right now

Returns
true if the query name is active, otherwise false

◆ hasCurrentRetrieveName()

bool cmlabs::PsyAPI::hasCurrentRetrieveName ( const char *  name)

Check to see if the retrieve name is currently active - i.e. can this retrieve be used right now

Returns
true if the retrieve name is active, otherwise false

◆ hasCurrentSignalName()

bool cmlabs::PsyAPI::hasCurrentSignalName ( const char *  name)

Check to see if the signal name is currently active - i.e. can this signal be used right now

Returns
true if the signal name is active, otherwise false

◆ hasParameter()

bool cmlabs::PsyAPI::hasParameter ( const char *  name)
inline

Checks if a named parameter exists

Parameters
namename of the parameter
Returns
true if it exists, false otherwise

◆ isRunning()

bool cmlabs::PsyAPI::isRunning ( )

Internal use only

◆ postOutputMessage() [1/2]

int32 cmlabs::PsyAPI::postOutputMessage ( const char *  postName = NULL,
DataMessage msg = NULL 
)

The crank uses this function to post messages. The actual message posted will depend on the spec post entries. If no postName is provided then all active post entries will be used and one copy of the message posted per post entry. If no message is provided an empty message will be used instead. If no active posts match zero or a negative integer is returned, otherwise the number of messages sent is returned. Negative values indicate

POST_FAILED -1 Error occurred while trying to post the message

POST_NOSPEC -2 The crank tried to post a message before a trigger arrived

POST_OUTOFCONTEXT -3 The crank is no longer active because the context has changed and is no longer active

Parameters
postNamename of the Post. If none is provided then all active post entries will be used and one copy of the message posted per post entry.
msgmessage. If none is provided an empty message will be used instead.
Returns
number of messages sent

◆ postOutputMessage() [2/2]

int32 cmlabs::PsyAPI::postOutputMessage ( PsyType  msgType,
DataMessage msg = NULL 
)

The crank uses this function to post messages. The actual message posted will depend on the spec post entries. If no postName is provided then all active post entries will be used and one copy of the message posted per post entry. If no message is provided an empty message will be used instead. If no active posts match zero or a negative integer is returned, otherwise the number of messages sent is returned. Negative values indicate

POST_FAILED -1 Error occurred while trying to post the message

POST_NOSPEC -2 The crank tried to post a message before a trigger arrived

POST_OUTOFCONTEXT -3 The crank is no longer active because the context has changed and is no longer active

Parameters
msgTypemsg type of the Post. If none is provided then all active post entries will be used and one copy of the message posted per post entry.
msgmessage. If none is provided an empty message will be used instead.
Returns
number of messages sent

◆ queryCatalog() [1/2]

uint8 cmlabs::PsyAPI::queryCatalog ( char **  result,
uint32 &  resultsize,
const char *  name,
const char *  query,
const char *  operation = NULL,
const char *  data = NULL,
uint32  datasize = 0,
uint32  timeout = 5000 
)

Used by a module to send a query to another module or catalog by name. The query details are provided in the module spec by name.

Parameters
resulta bucket parameter filled by the function.
resultsizethis value will be filled in with the output size of the answer to the query
querythe actual query sent to the catalog
namename of the query defined in the PsySpec
operationspecify the custom operation by name (example could be 'read' or 'write' for the FileCatalog)
dataprovide optional data to send to as part of the query (example could be the data to write to a file for the FileCatalog)
datasizesize of the optional data
timeoutif no reply is retrieved after this time, NULL is returned
Returns
the status of the reply from the catalog

◆ queryCatalog() [2/2]

uint8 cmlabs::PsyAPI::queryCatalog ( DataMessage **  resultMsg,
const char *  name,
DataMessage msg,
uint32  timeout = 5000 
)

Used by a module to send a query to another module or catalog by name. The query details are provided in the message parameter and will not require or use any data from the PsySpec.

Parameters
resultthe reply message, if one is returned.
namename of the query defined in the PsySpec
msgthe msg to be sent to the catalog as the query input
timeoutif no reply is retrieved after this time, NULL is returned
Returns
the status of the reply from the catalog

◆ queryRemoteCatalog() [1/3]

uint8 cmlabs::PsyAPI::queryRemoteCatalog ( DataMessage **  resultMsg,
const char *  componentName,
const char *  ipAddress,
uint16  port,
DataMessage msg,
uint32  timeout = 5000 
)

Used by a module to send a query to a module or catalog by name in a different Psyclone system. Will not require or use any data from the PsySpec.

Parameters
resultthe reply message, if one is returned.
componentNamename of the component to be queried in the remote system
ipAddressIP address of the remote system in text
portmain Psyclone port of the remote system
msgthe msg to be sent to the catalog as the query input
timeoutif no reply is retrieved after this time, NULL is returned
Returns
the status of the reply from the catalog

◆ queryRemoteCatalog() [2/3]

uint8 cmlabs::PsyAPI::queryRemoteCatalog ( DataMessage **  resultMsg,
const char *  componentName,
uint32  ipAddress,
uint16  port,
DataMessage msg,
uint32  timeout = 5000 
)

Used by a module to send a query to a module or catalog by name in a different Psyclone system. Will not require or use any data from the PsySpec.

Parameters
resultthe reply message, if one is returned.
componentNamename of the component to be queried in the remote system
ipAddressIP address of the remote system in UINT32 format
portmain Psyclone port of the remote system
msgthe msg to be sent to the catalog as the query input
timeoutif no reply is retrieved after this time, NULL is returned
Returns
the status of the reply from the catalog

◆ queryRemoteCatalog() [3/3]

uint8 cmlabs::PsyAPI::queryRemoteCatalog ( DataMessage **  resultMsg,
uint32 &  chosenAddress,
const char *  componentName,
uint32 *  ipAddresses,
uint32  numAddresses,
uint16  port,
DataMessage msg,
uint32  timeout = 5000 
)

Used by a module to send a query to a module or catalog by name in a different Psyclone system. Will not require or use any data from the PsySpec.

Parameters
resultthe reply message, if one is returned.
chosenAddressif set >0 this address will be attempted first, will always return the index of the first working address, if successful
componentNamename of the component to be queried in the remote system
ipAddresseslist of IP addresses of the remote system in UINT32 format
numAddressesnumber of addresses presented
portmain Psyclone port of the remote system
msgthe msg to be sent to the catalog as the query input
timeoutif no reply is retrieved after this time, NULL is returned
Returns
the status of the reply from the catalog

◆ queryReply() [1/2]

bool cmlabs::PsyAPI::queryReply ( uint32  id,
uint8  status,
char *  data,
uint32  size,
uint32  count 
)

Used by a module to reply to an incoming query by id. Status can be

#define QUERY_FAILED 1

#define QUERY_TIMEOUT 2

#define QUERY_NAME_UNKNOWN 3

#define QUERY_COMPONENT_UNKNOWN 4

#define QUERY_QUERYFAILED 5

#define QUERY_SUCCESS 6

#define QUERY_NOT_AVAILABLE 7

Binary reply data of size size can be added and a count can indicate the number of entries in the data chunk.

Parameters
idid of the incoming query to reply to
statussee description
dataoptional binary data to reply with
sizesize of optional binary data
countoptional resulting count for operation, if appropriate
Returns
true if reply was successful

◆ queryReply() [2/2]

bool cmlabs::PsyAPI::queryReply ( uint32  id,
uint8  status,
DataMessage msg = NULL 
)

Used by a module to send a message as a reply to an incoming query

Parameters
idid of the incoming query to reply to
statussee description of queryReply(uint32 id, uint8 status, char* data, uint32 size, uint32 count);
msg
Returns
true if reply was successful

◆ removePsyProbeCustomView()

bool cmlabs::PsyAPI::removePsyProbeCustomView ( const char *  name)
inline

Remove a custom module view tab for the PsyProbe web interface

Parameters
namename of the custom view
Returns
true if removal was successful

◆ resetParameter()

bool cmlabs::PsyAPI::resetParameter ( const char *  name)
inline

Reset parameter to its default (or initial) value

Parameters
namename of the parameter
Returns
true if successful

◆ retrieve() [1/2]

uint8 cmlabs::PsyAPI::retrieve ( std::list< DataMessage *> &  result,
const char *  name,
uint32  maxcount = 0,
uint32  maxage = 0,
uint32  timeout = 5000 
)

Used by a module to retrieve messages from a whiteboard. The retrieve details are provided in the module spec by name. maxcount and maxage can be provided to add to the spec details.

Parameters
resulta bucket parameter filled by the function. A list of messages.
namename of the messages to be retrieved
maxcountthe maximal number of messages to be retrieved
maxagethe maximal age of the messages to be retrieved
timeoutif no messages are retrieved after this time, NULL is returned (?)
Returns
the messages from the whiteboard

◆ retrieve() [2/2]

uint8 cmlabs::PsyAPI::retrieve ( std::list< DataMessage *> &  result,
RetrieveSpec spec,
uint32  timeout = 5000 
)

Used by a module to retrieve messages from a whiteboard. The retrieve details are provided in the module spec by name.

Parameters
resulta bucket parameter filled by the function. A list of messages.
specthe module spec with retrieve details
timeoutif no messages are retrieved after this time, NULL is returned (?)
Returns
the messages from the whiteboard

◆ retrieveAllSystemIDs()

DataMessage* cmlabs::PsyAPI::retrieveAllSystemIDs ( )
inline

This function retrieves all names for types, contexts and components

Returns
message containing all names for types, contexts and components

◆ retrieveFloatParam()

uint8 cmlabs::PsyAPI::retrieveFloatParam ( std::list< DataMessage *> &  result,
const char *  name,
float64  startFloat,
float64  endFloat = FLOAT64_NOVALUE,
uint32  maxcount = 0,
uint32  maxage = 0,
uint32  timeout = 5000 
)

Used by a module to retrieve messages from a whiteboard. The retrieve details are provided in the module spec by name. maxcount and maxage can be provided to add to the spec details.

Parameters
resulta bucket parameter filled by the function. A list of messages.
namename of the whiteboard defined in the PsySpec
startFloatthis value marks the beginning of the selection of values that the functions shall return
endFloatthis value marks the end of the selection of values that the functions shall return
maxcountthe maximal number of messages to be retrieved
maxagethe maximal age of the messages to be retrieved
timeoutif no messages are retrieved after this time, NULL is returned (?)
Returns
the messages from the whiteboard

◆ retrieveIntegerParam()

uint8 cmlabs::PsyAPI::retrieveIntegerParam ( std::list< DataMessage *> &  result,
const char *  name,
int64  startInteger,
int64  endInteger = INT64_NOVALUE,
uint32  maxcount = 0,
uint32  maxage = 0,
uint32  timeout = 5000 
)

Used by a module to retrieve messages from a whiteboard. The retrieve details are provided in the module spec by name. startInteger and endInteger can be provided to add to the spec details.

Parameters
resulta bucket parameter filled by the function. A list of messages.
namename of the whiteboard defined in the PsySpec
startIntegerthis value marks the beginning of the selection of values that the functions shall return
endIntegerthis value marks the end of the selection of values that the functions shall return
maxcountthe maximal number of messages to be retrieved
maxagethe maximal age of the messages to be retrieved
timeoutif no messages are retrieved after this time, NULL is returned (?)
Returns
the messages from the whiteboard

◆ retrieveStringParam()

uint8 cmlabs::PsyAPI::retrieveStringParam ( std::list< DataMessage *> &  result,
const char *  name,
const char *  startString,
const char *  endString = NULL,
uint32  maxcount = 0,
uint32  maxage = 0,
uint32  timeout = 5000 
)

Used by a module to retrieve messages from a whiteboard. The retrieve details are provided in the module spec by name. startTime and endTime can be provided to add to the spec details.

Parameters
resulta bucket parameter filled by the function. A list of messages.
namename of the whiteboard defined in the PsySpec
startStringthis String marks the beginning of the selection of Strings that the functions shall return
endStringthis String marks the end of the selection of Strings that the functions shall return
maxcountthe maximal number of messages to be retrieved
maxagethe maximal age of the messages to be retrieved
timeoutif no messages are retrieved after this time, NULL is returned (?)
Returns
the messages from the whiteboard

◆ retrieveTimeParam()

uint8 cmlabs::PsyAPI::retrieveTimeParam ( std::list< DataMessage *> &  result,
const char *  name,
uint64  startTime,
uint64  endTime = 0,
uint32  maxcount = 0,
uint32  maxage = 0,
uint32  timeout = 5000 
)

Used by a module to retrieve messages from a whiteboard. The retrieve details are provided in the module spec by name. maxcount and maxage can be provided to add to the spec details.

Parameters
resulta bucket parameter filled by the function. A list of messages.
namename of the whiteboard defined in the PsySpec
maxcountthe maximal number of messages to be retrieved
maxagethe maximal age of the messages to be retrieved
timeoutif no messages are retrieved after this time, NULL is returned (?)
Returns
the messages from the whiteboard

◆ setAutoDelete()

bool cmlabs::PsyAPI::setAutoDelete ( bool  autodel)

Internal use only

◆ setCommandlineBasedir()

bool cmlabs::PsyAPI::setCommandlineBasedir ( const char *  cmdlineBasedir)

Internal use only

◆ setParameter() [1/3]

bool cmlabs::PsyAPI::setParameter ( const char *  name,
const char *  val 
)
inline

Set string parameter value

Parameters
namename of the parameter
valvalue of the parameter
Returns
true if successful

◆ setParameter() [2/3]

bool cmlabs::PsyAPI::setParameter ( const char *  name,
int64  val 
)
inline

Set integer parameter value

Parameters
namename of the parameter
valvalue of the parameter
Returns
true if successful

◆ setParameter() [3/3]

bool cmlabs::PsyAPI::setParameter ( const char *  name,
float64  val 
)
inline

Set float parameter value

Parameters
namename of the parameter
valvalue of the parameter
Returns
true if successful

◆ setPrivateData()

bool cmlabs::PsyAPI::setPrivateData ( const char *  name,
const char *  data,
uint64  size,
const char *  mimetype = NULL 
)
inline

The crank can use this function to store chunks of data centrally so it doesn't have to do it. This means that if the crank exits (or crashes) the data will still be available when it is triggered again.

Parameters
namename of the data chunk data the data to be stored
sizememory size of the data
Returns
true if successful

◆ shouldContinue()

bool cmlabs::PsyAPI::shouldContinue ( )

Check to see if crank should exit, needs to be checked regularly

Returns
true if the crank should continue

◆ tweakParameter()

bool cmlabs::PsyAPI::tweakParameter ( const char *  name,
int32  tweak 
)
inline

Step up or down list or range parameter value. If list steps to next or previous value, if range adds or subtracts interval while staying in the min-max range.

Parameters
namename of the parameter
tweaknumber of steps to tweak, positive is upwards, negative is downwards
Returns
true if successful

◆ typeToText()

std::string cmlabs::PsyAPI::typeToText ( PsyType  type)

Get textual representation of the type

Parameters
typetype as PsyType object
Returns
type as string

◆ waitForNewMessage() [1/2]

DataMessage * cmlabs::PsyAPI::waitForNewMessage ( uint32  ms)

This function waits for the next trigger message to arrive and if it did within the timeout (ms) the message is returned. The message is owned by the system and should never be deleted by the crank. If no message arrives within the timeout NULL is returned.

Parameters
msthe timeout
Returns
the message or NULL if none arrives

◆ waitForNewMessage() [2/2]

DataMessage * cmlabs::PsyAPI::waitForNewMessage ( uint32  ms,
const char *&  triggerName 
)

This function waits for the next trigger message to arrive and if it did within the timeout (ms) the message is returned and triggerName indicates the name of the trigger from the spec. The message is owned by the system and should never be deleted by the crank. If no message arrives within the timeout NULL is returned.

Parameters
msthe timeout
triggerNamethe name of the trigger from the spec returned
Returns
the message or NULL if none arrives

◆ waitForSignal()

DataMessage * cmlabs::PsyAPI::waitForSignal ( const char *  name,
uint32  timeout,
uint64  lastReceivedTime = 0 
)

This function waits for the next signal message to arrive and if it did within the timeout (ms) the message is returned and name indicates the name of the signal from the spec. The message is owned by the system and should never be deleted by the crank. If no message arrives within the timeout NULL is returned. If lastReceivedTime is set to a time value signals sent before this time are skipped, if not the next unread signal is returned.

Parameters
namename of the signal that is waited for
timeouttime to be waited for signal to arrive
lastReceivedTimesignals sent before this time are skipped
Returns
true if successful

The documentation for this struct was generated from the following files: