📄 messagedispatcher.h
字号:
/*************************************************************************** messagedispatcher.h - description ------------------- begin : Fri Jan 19 2001 copyright : (C) 2001 by Matthias Welwarsky email : matze@stud.fbi.fh-darmstadt.de ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#ifndef MESSAGEDISPATCHER_H#define MESSAGEDISPATCHER_H#include <qobject.h>#include <qlist.h>#include <qregexp.h>class PhoneConnection;class PhoneControl;/** the message dispatcher diverts messages from the mobile phone to the phone controls that have registered for a special type of message. * Registration for messages is done by supplying a QRegex object matching the appropriate message prefix * @author Matthias Welwarsky */class MessageDispatcher : public QObject { Q_OBJECTpublic: MessageDispatcher(PhoneConnection*); ~MessageDispatcher(); /** registers a phone control at the message dispatcher. * You must supply a pointer to the phone control object * and a QRegex object that matches the message format * you want to receive from the phone. */ void registerControl(PhoneControl*, QRegExp);private: // Private classes class MessageType { public: MessageType(PhoneControl* pC, QRegExp rE) { phoneControl = pC; matchMessage = rE; } PhoneControl* phoneControl; QRegExp matchMessage; };public slots: // Public slots /** called by the PhoneConnection when a complete response line is received from the mobile phone. */ void receiveResponse(QString); /** called by the PhoneControl object to send a command to the mobile phone */ void sendCommand(QString); /** transmit a PDU to the mobile phone. the only difference to sendCommand is the line termination, * which is "CR" for normal commands, and "ESC" for PDUs */ void sendPDU(QString);private: // Private attributes /** holds a pointer to the associated phone connection. */ PhoneConnection* phoneConnection; /** The list of phone controls registeres at this message dispatcher */ QList<MessageType> messageTypes;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -