4
Copyright (c) 2005 by Justin Huff <jjhuff@mspin.net>
6
*************************************************************************
8
* This program is free software; you can redistribute it and/or modify *
9
* it under the terms of the GNU General Public License as published by *
10
* the Free Software Foundation; either version 2 of the License, or *
11
* (at your option) any later version. *
13
*************************************************************************
16
#ifndef GSMLIB_H_039562406
17
#define GSMLIB_H_039562406
19
#include <config-kopete.h>
21
#include <Q3GridLayout>
22
#include <QCustomEvent>
27
#include <gsmlib/gsm_unix_serial.h>
28
#include <gsmlib/gsm_sms.h>
29
#include <gsmlib/gsm_me_ta.h>
30
#include <gsmlib/gsm_util.h>
31
#include <gsmlib/gsm_event.h>
33
#include "smsservice.h"
34
#include "kopetemessage.h"
39
#include <QStringList>
45
class GSMLib : public SMSService
49
GSMLib(Kopete::Account* account);
52
void send(const Kopete::Message& msg);
53
void setWidgetContainer(QWidget* parent, QGridLayout* container);
56
const QString& description();
59
void savePreferences();
60
virtual void connect();
61
virtual void disconnect();
64
// void messageSent(const Kopete::Message &);
66
virtual void customEvent(QCustomEvent* e);
68
QWidget* configureWidget(QWidget* parent);
72
GSMLibPrefsUI* prefWidget;
77
QString m_description;
79
GSMLibThread* m_thread;
84
/// Custom event for async-events
85
class GSMLibEvent : public QCustomEvent
88
enum SubType { CONNECTED, DISCONNECTED, NEW_MESSAGE, MSG_SENT, MSG_NOT_SENT };
90
GSMLibEvent(SubType t);
93
void setSubType(SubType t);
100
Kopete::Message Message;
105
/// Thread to deal with GsmLib's blocking
106
class GSMLibThread : public QThread, gsmlib::GsmEvent
109
GSMLibThread(QString dev, GSMLib* parent);
110
virtual ~GSMLibThread();
114
void send(const Kopete::Message& msg);
117
void pollForMessages();
118
void sendMessageQueue();
119
void sendMessage(const Kopete::Message& msg);
120
void SMSReception(gsmlib::SMSMessageRef newMessage, SMSMessageType messageType);
121
void SMSReceptionIndication(std::string storeName, unsigned int index, SMSMessageType messageType);
126
gsmlib::MeTa* m_MeTa;
130
struct IncomingMessage
134
gsmlib::SMSMessageRef Message;
135
GsmEvent::SMSMessageType Type;
137
IncomingMessage() : Index(-1)
141
typedef QList<IncomingMessage> MessageList;
142
MessageList m_newMessages;
144
typedef QList<Kopete::Message> KopeteMessageList;
145
KopeteMessageList m_outMessages;
146
QMutex m_outMessagesMutex;
150
#endif //GSMLIB_H_039562406