#ifndef USEVENTRECEIVER_H #define USEVENTRECEIVER_H #include #include "model/ultrasoundModule/type/CommandRequest.h" #include "model/ultrasoundModule/type/CommandResponse.h" #include "model/ultrasoundModule/type/ECommandResult.h" /*************************************************************************************************/ //Helper macros #define US_EVENT_RECEIVER(ACCESS) \ ACCESS: \ UsEventReceiver* _eventReceiver; \ public: \ UsEventReceiver* getEventReceiver() { return _eventReceiver; } \ #define US_EVENT_RECEIVER_INSTANTIATE \ _eventReceiver = new UsEventReceiver(metaObject()->className()) /*************************************************************************************************/ /** * @brief The class is responsible for receiving commands * @details This class with help of \see UsEventSender form the communication channel for commands * between all \see US_MODULE s * @author Hessamoddin Hediyehloo(H-4nd-H) * @date 2019/8/5(1398/5/14) */ /*************************************************************************************************/ class UsEventReceiver : public QObject { Q_OBJECT private: QString _ownerName; // In contradiction to the composition rule // this add a level of safety to app without calling // actual functions of parent public: explicit UsEventReceiver (QString _ownerName); void sendResponse(const CommandRequest &request, ECommandResult::eCommandResult result); void sendResponse(const CommandRequest &request, ECommandResult::eCommandResult result, QList args); signals: void commandResponse(const CommandResponse &reponse); void commandRequest(const CommandRequest &request); public slots: void newCommandRequest(const CommandRequest &request); }; #endif // USEVENTRECEIVER_H