summaryrefslogtreecommitdiffstats
path: root/protocol.h
blob: aee6683d6c89a8d3355587915cc0d4f0dfa706fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef PROTOCOL_H
#define PROTOCOL_H

#include <QObject>
#include <QStringList>

class Protocol : public QObject
{
Q_OBJECT

public:
    Protocol(QObject *parent = 0);
    virtual ~Protocol();

    void write(const QByteArray &);
    QString sendToClient(const QStringList &);

signals:
    void commandReceived(const QStringList &);

private:
    void reset();
    enum State { Start, Field };
    State mState;
    QStringList mFields;
    QString mField;
};

#endif // PROTOCOL_H