messagedispatcher.cpp

来自「KDE下的西门子手机管理程序」· C++ 代码 · 共 62 行

CPP
62
字号
/***************************************************************************                          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 + =
减小字号Ctrl + -
显示快捷键?