Jamoma API
0.6.0.a19
|
TTProtocol is the base class for all protocol protocol. More...
#include <TTProtocol.h>
Public Member Functions | |
TTProtocol (const TTValue &arguments) | |
Constructor. More... | |
virtual | ~TTProtocol () |
Destructor. | |
TTErr | setApplicationManager (const TTValue &value) |
Set application manager. More... | |
TTErr | ApplicationRegister (const TTValue &inputValue, TTValue &outputValue) |
Register an application as a client of the protocol. More... | |
TTErr | ApplicationRename (const TTValue &inputValue, TTValue &outputValue) |
Rename an application. More... | |
TTErr | ApplicationUnregister (const TTValue &inputValue, TTValue &outputValue) |
Unregister an application as a client of the protocol. More... | |
TTErr | ApplicationSelect (const TTValue &inputValue, TTValue &outputValue) |
Select an application to access to its own parameters value. More... | |
TTErr | ApplicationSelectLocal () |
Select the local application to access to its own parameters value. More... | |
TTErr | getParameterNames (TTValue &value) |
Get parameters needed by this protocol. More... | |
TTErr | getApplicationParameters (TTSymbol parameterName, TTValue &value) |
Internal accessor to get the parameter of an application. More... | |
TTErr | setApplicationParameters (TTSymbol parameterName, const TTValue &value) |
Internal accessor to set the parameter of an application. More... | |
TTErr | getApplicationNames (TTValue &value) |
Get the names of the registered applications. | |
TTErr | isRegistered (const TTValue &inputValue, TTValue &outputValue) |
Is an application registered for this protocol ? | |
virtual TTErr | Scan (const TTValue &inputValue, TTValue &outputValue)=0 |
Scan to find remote applications and add them to the application manager. More... | |
virtual TTErr | Run (const TTValue &inputValue, TTValue &outputValue)=0 |
virtual TTErr | Stop (const TTValue &inputValue, TTValue &outputValue)=0 |
virtual TTErr | SendDiscoverRequest (TTSymbol to, TTAddress address, TTSymbol &returnedType, TTValue &returnedChildren, TTValue &returnedAttributes, TTUInt8 tryCount=0)=0 |
virtual TTErr | SendDiscoverAllRequest (TTSymbol to, TTAddress address, TTNodePtr node, TTUInt8 tryCount=0)=0 |
virtual TTErr | SendGetRequest (TTSymbol to, TTAddress address, TTValue &returnedValue, TTUInt8 tryCount=0)=0 |
virtual TTErr | SendSetRequest (TTSymbol to, TTAddress address, TTValue &value, TTUInt8 tryCount=0)=0 |
virtual TTErr | SendListenRequest (TTSymbol to, TTAddress address, TTBoolean enable, TTUInt8 tryCount=0)=0 |
virtual TTErr | SendDiscoverAnswer (TTSymbol to, TTAddress address, TTSymbol &returnedType, TTValue &returnedChildren, TTValue &returnedAttributes, TTErr err=kTTErrNone)=0 |
virtual TTErr | SendDiscoverAllAnswer (TTSymbol to, TTAddress address, TTNodePtr node, TTErr err=kTTErrNone)=0 |
virtual TTErr | SendGetAnswer (TTSymbol to, TTAddress address, const TTValue &returnedValue, TTErr err=kTTErrNone)=0 |
virtual TTErr | SendListenAnswer (TTSymbol to, TTAddress address, const TTValue &returnedValue, TTErr err=kTTErrNone)=0 |
TTErr | ReceiveDiscoverRequest (TTSymbol from, TTAddress address) |
TTErr | ReceiveDiscoverAllRequest (TTSymbol from, TTAddress address) |
TTErr | ReceiveGetRequest (TTSymbol from, TTAddress address) |
TTErr | ReceiveSetRequest (TTSymbol from, TTAddress address, const TTValue &newValue) |
TTErr | ReceiveListenRequest (TTSymbol from, TTAddress address, TTBoolean enable) |
TTErr | ReceiveListenAnswer (TTSymbol from, TTAddress address, const TTValue &newValue) |
TTErr | ActivityInMessage (const TTValue &message) |
TTErr | ActivityOutMessage (const TTValue &message) |
Public Member Functions inherited from TTObjectBase | |
virtual | ~TTObjectBase () |
Destructor. | |
TTUInt16 | getReferenceCount () |
Query an object to get its current reference count. More... | |
TTUInt32 | getObserverCount () const |
Query an object to get the number of observers. More... | |
TTErr | registerAttribute (const TTSymbol name, const TTDataType type, void *address) |
Register an attribute. More... | |
TTErr | extendAttribute (const TTSymbol name, const TTObjectBasePtr extendedObject, const TTSymbol extendedName) |
Extend the attribute of an existing TTObjectBase to this TTObjectBase (using another attribute name) More... | |
TTErr | removeAttribute (const TTSymbol name) |
Remove an attribute. More... | |
TTErr | findAttribute (const TTSymbol name, TTAttribute **attr) |
Find an attribute. More... | |
TTErr | setAttributeValue (const TTSymbol name, TTValue &value) |
Set an attribute value for an object. More... | |
template<class T > | |
TTErr | set (const TTSymbol aName, T aValue) |
Set an attribute value for an object This is the same as calling setAttributeValue(). More... | |
TTErr | getAttributeValue (const TTSymbol name, TTValue &value) |
Get an attribute value for an object. More... | |
template<class T > | |
TTErr | get (const TTSymbol aName, T &aReturnedValue) |
Get an attribute value for an object This is the same as calling getAttributeValue(). More... | |
TTSymbol | getAttributeType (const TTSymbol name) |
Return the type of an attribute as a symbol. More... | |
TTErr | getAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value) |
Get the getterFlags of an attribute. More... | |
TTErr | setAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value) |
Set the getterFlags of an attribute. More... | |
TTErr | getAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value) |
Get the setterFlags of an attribute. More... | |
TTErr | setAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value) |
Set the setterFlags of an attribute. More... | |
TTErr | registerAttributeProperty (const TTSymbol attributeName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter) |
Register an attribute property. More... | |
TTErr | registerMessageProperty (const TTSymbol messageName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter) |
Register an message property. More... | |
TTErr | getAttribute (const TTSymbol name, TTAttributePtr *attributeObject) |
Search for and locate an attribute. More... | |
TTErr | getMessage (const TTSymbol name, TTMessagePtr *messageObject) |
Search for and locate a message. More... | |
void | getAttributeNames (TTValue &attributeNameList) |
Return a list of names of the available attributes. More... | |
void | getMessageNames (TTValue &messageNameList) |
Return a list of names of the available messages. More... | |
TTSymbol | getName () const |
Return the name of this class. More... | |
TTErr | registerMessage (const TTSymbol name, TTMethod method) |
Register a message with this object. More... | |
TTErr | findMessage (const TTSymbol name, TTMessage **message) |
Find a message registered with this object. More... | |
TTErr | removeMessage (const TTSymbol name) |
Remove a message. More... | |
TTErr | sendMessage (const TTSymbol name) |
TODO: Document this function. More... | |
TTErr | registerObserverForMessage (const TTObject &observingObject, const TTSymbol messageName) |
Register an observer for a message. More... | |
TTErr | registerObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName) |
Register an observer for an attribute. More... | |
TTErr | registerObserverForNotifications (const TTObject &observingObject) |
Register an observer. More... | |
TTErr | unregisterObserverForMessage (const TTObject &observingObject, const TTSymbol messageName) |
Unregister an observer for a message. More... | |
TTErr | unregisterObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName) |
Unregister an observer for an attribute. More... | |
TTErr | unregisterObserverForNotifications (const TTObject &observingObject) |
Unregister an observer for notifications. More... | |
TTErr | sendNotification (const TTSymbol name, const TTValue &arguments) |
Send a notification. More... | |
TTErr | logMessage (TTImmutableCString fmtstring,...) |
Log messages scoped to this object instance. More... | |
TTErr | logWarning (TTImmutableCString fmtstring,...) |
Log warnings scoped to this object instance. More... | |
TTErr | logError (TTImmutableCString fmtstring,...) |
Log errors scoped to this object instance. More... | |
TTErr | logDebug (TTImmutableCString fmtstring,...) |
Log messages (scoped to this object instance) to output only if the basic debugging flag is enabled in the environment. More... | |
TTErr | lock () |
Lock the object in order to ensure thread-safe processing. More... | |
TTErr | unlock () |
Unlock the object when thread-safe processing is no longer required. More... | |
TTBoolean | isLocked () |
Query if the object currently is locked for thread-safe processing. More... | |
TTBoolean | waitForLock () |
If the object is locked (e.g. More... | |
Public Attributes | |
TTSymbol | mName |
ATTRIBUTE : the name of the protocol to use. | |
TTSymbol | mVersion |
ATTRIBUTE : the version of the protocol. | |
TTSymbol | mAuthor |
ATTRIBUTE : the author of the protocol. | |
TTBoolean | mGet |
ATTRIBUTE : is the Protocol allows to send get request ? | |
TTBoolean | mSet |
ATTRIBUTE : is the Protocol allows to send set request ? | |
TTBoolean | mListen |
ATTRIBUTE : is the Protocol allows to send listen request ? | |
TTBoolean | mDiscover |
ATTRIBUTE : is the Protocol allows to send discover request ? | |
TTBoolean | mDiscoverAll |
ATTRIBUTE : is the Protocol allows to send discover all request ? | |
TTBoolean | mRunning |
ATTRIBUTE : is the Protocol reception thread enable ? | |
TTBoolean | mActivity |
ATTRIBUTE : is the Protocol activity thread enable ? | |
TTSymbol | mSelectedApplication |
internal symbol to select an application to access to its own parameters note : a protocol developper have to use PROTOCOL_PARAMETERto declare specific accessors for a protocol parameter this allows to manage one parameter value per registered application | |
TTValue | mParameterNames |
store the name of the protocol parameters | |
Public Attributes inherited from TTObjectBase | |
TTBoolean | valid |
If the object isn't completely built, or is in the process of freeing, this will be false. | |
TTBoolean | track |
enable the print of a log message to ease the track of reference counting mechanism on an instance More... | |
Protected Attributes | |
TTObject | mApplicationManager |
the application manager of the Modular framework. More... | |
TTSymbol | mLocalApplicationName |
cache local application name | |
TTObject | mActivityInCallback |
a callback to trace raw incoming messages. | |
TTObject | mActivityOutCallback |
a callback to trace raw outputing messages. | |
TTHash | mApplicationParameters |
ATTRIBUTE : hash table containing hash table of parameters for each application registered for communication with this protocol <TTSymbol applicationName, <TTSymbol parameterName, TTValue value>> | |
Protected Attributes inherited from TTObjectBase | |
TTList | observers |
List of all objects watching this object for life-cycle and other changes. | |
Additional Inherited Members | |
Protected Member Functions inherited from TTObjectBase | |
TTObjectBase (const TTValue arguments) | |
Constructor. More... | |
TTProtocol is the base class for all protocol protocol.
It still has knowledge and support for ...
Definition at line 60 of file TTProtocol.h.
TTProtocol::TTProtocol | ( | const TTValue & | arguments | ) |
Constructor.
arguments | TTApplicationManager object, TTCallback for activity in, TTCallback for activity out |
Definition at line 23 of file TTProtocol.cpp.
References addAttribute, addAttributeProperty, addMessage, addMessageWithArguments, ApplicationRegister(), ApplicationRename(), ApplicationSelect(), ApplicationSelectLocal(), ApplicationUnregister(), getApplicationNames(), isRegistered(), kTypeBoolean, kTypeLocalValue, kTypeSymbol, mActivityInCallback, mActivityOutCallback, mApplicationManager, TTObjectBase::registerAttribute(), Run(), Scan(), and Stop().
Notify the protocol that a message is arriving
!!! This a built-in protocol method
message | : an incoming message |
Definition at line 412 of file TTProtocol.cpp.
References mActivityInCallback, and TTObject::send().
Notify the protocol that a message is outputing
!!! This a built-in protocol method
message | : an outputing message |
Definition at line 419 of file TTProtocol.cpp.
References mActivityOutCallback, and TTObject::send().
Register an application as a client of the protocol.
This method allocate a TTHash to store parameters
[in] | inputValue | TTSymbol application name |
[out] | outputValue | nothing |
Definition at line 97 of file TTProtocol.cpp.
References TTHash::append(), TTObject::get(), getParameterNames(), kTTErrGeneric, kTTErrNone, kTypeSymbol, TTHash::lookup(), mApplicationManager, mApplicationParameters, mDiscover, mDiscoverAll, mLocalApplicationName, mSelectedApplication, TTObject::send(), TTObject::set(), and TTValue::size().
Referenced by TTProtocol().
Rename an application.
[in] | inputValue | TTSymbol old application name, TTSymbol new application name |
[out] | outputValue | nothing |
Definition at line 160 of file TTProtocol.cpp.
References TTHash::append(), TTObject::get(), kTTErrGeneric, kTTErrNone, kTypeSymbol, TTHash::lookup(), mApplicationManager, mApplicationParameters, mLocalApplicationName, TTHash::remove(), and TTValue::size().
Referenced by TTProtocol().
Select an application to access to its own parameters value.
[in] | inputValue | TTSymbol application name |
[out] | outputValue | nothing |
Definition at line 226 of file TTProtocol.cpp.
References kTTErrNone, and mSelectedApplication.
Referenced by TTProtocol().
TTErr TTProtocol::ApplicationSelectLocal | ( | ) |
Select the local application to access to its own parameters value.
Definition at line 233 of file TTProtocol.cpp.
References kTTErrNone, mLocalApplicationName, and mSelectedApplication.
Referenced by TTProtocol().
Unregister an application as a client of the protocol.
This method deallocate a TTHash used to store parameters
[in] | inputValue | TTSymbol application name |
[out] | outputValue | nothing |
Definition at line 192 of file TTProtocol.cpp.
References TTObject::get(), kTTErrGeneric, kTypeSymbol, TTHash::lookup(), mApplicationManager, mApplicationParameters, mLocalApplicationName, mSelectedApplication, TTHash::remove(), TTValue::size(), and Stop().
Referenced by TTProtocol().
Internal accessor to get the parameter of an application.
[in] | parameterName | the name of the parameter to get |
[out] | value | returned the selected parameter for the selected application |
Definition at line 239 of file TTProtocol.cpp.
References kTTErrGeneric, TTHash::lookup(), mApplicationParameters, and mSelectedApplication.
Get parameters needed by this protocol.
[out] | value | returned parameter names |
Definition at line 139 of file TTProtocol.h.
References kTTErrNone, and mParameterNames.
Referenced by ApplicationRegister().
Notify the protocol that an application ask for a namespace description
!!! This a built-in protocol method which sends automatically the answer (or a notification if error)
from | : the application where comes from the request |
address | : the address the application wants to discover |
Definition at line 315 of file TTProtocol.cpp.
References kTTErrGeneric, mApplicationManager, mRunning, TTObject::send(), and SendDiscoverAllAnswer().
Notify the protocol that an application ask for a namespace description
!!! This a built-in protocol method which sends automatically the answer (or a notification if error)
from | : the application where comes from the request |
address | : the address the application wants to discover |
Definition at line 291 of file TTProtocol.cpp.
References TTValue::append(), kTTErrGeneric, mApplicationManager, mRunning, TTObject::send(), and SendDiscoverAnswer().
Notify the protocol that an application ask for value
!!! This a built-in protocol method which sends automatically the answer (or a notification if error)
from | : the application where comes from the request |
address | : the address the application wants to get |
Definition at line 335 of file TTProtocol.cpp.
References TTAddress::appendAttribute(), TTAddress::getAttribute(), kTTErrGeneric, mApplicationManager, mRunning, TTObject::send(), and SendGetAnswer().
TTErr TTProtocol::ReceiveListenAnswer | ( | TTSymbol | from, |
TTAddress | address, | ||
const TTValue & | newValue | ||
) |
Notify the protocol that an application answers to a listen request
!!! This a built-in protocol method notify automatically the listener (or send a notification if error)
from | : the application where comes from the answer |
address | : the address where comes from the answer |
newValue | : the answered value |
Definition at line 391 of file TTProtocol.cpp.
References TTValue::append(), TTAddress::appendAttribute(), TTAddress::getAttribute(), kTTErrGeneric, mApplicationManager, mRunning, TTObject::send(), and SendListenAnswer().
Notify the protocol that an application wants to listen (or not) the namespace
!!! This a built-in protocol method which create/remove automatically the listener (or send a notification if error)
from | : the application where comes from the request |
address | : the address the application wants to listen |
enable | : enable/disable the listening |
Definition at line 369 of file TTProtocol.cpp.
References TTValue::append(), TTAddress::appendAttribute(), TTAddress::getAttribute(), kTTErrGeneric, mApplicationManager, mName, mRunning, TTObject::send(), and SendListenAnswer().
Notify the protocol that an application wants to set value
!!! This a built-in protocol method which set automatically the value (or send a notification if error)
from | : the application where comes from the request |
address | : the address the application wants to get |
newValue | : the incoming value |
Definition at line 352 of file TTProtocol.cpp.
References TTValue::append(), TTAddress::appendAttribute(), TTAddress::getAttribute(), mApplicationManager, and TTObject::send().
Run reception thread mechanism for the local application only
inputValue | : nothing to run all registered applications or a TTSymbol application name |
outputValue | : any informations relative to a failure when running the protocol |
Referenced by TTProtocol().
Scan to find remote applications and add them to the application manager.
inputValue | : anything needed for scanning |
outputValue | : all remote device informations |
Referenced by TTProtocol().
|
pure virtual |
Send a discover answer to a application which ask for.
to | : the application where to send answer |
address | : the address where comes from the description |
node | : the node for this address |
Referenced by ReceiveDiscoverAllRequest().
|
pure virtual |
Send a discover all request to an application to fill all the directory under this address
to | : the application where to discover |
address | : the address to discover |
node | : the node for this address |
tryCount | : number of try for this request |
|
pure virtual |
Send a disover answer to a application which ask for.
to | : the application where to send answer |
address | : the address where comes from the description |
returnedType | : the type of the node at the address (default is none which means no type) |
returnedChildren | : all names of nodes below the address |
returnedAttributes | : all attributes the node at the address |
Referenced by ReceiveDiscoverRequest().
|
pure virtual |
Send a discover request to an application to get a part of the namespace at the given address
to | : the application where to discover |
address | : the address to discover |
returnedType | : the type of the node at the address (default is none which means no type) |
returnedChildren | : all names of nodes below the address |
returnedAttributes | : all attributes of the node at the address |
tryCount | : number of try for this request |
|
pure virtual |
Send a get answer to a application which ask for.
to | : the application where to send answer |
address | : the address where comes from the value |
returnedValue | : the value of the attribute at the address |
Referenced by ReceiveGetRequest().
|
pure virtual |
Send a get request to an application to get a value at the given address
to | : the application where to get |
address | : the address to get |
returnedValue | : the value which is going to be filled |
tryCount | : number of try for this request |
|
pure virtual |
Send a listen answer to a application which ask for.
to | : the application where to send answer |
address | : the address where comes from the value |
returnedValue | : the value of the attribute at the address |
Referenced by ReceiveListenAnswer(), and ReceiveListenRequest().
|
pure virtual |
Send a listen request to a specific application
to | : the application where to listen |
address | : the address to listen |
attribute | : the attribute to listen |
enable | : enable/disable the listening |
tryCount | : number of try for this request |
|
pure virtual |
Send a set request to set a value of a specific application
to | : the application where to set |
address | : the address to set |
value | : anything to send |
tryCount | : number of try for this request |
Set application manager.
[in] | value | TTApplicationManager object |
Definition at line 91 of file TTProtocol.cpp.
References kTTErrNone, and mApplicationManager.
Internal accessor to set the parameter of an application.
[in] | parameterName | the name of the parameter to set |
[in] | value | value for selected parameter for the selected application |
Definition at line 254 of file TTProtocol.cpp.
References TTHash::append(), kTTErrGeneric, TTHash::lookup(), mApplicationParameters, mSelectedApplication, and TTHash::remove().
Stop the reception thread mechanism for the local application only
inputValue | : nothing to stop all registered applications or a TTSymbol application name |
outputValue | : any informations relative to a failure when stopping the protocol |
Referenced by ApplicationUnregister(), and TTProtocol().
|
protected |
the application manager of the Modular framework.
protocol programmers should not have to deal with this member.
Definition at line 63 of file TTProtocol.h.
Referenced by ApplicationRegister(), ApplicationRename(), ApplicationUnregister(), ReceiveDiscoverAllRequest(), ReceiveDiscoverRequest(), ReceiveGetRequest(), ReceiveListenAnswer(), ReceiveListenRequest(), ReceiveSetRequest(), setApplicationManager(), and TTProtocol().