Neal Wilson 11 年之前
父節點
當前提交
6f14970c59
共有 1 個文件被更改,包括 34 次插入0 次删除
  1. 34
    0
      src/scales.w

+ 34
- 0
src/scales.w 查看文件

@@ -56,3 +56,37 @@ void DragLabel::mousePressEvent(QMouseEvent *event)
56 56
 	}
57 57
 }
58 58
 
59
+@ An object is also required to communicate with a scale. This is responsible
60
+for setting up a connection over a serial port, sending commands out to the
61
+scale, buffering and interpreting the response, and signaling new measurements.
62
+
63
+@(scale.h@>=
64
+#ifndef TypicaScaleInclude
65
+#define TypicaScaleInclude
66
+
67
+#include "3rdparty/qextserialport/src/qextserialport.h"
68
+
69
+class SerialScale : public QObject
70
+{
71
+	Q_OBJECT
72
+	public:
73
+		SerialScale();
74
+		~SerialScale();
75
+	public slots:
76
+		void setPort(const QString &port);
77
+		void setBaudRate(BaudRateType baud);
78
+		void setDataBits(DataBitsType data);
79
+		void setParity(ParityType parity);
80
+		void setStopBits(StopBitsType stop);
81
+		void setFlowControl(FlowType flow);
82
+		void open();
83
+		void tare();
84
+		void weigh();
85
+	private slots:
86
+		void dataAvailable();
87
+	private:
88
+		QextSerialPort *port;
89
+		QByteArray responseBuffer;
90
+};
91
+
92
+#endif

Loading…
取消
儲存