00001 /*************************************************************************** 00002 l1394.h - description 00003 ------------------- 00004 begin : Tue Aug 22 2000 00005 copyright : (C) 2000-2004 by Michael Repplinger 00006 email : repplix@author_email=repplix@studcs.uni-sb.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef L1394Event_H 00019 #define L1394Event_H 00020 00021 #include "l1394_eventhandle.h" 00022 #include "l1394_message.h" 00023 #include "l1394_resource.h" 00024 00025 namespace L1394{ 00026 /*! \class Event 00027 * \ingroup L1394_Event 00028 * \brief This class reports changes on the FireWire bus. 00029 * 00030 * Every Node object has an Event object, where you can add some EventHandle to 00031 * get information about incoming events on the FireWire bus. In the actual version 00032 * of this library 5 events are defined. 00033 * 00034 * Event BUSRESET: <BR> 00035 * This event calls the method busreset() on the connected EventHandle objects. 00036 * This event happens only to Card objects. 00037 * 00038 * Event NODE_DISABLED:<BR> 00039 * This event calls the method nodeDisabled() on the connected EventHandle objects. 00040 * This event occurs, if a Node Object is disconnected from FireWire Bus and stored 00041 * in the inactive_node_list of the global NodeContainer object. Connected EventHandle 00042 * objects 00043 * 00044 * Event NODE_ENABLED: <BR> 00045 * This event call the method nodeEnabled() on the connected EventHandle objects. 00046 * This event occur, if a Node Object is reconnected from FireWire Bus and removed 00047 * from the inactive_node_list of the NodeContainer object.Node objects, that connect 00048 * to this event get also the NODE_DISABLED event. 00049 * 00050 * Event NODE_DESTROY:<BR> 00051 * This event call the method nodeDestroy() on the connected EventHandle objects. 00052 * This event happens if the destructor of a Node object is called, what (should ;) ) 00053 * only happen when a FireWire node is disconnected from the bus. 00054 * 00055 * See the tutorial for examples. 00056 * 00057 *@author Michael Repplinger 00058 */ 00059 class Node; 00060 00061 class Event{ 00062 00063 public: 00064 /*! \fn Event(const Node *, const Card*) 00065 * \brief Constructor 00066 */ 00067 Event(const L1394::Node *, const L1394::Card* = 0); 00068 00069 /*! \fn ~Event() 00070 * \brief Destructor 00071 */ 00072 ~Event(); 00073 /*! \name Functions to add/remove EventHandles 00074 * These functions add or remove EventHandles from this object. 00075 */ 00076 //@{ 00077 /*! \fn addEventHandle(EventHandle* event_handle,const Event ) 00078 * \brief This method adds an EventHandle to a specific event. 00079 * 00080 * See description of class Event for more information. 00081 * 00082 * \param event_handle : pointer to the EventHandle object 00083 * \param e : event that should be handled 00084 */ 00085 void addEventHandle(EventHandle* event_handle, const EVENT event); 00086 00087 /*! \fn addEventHandle(EventHandle* handle) 00088 * \brief This method adds an EventHandle to all events of a node. 00089 * 00090 * \param event_handle : pointer to the EventHandle object 00091 */ 00092 void addEventHandle(EventHandle* event_handle); 00093 00094 /*! \fn removeEventHandle(EventHandle* handle,const Event ) 00095 * \brief With this method you can remove an EventHandle from a specific event. 00096 * 00097 * All EventHandle must removed, if the EventHandle is deleted. 00098 * (So you can call this method in the destructor of your EventHandle.) 00099 * \param handle : pointer to the EventHandle object 00100 * \param e : event that should be handled 00101 */ 00102 void removeEventHandle(EventHandle* event_handle, const EVENT event); 00103 00104 /*! \fn removeEventHandle(EventHandle* handle) 00105 * \brief This method removes an EventHandle from all events. 00106 * 00107 * All EventHandle must removed, if the EventHandle is deleted. 00108 * (So you can call this method in the destructor of your EventHandle.) 00109 * \param event_handle : pointer to the EventHandle object 00110 */ 00111 void removeEventHandle(EventHandle* event_handle); 00112 //@} 00113 00114 //@{ 00115 /*! \fn call(const Event) 00116 * \brief This method emit an event. 00117 * \param int Integer value signal that specify the signal 00118 * \param Node* pointer to the object that call this function 00119 */ 00120 void call(const EVENT event); 00121 //@} 00122 private: 00123 list <EventHandle*> busreset_list; //list of EventHandle object connected to BUSRESET event 00124 list <EventHandle*> node_destroy_list; //list of EventHandle object connected to NodeDestroy event 00125 list <EventHandle*> node_disabled_list; 00126 const L1394::Node* parent; //pointer to parent object that call the events 00127 const L1394::Card* card; 00128 internal::Message* message; 00129 }; 00130 00131 } 00132 #endif