Changeset 461
- Timestamp:
- 04/09/07 09:25:30 (16 years ago)
- Files:
-
- trunk/libffado/src/libosc/OscNode.cpp (modified) (6 diffs)
- trunk/libffado/src/libosc/unittests.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libosc/OscNode.cpp
r445 r461 76 76 OscNode::processOscMessage(string path, OscMessage *m) 77 77 { 78 debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) MSG: %s\n",this, path.c_str());78 debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) {%s} MSG: %s\n", this, m_oscBase.c_str(), path.c_str()); 79 79 80 80 // delete leading slash … … 91 91 92 92 // process the message 93 m->setPath(""); // handled by the node itself 93 94 retVal=processOscMessage(m); 94 95 … … 100 101 101 102 } else { // it targets a deeper node 103 OscResponse retVal; 104 102 105 string newpath=path.substr(firstsep+1); 103 106 int secondsep=newpath.find_first_of('/'); … … 109 112 } 110 113 114 // first try to find a child node that might be able 115 // to handle this. 116 // NOTE: the current model allows only one node to 117 // handle a request, and then the default 118 // handler. 111 119 for ( OscNodeVectorIterator it = m_ChildNodes.begin(); 112 120 it != m_ChildNodes.end(); … … 117 125 } 118 126 } 127 128 // The path is not registered as a child node. 129 // This node should handle it 119 130 debugOutput( DEBUG_LEVEL_VERBOSE, "Child node %s not found \n",newbase.c_str()); 120 131 121 return OscResponse(OscResponse::eError); 132 m->setPath(newpath); // the remaining portion of the path 133 retVal=processOscMessage(m); 134 135 if(retVal.isHandled()) { 136 return retVal; // completely handled 137 } 138 // (partially) unhandled 139 return processOscMessageDefault(m, retVal); 122 140 } 123 141 return OscResponse(OscResponse::eError); … … 130 148 OscNode::processOscMessage(OscMessage *m) 131 149 { 132 debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) MSG PROCESS: %s\n", this, m->getPath().c_str());150 debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) {%s} DEFAULT PROCESS: %s\n", this, m_oscBase.c_str(), m->getPath().c_str()); 133 151 m->print(); 134 152 return OscResponse(OscResponse::eUnhandled); // handled but no response trunk/libffado/src/libosc/unittests.cpp
r452 r461 104 104 result &= TEST_SHOULD_RETURN_FALSE(n1.processOscMessage("base1/child1/subchild1",&m).isError()); 105 105 result &= TEST_SHOULD_RETURN_FALSE(n1.processOscMessage("base1/child1/subchild2",&m).isError()); 106 result &= TEST_SHOULD_RETURN_TRUE(n1.processOscMessage("base1/child1/subchild3",&m).isError());107 106 result &= TEST_SHOULD_RETURN_FALSE(n1.processOscMessage("base1/child2",&m).isError()); 108 result &= TEST_SHOULD_RETURN_TRUE(n1.processOscMessage("base1/child2/subchild1",&m).isError()); 107 result &= TEST_SHOULD_RETURN_FALSE(n1.processOscMessage("base1/child1/subchild3",&m).isHandled()); 108 result &= TEST_SHOULD_RETURN_FALSE(n1.processOscMessage("base1/child2/subchild1/test1",&m).isHandled()); 109 109 110 110 return result;