dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
notifyplugin.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 #ifndef SOUNDNOTIFYPLUGIN_H
30 #define SOUNDNOTIFYPLUGIN_H
31 
36 #include "uavobjects/uavobject.h"
37 #include "notificationitem.h"
38 
39 #include <QSettings>
40 #include <QMediaPlayer>
41 #include <QMediaPlaylist>
42 
44 
45 typedef struct
46 {
47  QMediaPlayer *mo;
49  bool firstPlay;
51 
53 {
54  Q_OBJECT
55  Q_PLUGIN_METADATA(IID "org.dronin.plugins.NotifyPlugin")
56 public:
59 
60  void extensionsInitialized();
61  bool initialize(const QStringList &arguments, QString *errorString);
62  void readConfig(QSettings *qSettings, Core::UAVConfigInfo *configInfo);
63  void saveConfig(QSettings *qSettings, Core::UAVConfigInfo *configInfo);
64  void shutdown();
65 
66  QList<NotificationItem *> getListNotifications() { return _notificationList; }
67  NotificationItem *getCurrentNotification() { return &currentNotification; }
68 
69  bool getEnableSound() const { return enableSound; }
70  void setEnableSound(bool value) { enableSound = value; }
71 
72 public slots:
74 
75 private:
76  Q_DISABLE_COPY(SoundNotifyPlugin)
77 
78  bool playNotification(NotificationItem *notification);
79  void checkNotificationRule(NotificationItem *notification, UAVObject *object);
80 
81 private slots:
82 
83  void onTelemetryManagerAdded(QObject *obj);
84  void onAutopilotDisconnect();
85  void connectNotifications();
86  void resetNotification(void);
87  void on_arrived_Notification(UAVObject *object);
88  void on_timerRepeated_Notification(void);
89  void on_expiredTimer_Notification(void);
90  void stateChanged(QMediaPlayer::State newstate);
91 
92 private:
93  bool enableSound;
94 
95  QList<UAVDataObject *> lstNotifiedUAVObjects;
96  QList<NotificationItem *> _notificationList;
97  QList<NotificationItem *> _pendingNotifications;
98  QList<NotificationItem *> _toRemoveNotifications;
99 
100  NotificationItem currentNotification;
101  NotificationItem *_nowPlayingNotification;
102 
103  PhononObject phonon;
105  TelemetryManager *telMngr;
106  QMediaPlaylist *playlist;
107 };
108 
109 #endif // SOUNDNOTIFYPLUGIN_H
QMediaPlayer * mo
Definition: notifyplugin.h:47
struct PhononObject * pPhononObject
NotificationItem * notify
Definition: notifyplugin.h:48
void updateNotificationList(QList< NotificationItem * > list)
The Config Info is a helper-class to handle version changes in GCS configuration files.
Definition: uavconfiginfo.h:53