Skip to content

Commit

Permalink
Merge pull request FreeOpcUa#16 from oroulet/oroulet
Browse files Browse the repository at this point in the history
fix test, small event improvment
  • Loading branch information
arykovanov committed Sep 20, 2014
2 parents e7ca9ee + 18cd361 commit 1e9e49b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 22 additions & 1 deletion src/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,25 @@ namespace OpcUa
std::cout << "Getting message: " << Message.Text << std::endl;
return ToObject(Message.Text);
}
void SetSourceNode(NodeID node)
{
SourceNode = node;
}

PyNodeID GetSourceNode()
{
return PyNodeID(SourceNode);
}

python::object GetTime()
{
return ToObject(Time);
};

void SetTime(python::object datetime)
{
//FIXME: implement
}

};

Expand Down Expand Up @@ -1560,9 +1579,11 @@ BOOST_PYTHON_MODULE(MODULE_NAME) // MODULE_NAME specifies via preprocessor in co
.def_readwrite("receive_time", &PyEvent::ReceiveTime)
.def_readwrite("time", &PyEvent::Time)
.def_readwrite("source_name", &PyEvent::SourceName)
.def_readwrite("source_node", &PyEvent::SourceNode)
.add_property("message2", &PyEvent::GetMessage, &PyEvent::SetMessage)
.def_readwrite("severity", &PyEvent::Severity)
.add_property("message", &PyEvent::GetMessage, &PyEvent::SetMessage)
.add_property("source_node", &PyEvent::GetSourceNode, &PyEvent::SetSourceNode)
.add_property("time", &PyEvent::GetTime, &PyEvent::SetTime)
;

class_<PySubscription>("Subscription", init<std::shared_ptr<Subscription>>())
Expand Down
2 changes: 0 additions & 2 deletions tests/test_highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,13 @@ def data_change(self, handle, node, val, attr):

self.assertEqual(ret, True) # we went into timeout waiting for subcsription callback
self.assertEqual(msclt.value, [5])
self.assertEqual(msclt.handle, handle1)
self.assertEqual(msclt.node, v1)

v2.set_value(99)
with cond:
ret = cond.wait(0.5)
self.assertEqual(ret, True) # we went into timeout waiting for subcsription callback
self.assertEqual(msclt.value, 99)
self.assertEqual(msclt.handle, handle2)
self.assertEqual(msclt.node, v2)

sub.unsubscribe(handle1)
Expand Down

0 comments on commit 1e9e49b

Please sign in to comment.