-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodemdriver.h
45 lines (36 loc) · 902 Bytes
/
modemdriver.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef MODEMDRIVER_H
#define MODEMDRIVER_H
#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDebug>
#include "abstractmodemdriver.h"
class ModemDriver : public QObject, public AbstractModemDriver
{
Q_OBJECT
enum State
{
INIT,SENDSMS,GETCONTACT,READY,SAVECONTACT
};
public:
ModemDriver();
~ModemDriver();
bool sendSms(QByteArray message="", QByteArray number="");
bool onReceiveSms();
bool onReceiveResult();
void getContacts();
bool saveContact(QByteArray name="", QByteArray number="");
bool init();
private slots:
void onData();
void onPortError(QSerialPort::SerialPortError error);
private:
QSerialPort *port;
ModemDriver::State state;
QByteArray tmpData, tmpData2;
int id;
QByteArray data;
signals:
contactsReceived(QList<Contact> &contacts);
};
#endif // MODEMDRIVER_H