1 /* 2 ################################################################################ 3 # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # 4 # Read the zproject/README.md for information about making permanent changes. # 5 ################################################################################ 6 */ 7 8 #ifndef QML_ZYRE_EVENT_H 9 #define QML_ZYRE_EVENT_H 10 11 #include <QtQml> 12 13 #include <zyre.h> 14 #include "qml_zyre_plugin.h" 15 16 17 class QmlZyreEvent : public QObject 18 { 19 Q_OBJECT 20 Q_PROPERTY(bool isNULL READ isNULL) 21 22 public: 23 zyre_event_t *self; 24 QmlZyreEvent()25 QmlZyreEvent() { self = NULL; } isNULL()26 bool isNULL() { return self == NULL; } 27 28 static QObject* qmlAttachedProperties(QObject* object); // defined in QmlZyreEvent.cpp 29 30 public slots: 31 // Returns event type, as printable uppercase string. Choices are: 32 // "ENTER", "EXIT", "JOIN", "LEAVE", "EVASIVE", "WHISPER" and "SHOUT" 33 // and for the local node: "STOP" 34 const QString type (); 35 36 // Return the sending peer's uuid as a string 37 const QString peerUuid (); 38 39 // Return the sending peer's public name as a string 40 const QString peerName (); 41 42 // Return the sending peer's ipaddress as a string 43 const QString peerAddr (); 44 45 // Returns the event headers, or NULL if there are none 46 zhash_t *headers (); 47 48 // Returns value of a header from the message headers 49 // obtained by ENTER. Return NULL if no value was found. 50 const QString header (const QString &name); 51 52 // Returns the group name that a SHOUT event was sent to 53 const QString group (); 54 55 // Returns the incoming message payload; the caller can modify the 56 // message but does not own it and should not destroy it. 57 zmsg_t *msg (); 58 59 // Returns the incoming message payload, and pass ownership to the 60 // caller. The caller must destroy the message when finished with it. 61 // After called on the given event, further calls will return NULL. 62 zmsg_t *getMsg (); 63 64 // Print event to zsys log 65 void print (); 66 }; 67 68 class QmlZyreEventAttached : public QObject 69 { 70 Q_OBJECT 71 QObject* m_attached; 72 73 public: QmlZyreEventAttached(QObject * attached)74 QmlZyreEventAttached (QObject* attached) { 75 Q_UNUSED (attached); 76 }; 77 78 public slots: 79 // Self test of this class. 80 void test (bool verbose); 81 82 // Constructor: receive an event from the zyre node, wraps zyre_recv. 83 // The event may be a control message (ENTER, EXIT, JOIN, LEAVE) or 84 // data (WHISPER, SHOUT). 85 QmlZyreEvent *construct (QmlZyre *node); 86 87 // Destructor; destroys an event instance 88 void destruct (QmlZyreEvent *qmlSelf); 89 }; 90 91 92 QML_DECLARE_TYPEINFO(QmlZyreEvent, QML_HAS_ATTACHED_PROPERTIES) 93 94 #endif 95 /* 96 ################################################################################ 97 # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # 98 # Read the zproject/README.md for information about making permanent changes. # 99 ################################################################################ 100 */ 101