File indexing completed on 2024-05-19 09:39:09
0001 /*************************************************************************** 0002 * Copyright (C) 2005 by David Saxton * 0003 * david@bluehaze.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #ifndef SERIALPORTCOMPONENT_H 0012 #define SERIALPORTCOMPONENT_H 0013 0014 #include "component.h" 0015 #include "logic.h" 0016 0017 class SerialPort; 0018 0019 /** 0020 @author David Saxton 0021 */ 0022 class SerialPortComponent : public CallbackClass, public Component 0023 { 0024 public: 0025 SerialPortComponent(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); 0026 ~SerialPortComponent() override; 0027 0028 static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); 0029 static LibraryItem *libraryItem(); 0030 0031 void stepNonLogic() override; 0032 bool doesStepNonLogic() const override 0033 { 0034 return true; 0035 } 0036 0037 protected: 0038 void initPort(const QString &port, qint32 baudRate); 0039 void dataChanged() override; 0040 void drawShape(QPainter &p) override; 0041 public: // internal interfaces 0042 void tdCallback(bool isHigh); 0043 void dtrCallback(bool isHigh); 0044 void dsrCallback(bool isHigh); 0045 void rtsCallback(bool isHigh); 0046 protected: 0047 LogicIn *m_pTD; 0048 LogicIn *m_pDTR; 0049 // LogicIn * m_pDSR; 0050 // LogicIn * m_pRTS; 0051 0052 LogicOut *m_pCD; 0053 // LogicOut * m_pRD; 0054 LogicOut *m_pCTS; 0055 LogicOut *m_pRI; 0056 0057 SerialPort *m_pSerialPort; 0058 }; 0059 0060 #endif