📄 messagedispatcher.cpp
字号:
/*************************************************************************** messagedispatcher.cpp - 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. * * * ***************************************************************************/#include <kdebug.h>#include "messagedispatcher.h"#include "phoneconnection.h"#include "phonecontrol.h"MessageDispatcher::MessageDispatcher(PhoneConnection* pC){ phoneConnection = pC; connect(pC, SIGNAL(responseReady(QString)), this, SLOT(receiveResponse(QString)));}MessageDispatcher::~MessageDispatcher(){}void MessageDispatcher::registerControl(PhoneControl* pC, QRegExp rE) { messageTypes.append(new MessageType(pC, rE));}/** called by the PhoneConnection when a complete response line is received from the mobile phone. */void MessageDispatcher::receiveResponse(QString response){ //kdDebug() << "MessageDispatcher::receiveResponse(" << response << ")\n"; QListIterator<MessageType> it(messageTypes); // iterate over all registeres message types, // if a match is found, deliver the message to // the phone control that registered it. for ( ; it.current(); ++it) { if (it.current()->matchMessage.find(response, 0) != -1) { it.current()->phoneControl->deliverMessage(response); } } }/** called by the PhoneControl object to send a command to the mobile phone */void MessageDispatcher::sendCommand(QString command){ phoneConnection->sendCommand(command+QChar('\r'));}/** 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 MessageDispatcher::sendPDU(QString pdu){ phoneConnection->sendCommand(pdu+QChar(0x1a));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -