#include <l1394_eventhandle.h>
Inheritance diagram for L1394::EventHandle:
Public Member Functions | |
EventHandle constructor | |
These functions creates the EventHandle objects. | |
EventHandle () | |
Constructor. | |
virtual | ~EventHandle () |
Destructor. | |
Functions that are called by an event | |
These functions can be re-implement to handle a certain event. | |
virtual void | busreset (const Card *) |
This method handles the BUSRESET event. | |
virtual void | nodeDestroy (const Node *) |
this method handles the NODE_DESTROY event. | |
virtual void | nodeDisabled (const Node *) |
This method handles the NODE_DISABLED event. | |
virtual void | nodeEnabled (const Node *) |
This method handles the NODE_ENABLED event. |
The idea of this class is, to inherit external classes from this class, to get information about changes on FireWire bus. This Class provides functions for every defined event. After creating an EventHandle you can add it to every Node (see example).
By default all functions do nothing and only the interest functions must be re-implemented. At this time there are five functions (and events) that can be used:
Method busreset(const Card*):
This method is called if a busreset occur. This method is only called from Card objects.
Method nodeDisabled(const Node*):
This method is called, if a node is disconnected form the bus. The Node object is moved in the inactive_node_list, but not deleted.
Method nodeEnabled(const Node*):
This method is called, if a known node is reconnect to the bus. A known node, is a node which object is in the inactive_node_list.
Method nodeDestroy(const Node*):
This method is called, if the destructor of a Node object is called. After a defined time interval a Node object in the inactive_node_list is deleted.
A little example show the idea
#include <l1394_session.h> using namespace l1394; class MyEventHandle : public EventHandle { MyEventHandle(Node* node) {my_node = node; my_node->addEventHandle(this);} //connect this handle to all events ~MyEventHandle() { if (my_node != NULL) my_node->removeEventHandle(this);} void busreset(const Card* n) { cout << "Bus reset" << endl; } //occur only, if my_node is a Card void nodeDisabled(const Node* n) { cout << "Node disconnected from bus "<< endl;} void nodeEnabled(const Node* n) {cout << "Node is back on bus" << endl;} void nodeDestroy(const Node* n) {cout << "Object is deleted " << endl; my_node = NULL;} private: Node* my_node; } int main(int argc, char* argv[]) { Session *session = GetSession(); Card* card = session->getCard(0); MyEventHandle* event_handle = NULL; if (card != NULL) event_handle = new MyEventHandle(card); //Now you get Information delete event_handle; delete session; }
Definition at line 91 of file l1394_eventhandle.h.
|
Constructor.
Definition at line 101 of file l1394_eventhandle.h. |
|
Destructor.
Definition at line 24 of file l1394_eventhandle.cpp. |
|
This method handles the BUSRESET event.
Note that this event is only called by a Card object.
Reimplemented in SimpleEventHandle. Definition at line 120 of file l1394_eventhandle.h. |
|
this method handles the NODE_DESTROY event.
This event is called, if the destructor of a Node is called.
Reimplemented in SimpleEventHandle. Definition at line 130 of file l1394_eventhandle.h. |
|
This method handles the NODE_DISABLED event.
This event is called, if a FireWire node is disconnected from bus and the L1394 node object is inserted in the inactive_node_list.
Reimplemented in SimpleEventHandle. Definition at line 141 of file l1394_eventhandle.h. |
|
This method handles the NODE_ENABLED event.
This event is called, if the Node object is removed from the inactive_node_list and insert in the active_node_list again.
Reimplemented in SimpleEventHandle. Definition at line 152 of file l1394_eventhandle.h. |