25 #include <QtSerialPort/QSerialPort>
26 #include <QtSerialPort/QSerialPortInfo>
31 class ATCommandResponse;
34 class RemoteATCommandResponse;
39 class TxStatusResponse;
49 using namespace QtXBee::Wpan;
50 using namespace QtXBee::ZigBee;
52 class XBee :
public QObject
62 explicit XBee (QObject *parent = 0);
63 XBee (
const QString & serialPort, QObject * parent = 0);
66 bool applyDefaultSerialPortConfig ();
68 bool sendCommandAsync (
const QByteArray & command);
73 QByteArray sendCommandSync (
const QByteArray & command);
75 void sendATCommandAsync (
ATCommand *command);
76 void sendATCommandAsync (
const QByteArray & data);
78 bool setMode (
const Mode mode);
81 bool setSerialPort (
const QString & serialPort);
82 bool setSerialPort (
const QString &serialPort,
83 const QSerialPort::BaudRate baudRate,
84 const QSerialPort::DataBits dataBits,
85 const QSerialPort::Parity parity,
86 const QSerialPort::StopBits stopBits,
87 const QSerialPort::FlowControl flowControl);
88 bool setSerialPortConfiguration (
const QSerialPort::BaudRate baudRate,
89 const QSerialPort::DataBits dataBits,
90 const QSerialPort::Parity parity,
91 const QSerialPort::StopBits stopBits,
92 const QSerialPort::FlowControl flowControl);
95 bool setDH (
const quint32 dh);
96 bool setDL (
const quint32 dl);
97 bool setMY (
const quint16 my);
98 bool setMP (
const quint16 mp);
99 bool setNC (
const quint32 nc);
100 bool setSH (
const quint32 sh);
101 bool setSL (
const quint32 sl);
102 bool setNI (
const QString & ni);
103 bool setSE (
const quint8 se);
104 bool setDE (
const quint8 de);
105 bool setCI (
const quint8 ci);
106 bool setTO (
const quint8 to);
107 bool setNP (
const quint8 np);
108 bool setDD (
const quint16 dd);
109 bool setCR (
const quint8 cr);
111 quint32 DH ()
const {
return m_dh;}
112 quint32 DL ()
const {
return m_dl;}
113 quint16 MY ()
const {
return m_my;}
114 quint16 MP ()
const {
return m_mp;}
115 quint32 NC ()
const {
return m_nc;}
116 quint32 SH ()
const {
return m_sh;}
117 quint32 SL ()
const {
return m_sl;}
118 QString NI ()
const {
return m_ni;}
119 quint8 SE ()
const {
return m_se;}
120 quint8 DE ()
const {
return m_de;}
121 quint8 CI ()
const {
return m_ci;}
122 quint8 TO ()
const {
return m_to;}
123 quint8 NO ()
const {
return m_np;}
124 quint16 DD ()
const {
return m_dd;}
125 quint8 CR ()
const {
return m_cr;}
128 void rawDataReceived (
const QByteArray & data);
140 void DHChanged (
const quint32 dh);
141 void DLChanged (
const quint32 dl);
142 void MYChanged (
const quint16 my);
143 void MPChanged (
const quint16 mp);
144 void NCChanged (
const quint32 nc);
145 void SHChanged (
const quint32 sh);
146 void SLChanged (
const quint32 sl);
147 void NIChanged (
const QString & ni);
148 void SEChanged (
const quint8 se);
149 void DEChanged (
const quint8 de);
150 void CIChanged (
const quint8 ci);
151 void TOChanged (
const quint8 to);
152 void NPChanged (
const quint8 np);
153 void DDChanged (
const quint16 dd);
154 void CRChanged (
const quint8 cr);
157 void loadAddressingProperties();
161 void displayATCommandResponse (ATCommandResponse *digiMeshPacket);
162 void displayModemStatus (ModemStatus *digiMeshPacket);
167 void displayRemoteCommandResponse (RemoteATCommandResponse *digiMeshPacket);
173 XBeeResponse * processPacket (QByteArray packet,
const bool async);
174 void processATCommandRespone (ATCommandResponse *rep);
175 bool startupCheck ();
176 QByteArray synchronousCmd (QByteArray cmd);
177 bool enterInCommandMode ();
178 bool exitCommandMode ();
181 QSerialPort * m_serial;
185 quint16 m_frameIdCounter;