├── gui
├── sounds
│ ├── ring3.wav
│ ├── ringin.wav
│ ├── incomingcall.wav
│ ├── outgoingcall.wav
│ └── outgoingcallbusy.wav
├── images
│ ├── call-hold.png
│ ├── call-start.png
│ ├── call-stop.png
│ ├── camera-off.png
│ ├── camera-on.png
│ ├── call-hold-22.png
│ ├── call-start-22.png
│ ├── call-stop-22.png
│ ├── video-icon-on.png
│ ├── video-icon-big.png
│ ├── video-icon-off.png
│ ├── audio-volume-high.png
│ ├── audio-volume-muted.png
│ ├── audio-volume-muted-22.png
│ ├── audio-volume-medium-22.png
│ ├── self_undeafened.svg
│ ├── deafened_self.svg
│ └── talking_off.svg
├── EasyTransport_images.qrc
├── EasyTransportNotify.cpp
├── NEMainpage.h
├── paintwidget.h
├── NEMainpage.cpp
├── EasyTransportNotify.h
├── NEMainpage.ui
└── paintwidget.cpp
├── cptest
├── README.md
├── EasyTransport.pro
├── EasyTransportPlugin.h
├── interface
└── rsEasyTransport.h
├── services
├── p3EasyTransport.h
├── rsEasyTransportItems.h
├── rsEasyTransportItems.cc
└── p3EasyTransport.cc
└── EasyTransportPlugin.cpp
/gui/sounds/ring3.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/sounds/ring3.wav
--------------------------------------------------------------------------------
/gui/sounds/ringin.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/sounds/ringin.wav
--------------------------------------------------------------------------------
/gui/images/call-hold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/call-hold.png
--------------------------------------------------------------------------------
/gui/images/call-start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/call-start.png
--------------------------------------------------------------------------------
/gui/images/call-stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/call-stop.png
--------------------------------------------------------------------------------
/gui/images/camera-off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/camera-off.png
--------------------------------------------------------------------------------
/gui/images/camera-on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/camera-on.png
--------------------------------------------------------------------------------
/gui/images/call-hold-22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/call-hold-22.png
--------------------------------------------------------------------------------
/gui/images/call-start-22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/call-start-22.png
--------------------------------------------------------------------------------
/gui/images/call-stop-22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/call-stop-22.png
--------------------------------------------------------------------------------
/gui/images/video-icon-on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/video-icon-on.png
--------------------------------------------------------------------------------
/gui/sounds/incomingcall.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/sounds/incomingcall.wav
--------------------------------------------------------------------------------
/gui/sounds/outgoingcall.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/sounds/outgoingcall.wav
--------------------------------------------------------------------------------
/gui/images/video-icon-big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/video-icon-big.png
--------------------------------------------------------------------------------
/gui/images/video-icon-off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/video-icon-off.png
--------------------------------------------------------------------------------
/gui/sounds/outgoingcallbusy.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/sounds/outgoingcallbusy.wav
--------------------------------------------------------------------------------
/gui/images/audio-volume-high.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/audio-volume-high.png
--------------------------------------------------------------------------------
/gui/images/audio-volume-muted.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/audio-volume-muted.png
--------------------------------------------------------------------------------
/gui/images/audio-volume-muted-22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/audio-volume-muted-22.png
--------------------------------------------------------------------------------
/gui/images/audio-volume-medium-22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chozabu/RSEasyTransport/master/gui/images/audio-volume-medium-22.png
--------------------------------------------------------------------------------
/cptest:
--------------------------------------------------------------------------------
1 | kdesudo -u retrotester cp lib*.so* /home/retrotester/.retroshare/extensions6/
2 | kdesudo -u retrotester /home/chozabu/git/RetroShare/retroshare-gui/src/RetroShare
3 |
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | RS .6 EasyTransport Plugin
2 | ==================
3 |
4 | This plugin should provide a simple interface to other plugins, allowing them to talk across a network easily
5 |
6 | ##Example
7 |
8 | ###include easy transport
9 |
10 | #include "interface/rsEasyTransport.h"
11 |
12 |
13 | ###connect
14 |
15 | connect(rsEasyTransport->mNotify, SIGNAL(NeMsgArrived(RsPeerId,QString)), this , SLOT(NeMsgArrived(RsPeerId,QString)));
16 |
17 | ###send message
18 |
19 | rsEasyTransport->msg_all(ui->lineEdit->text().toStdString());
20 |
21 |
22 |
23 | This is based on the ExamplePlugin, and in turn VOIP plugin.
24 |
25 |
--------------------------------------------------------------------------------
/gui/EasyTransport_images.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | images/audio-volume-high.png
4 | images/muted_self.svg
5 | images/audio-volume-muted.png
6 | images/talking_on.svg
7 | images/talking_off.svg
8 | images/call-start.png
9 | images/call-stop.png
10 | images/call-hold.png
11 | images/camera-on.png
12 | images/camera-off.png
13 | images/video-icon-big.png
14 | images/video-icon-on.png
15 | images/video-icon-off.png
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/gui/EasyTransportNotify.cpp:
--------------------------------------------------------------------------------
1 | #include "EasyTransportNotify.h"
2 |
3 | EasyTransportNotify::EasyTransportNotify(QObject *parent) : QObject(parent)
4 | {
5 |
6 | }
7 |
8 | void EasyTransportNotify::notifyReceivedPaint(const RsPeerId &peer_id, int x, int y)
9 | {
10 | std::cout << "pNotify Recvd paint from: " << peer_id;
11 | std::cout << " at " << x << " , " << y;
12 | std::cout << std::endl;
13 | emit NePaintArrived(peer_id, x, y);
14 | }
15 |
16 |
17 | void EasyTransportNotify::notifyReceivedMsg(const RsPeerId& peer_id, QString str)
18 | {
19 | std::cout << "pNotify Recvd Packet from: " << peer_id;
20 | std::cout << " saying " << str.toStdString();
21 | std::cout << std::endl;
22 | emit NeMsgArrived(peer_id, str) ;
23 | }
24 |
--------------------------------------------------------------------------------
/gui/NEMainpage.h:
--------------------------------------------------------------------------------
1 | /* This is the main page displayed by the plugin */
2 | #ifndef NEMAINPAGE_H
3 | #define NEMAINPAGE_H
4 |
5 | #include
6 | #include
7 | #include
8 | #include "gui/EasyTransportNotify.h"
9 |
10 |
11 |
12 | #include
13 |
14 | namespace Ui {
15 | class NEMainpage;
16 | }
17 |
18 | class NEMainpage : public MainPage
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | explicit NEMainpage(QWidget *parent, EasyTransportNotify *notify);
24 | ~NEMainpage();
25 |
26 | private slots:
27 | void mmEvent(int x, int y);
28 | void on_pingAllButton_clicked();
29 | void NeMsgArrived(const RsPeerId &peer_id, QString str);
30 |
31 | void on_broadcastButton_clicked();
32 |
33 | void NePaintArrived(const RsPeerId &peer_id, int x, int y);
34 | private:
35 | Ui::NEMainpage *ui;
36 | EasyTransportNotify *mNotify;
37 | };
38 |
39 | #endif // NEMAINPAGE_H
40 |
--------------------------------------------------------------------------------
/gui/paintwidget.h:
--------------------------------------------------------------------------------
1 | /* this is just a local widget that can be drawn on */
2 | #ifndef PAINTWIDGET_H
3 | #define PAINTWIDGET_H
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | class TopJCDialog;
11 |
12 | class PaintWidget : public QWidget
13 | {
14 | Q_OBJECT
15 | public:
16 | explicit PaintWidget(QWidget *parent = 0);
17 | void setImage(const QImage&);
18 | QImage getImage();
19 |
20 | void fillImage(QColor color);
21 | virtual void paintAt(int x, int y);
22 |
23 | QColor color;
24 | uint8_t penWidth;
25 | TopJCDialog* tjd;
26 |
27 | signals:
28 | void haveUpdate();
29 | void mmEvent(int x, int y);
30 |
31 |
32 | public slots:
33 |
34 | protected:
35 | virtual void mouseReleaseEvent(QMouseEvent * event);
36 | virtual void paintEvent(QPaintEvent *);
37 | virtual void mouseMoveEvent(QMouseEvent *);
38 |
39 | private:
40 | QImage image;
41 |
42 | };
43 |
44 | #endif // PAINTWIDGET_H
45 |
--------------------------------------------------------------------------------
/gui/NEMainpage.cpp:
--------------------------------------------------------------------------------
1 | #include "NEMainpage.h"
2 | #include "ui_NEMainpage.h"
3 | //#include "services/p3EasyTransport.h"
4 | #include "interface/rsEasyTransport.h"
5 |
6 |
7 | NEMainpage::NEMainpage(QWidget *parent, EasyTransportNotify *notify) :
8 | MainPage(parent),
9 | mNotify(notify),
10 | ui(new Ui::NEMainpage)
11 | {
12 | ui->setupUi(this);
13 |
14 | connect(mNotify, SIGNAL(NeMsgArrived(RsPeerId,QString)), this , SLOT(NeMsgArrived(RsPeerId,QString)));
15 | connect(mNotify, SIGNAL(NePaintArrived(RsPeerId,int,int)), this , SLOT(NePaintArrived(RsPeerId,int,int)));
16 | //ui->listWidget->addItem("str");
17 | connect(ui->paintWidget, SIGNAL(mmEvent(int,int)), this, SLOT(mmEvent(int,int)));
18 |
19 | }
20 |
21 | NEMainpage::~NEMainpage()
22 | {
23 | delete ui;
24 | }
25 |
26 | void NEMainpage::mmEvent(int x, int y)
27 | {
28 | rsEasyTransport->broadcast_paint(x,y);
29 | }
30 |
31 | void NEMainpage::on_pingAllButton_clicked()
32 | {
33 | rsEasyTransport->ping_all();
34 | NeMsgArrived(rsPeers->getOwnId(),"ping");
35 | }
36 |
37 |
38 | void NEMainpage::NeMsgArrived(const RsPeerId &peer_id, QString str)
39 | {
40 |
41 | std::cout << "GUI got Packet from: " << peer_id;
42 | std::cout << " saying " << str.toStdString();
43 | std::cout << std::endl;
44 |
45 | QString output = QString::fromStdString(rsPeers->getPeerName(peer_id));
46 | output+=": ";
47 | output+=str;
48 | ui->listWidget->addItem(output);
49 | }
50 | void NEMainpage::NePaintArrived(const RsPeerId &peer_id, int x, int y)
51 | {
52 |
53 | std::cout << "GUI got Paint from: " << peer_id;
54 | std::cout << std::endl;
55 |
56 | ui->paintWidget->paintAt(x,y);
57 | }
58 |
59 | void NEMainpage::on_broadcastButton_clicked()
60 | {
61 | rsEasyTransport->msg_all(ui->msgInput->text().toStdString());
62 | NeMsgArrived(rsPeers->getOwnId(),ui->msgInput->text());
63 | ui->msgInput->clear();
64 | }
65 |
--------------------------------------------------------------------------------
/EasyTransport.pro:
--------------------------------------------------------------------------------
1 | !include("../Common/retroshare_plugin.pri"): error("Could not include file ../Common/retroshare_plugin.pri")
2 |
3 | greaterThan(QT_MAJOR_VERSION, 4) {
4 | # Qt 5
5 | QT += widgets
6 | }
7 |
8 | exists($$[QMAKE_MKSPECS]/features/mobility.prf) {
9 | CONFIG += mobility
10 | } else {
11 | QT += multimedia
12 | }
13 | CONFIG += qt uic qrc resources
14 | MOBILITY = multimedia
15 |
16 | DEPENDPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src
17 | INCLUDEPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src
18 |
19 | #################################### Windows #####################################
20 |
21 | linux-* {
22 | INCLUDEPATH += /usr/include
23 | LIBS += $$system(pkg-config --libs opencv)
24 | }
25 |
26 | win32 {
27 | LIBS_DIR = $$PWD/../../../libs
28 | LIBS += -L"$$LIBS_DIR/lib/opencv"
29 |
30 | OPENCV_VERSION = 249
31 | LIBS += -lopencv_core$$OPENCV_VERSION -lopencv_highgui$$OPENCV_VERSION -lopencv_imgproc$$OPENCV_VERSION -llibjpeg -llibtiff -llibpng -llibjasper -lIlmImf -lole32 -loleaut32 -luuid -lavicap32 -lavifil32 -lvfw32 -lz
32 | }
33 |
34 | QMAKE_CXXFLAGS *= -Wall
35 |
36 | SOURCES = EasyTransportPlugin.cpp \
37 | services/p3EasyTransport.cc \
38 | services/rsEasyTransportItems.cc \
39 | gui/NEMainpage.cpp \
40 | gui/EasyTransportNotify.cpp \
41 | gui/paintwidget.cpp
42 |
43 | HEADERS = EasyTransportPlugin.h \
44 | services/p3EasyTransport.h \
45 | services/rsEasyTransportItems.h \
46 | interface/rsEasyTransport.h \
47 | gui/NEMainpage.h \
48 | gui/EasyTransportNotify.h \
49 | gui/paintwidget.h
50 |
51 | #FORMS = gui/AudioInputConfig.ui
52 |
53 | TARGET = EasyTransport
54 |
55 | RESOURCES = gui/EasyTransport_images.qrc
56 |
57 |
58 | LIBS += -lspeex -lspeexdsp
59 |
60 | FORMS += \
61 | gui/NEMainpage.ui
62 |
--------------------------------------------------------------------------------
/gui/EasyTransportNotify.h:
--------------------------------------------------------------------------------
1 | /****************************************************************
2 | * RetroShare is distributed under the following license:
3 | *
4 | * Copyright (C) 2015
5 | *
6 | * This program is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU General Public License
8 | * as published by the Free Software Foundation; either version 2
9 | * of the License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 | * Boston, MA 02110-1301, USA.
20 | ****************************************************************/
21 |
22 | // This class is a Qt object to get notification from the plugin's service threads,
23 | // and responsible to pass the info the the GUI part.
24 | //
25 | // Because the GUI part is async-ed with the service, it is crucial to use the
26 | // QObject connect system to communicate between the p3Service and the gui part (handled by Qt)
27 | //
28 | #ifndef NETEXAMPLENOTIFY_H
29 | #define NETEXAMPLENOTIFY_H
30 |
31 | #include
32 |
33 | #include
34 |
35 | class EasyTransportNotify : public QObject
36 | {
37 | Q_OBJECT
38 | public:
39 | explicit EasyTransportNotify(QObject *parent = 0);
40 | void notifyReceivedPaint(const RsPeerId &peer_id, int x, int y) ;
41 | void notifyReceivedMsg(const RsPeerId &peer_id, QString str) ;
42 |
43 | signals:
44 | void NeMsgArrived(const RsPeerId &peer_id, QString str) ; // emitted when the peer gets a msg
45 | void NePaintArrived(const RsPeerId &peer_id, int x, int y) ;
46 |
47 | public slots:
48 | };
49 |
50 | #endif // NETEXAMPLENOTIFY_H
51 |
--------------------------------------------------------------------------------
/gui/NEMainpage.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | NEMainpage
4 |
5 |
6 |
7 | 0
8 | 0
9 | 685
10 | 632
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 |
19 | 310
20 | 230
21 | 80
22 | 23
23 |
24 |
25 |
26 | Ping All
27 |
28 |
29 |
30 |
31 |
32 | 10
33 | 10
34 | 291
35 | 241
36 |
37 |
38 |
39 |
40 |
41 |
42 | 310
43 | 270
44 | 80
45 | 23
46 |
47 |
48 |
49 | Broadcast
50 |
51 |
52 |
53 |
54 |
55 | 10
56 | 270
57 | 291
58 | 23
59 |
60 |
61 |
62 |
63 |
64 |
65 | 19
66 | 319
67 | 571
68 | 271
69 |
70 |
71 |
72 |
73 |
74 |
75 | PaintWidget
76 | QWidget
77 | gui/paintwidget.h
78 | 1
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/gui/paintwidget.cpp:
--------------------------------------------------------------------------------
1 | #include "paintwidget.h"
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #include
8 | #include
9 | PaintWidget::PaintWidget(QWidget *parent) :
10 | QWidget(parent),image(600,300,QImage::Format_RGB32),color(Qt::black),penWidth(8)
11 | {
12 | image.fill(qRgb(255, 255, 255));
13 | }
14 |
15 | void PaintWidget::setImage(const QImage &img){
16 | image=img.copy();
17 | update();
18 | }
19 |
20 | QImage PaintWidget::getImage(){
21 | return image;
22 | }
23 |
24 | void PaintWidget::fillImage(QColor color){
25 | image.fill(qRgb(255, 255, 255));
26 | update();
27 | }
28 |
29 | void PaintWidget::mouseMoveEvent(QMouseEvent *event)
30 | {
31 | QPainter p(&image);
32 | p.setPen(color);
33 | p.setBrush(color);
34 | QPoint pos = event->pos();
35 | if(penWidth==1){
36 | p.drawPoint(pos);
37 | }else{
38 | p.drawEllipse(pos,penWidth/2,penWidth/2);
39 | }
40 | //check if u want to clear Jenster--
41 | // if (event->button() == Qt::RightButton) image.fill(qRgb(255, 255, 255));
42 |
43 | // trigger repaint of widget
44 | update();
45 | emit mmEvent(pos.x(), pos.y());
46 | //tjd->paintMouseMove(event);
47 | }
48 |
49 |
50 | void PaintWidget::paintAt(int x, int y)
51 | {
52 | QPainter p(&image);
53 | p.setPen(color);
54 | p.setBrush(color);
55 | if(penWidth==1){
56 | p.drawPoint(x,y);
57 | }else{
58 | p.drawEllipse(x,y,penWidth/2,penWidth/2);
59 | }
60 | // trigger repaint of widget
61 | update();
62 | }
63 |
64 | qint64 getImgSize(QImage image){
65 | QByteArray ba;
66 | QBuffer buffer(&ba);
67 | buffer.open(QIODevice::WriteOnly);
68 | image.save(&buffer, "PNG");
69 | return buffer.buffer().toBase64().size();
70 | }
71 |
72 | void PaintWidget::mouseReleaseEvent(QMouseEvent *event){
73 | std::cout<<"PaintWidgte::mouseReleseEvent()"<button() == Qt::RightButton) { image.fill(qRgb(255, 255, 255));update(); }
76 | //check to see if we want to send to clipboard
77 | if (event->button() == Qt::MiddleButton) {
78 | QImage img = image.scaledToWidth(image.width()*0.5);
79 | while(getImgSize(img)> 5500){
80 | img = img.scaledToWidth(img.width()*0.8);
81 | }
82 | QApplication::clipboard()->setImage(img);
83 | }
84 |
85 |
86 |
87 | emit haveUpdate();
88 | }
89 |
90 | void PaintWidget::paintEvent(QPaintEvent *event)
91 | {
92 | QPainter p(this);
93 | p.drawImage(0,0,image);
94 | }
95 |
--------------------------------------------------------------------------------
/EasyTransportPlugin.h:
--------------------------------------------------------------------------------
1 | /* this is the central part of the plugin */
2 | /****************************************************************
3 | * RetroShare is distributed under the following license:
4 | *
5 | * Copyright (C) 2015
6 | *
7 | * This program is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU General Public License
9 | * as published by the Free Software Foundation; either version 2
10 | * of the License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 | * Boston, MA 02110-1301, USA.
21 | ****************************************************************/
22 | #pragma once
23 |
24 | /*EasyTransport*/
25 | #include "services/p3EasyTransport.h"
26 |
27 | /*libretroshare"*/
28 | #include
29 |
30 | #include "gui/NEMainpage.h"
31 |
32 | class EasyTransportGUIHandler ;
33 | class EasyTransportNotify ;
34 |
35 | class EasyTransportPlugin: public RsPlugin
36 | {
37 | public:
38 | EasyTransportPlugin() ;
39 | virtual ~EasyTransportPlugin() {}
40 |
41 | virtual p3Service *p3_service() const ;
42 | virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_EasyTransport_PLUGIN ; }
43 | //virtual ConfigPage *qt_config_page() const ;
44 | virtual QDialog *qt_about_page() const ;
45 | //virtual ChatWidgetHolder *qt_get_chat_widget_holder(ChatWidget *chatWidget) const ;
46 |
47 | virtual QIcon *qt_icon() const;
48 | virtual QTranslator *qt_translator(QApplication *app, const QString& languageCode, const QString& externalDir) const;
49 | virtual void qt_sound_events(SoundEvents &events) const;
50 |
51 | virtual void getPluginVersion(int& major, int& minor, int &build, int& svn_rev) const ;
52 | virtual void setPlugInHandler(RsPluginHandler *pgHandler);
53 |
54 | virtual std::string configurationFileName() const { return "net_example.cfg" ; }
55 |
56 | virtual std::string getShortPluginDescription() const ;
57 | virtual std::string getPluginName() const;
58 | virtual void setInterfaces(RsPlugInInterfaces& interfaces);
59 |
60 | //================================== RsPlugin Notify ==================================//
61 | //virtual ToasterNotify *qt_toasterNotify();
62 |
63 | virtual MainPage *qt_page() const ;
64 |
65 | private:
66 | mutable p3EasyTransport *mEasyTransport ;
67 | mutable RsPluginHandler *mPlugInHandler;
68 | mutable RsPeers* mPeers;
69 | mutable ConfigPage *config_page ;
70 | mutable QIcon *mIcon;
71 | mutable MainPage* mainpage ;
72 |
73 | EasyTransportNotify *mEasyTransportNotify ;
74 | EasyTransportGUIHandler *mEasyTransportGUIHandler ;
75 | };
76 |
77 |
--------------------------------------------------------------------------------
/interface/rsEasyTransport.h:
--------------------------------------------------------------------------------
1 | /* this is a simple class to make it easy for any part of the plugin to call its services */
2 | /****************************************************************
3 | * RetroShare is distributed under the following license:
4 | *
5 | * Copyright (C) 2015
6 | *
7 | * This program is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU General Public License
9 | * as published by the Free Software Foundation; either version 2
10 | * of the License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 | * Boston, MA 02110-1301, USA.
21 | ****************************************************************/
22 |
23 | // interface class for p3EasyTransport service
24 | //
25 |
26 | #pragma once
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include "gui/EasyTransportNotify.h"
34 |
35 | class RsEasyTransport ;
36 | extern RsEasyTransport *rsEasyTransport;
37 |
38 | static const uint32_t CONFIG_TYPE_EasyTransport_PLUGIN = 0xe001 ;
39 |
40 | class RsEasyTransportPongResult
41 | {
42 | public:
43 | RsEasyTransportPongResult()
44 | :mTS(0), mRTT(0), mOffset(0) { return; }
45 |
46 | RsEasyTransportPongResult(double ts, double rtt, double offset)
47 | :mTS(ts), mRTT(rtt), mOffset(offset) { return; }
48 |
49 | double mTS;
50 | double mRTT;
51 | double mOffset;
52 | };
53 |
54 | struct RsEasyTransportDataChunk
55 | {
56 | typedef enum { RS_EasyTransport_DATA_TYPE_AUDIO, RS_EasyTransport_DATA_TYPE_VIDEO } RsEasyTransportDataType ;
57 |
58 | void *data ; // create/delete using malloc/free.
59 | uint32_t size ;
60 | RsEasyTransportDataType type ; // video or audio
61 | };
62 |
63 | class RsEasyTransport
64 | {
65 | public:
66 | virtual int sendEasyTransportHangUpCall(const RsPeerId& peer_id) = 0;
67 | virtual int sendEasyTransportRinging(const RsPeerId& peer_id) = 0;
68 | virtual int sendEasyTransportAcceptCall(const RsPeerId& peer_id) = 0;
69 |
70 | virtual void ping_all() = 0;
71 | virtual void broadcast_paint(int x, int y) = 0;
72 | virtual void msg_peer(std::string msg, RsPeerId peerId) = 0;
73 | virtual void msg_all(std::string msg) = 0;
74 | EasyTransportNotify *mNotify =0 ;
75 | // Sending data. The client keeps the memory ownership and must delete it after calling this.
76 | virtual int sendEasyTransportData(const RsPeerId& peer_id,const RsEasyTransportDataChunk& chunk) = 0;
77 |
78 | // The server fill in the data and gives up memory ownership. The client must delete the memory
79 | // in each chunk once it has been used.
80 | //
81 | virtual bool getIncomingData(const RsPeerId& peer_id,std::vector& chunks) = 0;
82 |
83 | typedef enum { AudioTransmitContinous = 0, AudioTransmitVAD = 1, AudioTransmitPushToTalk = 2 } enumAudioTransmit ;
84 |
85 | // Config stuff
86 |
87 | virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list &results) = 0;
88 | };
89 |
90 |
91 |
--------------------------------------------------------------------------------
/services/p3EasyTransport.h:
--------------------------------------------------------------------------------
1 | /* this handles the networking service of this plugin */
2 | /****************************************************************
3 | * RetroShare is distributed under the following license:
4 | *
5 | * Copyright (C) 2015
6 | *
7 | * This program is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU General Public License
9 | * as published by the Free Software Foundation; either version 2
10 | * of the License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 | * Boston, MA 02110-1301, USA.
21 | ****************************************************************/
22 |
23 | #pragma once
24 |
25 | #include
26 | #include
27 |
28 | #include "services/rsEasyTransportItems.h"
29 | #include "services/p3service.h"
30 | #include "serialiser/rstlvbase.h"
31 | #include "serialiser/rsconfigitems.h"
32 | #include "plugins/rspqiservice.h"
33 | #include
34 |
35 | class p3LinkMgr;
36 | class EasyTransportNotify ;
37 |
38 | class EasyTransportPeerInfo
39 | {
40 | public:
41 |
42 | bool initialisePeerInfo(const RsPeerId &id);
43 |
44 | RsPeerId mId;
45 | double mCurrentPingTS;
46 | double mCurrentPingCounter;
47 | bool mCurrentPongRecvd;
48 |
49 | uint32_t mLostPongs;
50 | uint32_t mSentPings;
51 | uint32_t total_bytes_received ;
52 | uint32_t average_incoming_bandwidth ;
53 |
54 | std::list mPongResults;
55 | std::list incoming_queue ;
56 | };
57 |
58 |
59 | //!The RS VoIP Test service.
60 | /**
61 | *
62 | * This is only used to test Latency for the moment.
63 | */
64 |
65 | class p3EasyTransport: public RsPQIService, public RsEasyTransport
66 | // Maybe we inherit from these later - but not needed for now.
67 | //, public p3Config, public pqiMonitor
68 | {
69 | public:
70 | p3EasyTransport(RsPluginHandler *cm,EasyTransportNotify *);
71 |
72 | /***** overloaded from rsEasyTransport *****/
73 |
74 | virtual uint32_t getPongResults(const RsPeerId &id, int n, std::list &results);
75 |
76 | // Call stuff.
77 | //
78 |
79 | // Sending data. The client keeps the memory ownership and must delete it after calling this.
80 | virtual int sendEasyTransportData(const RsPeerId &peer_id,const RsEasyTransportDataChunk& chunk) ;
81 |
82 | // The server fill in the data and gives up memory ownership. The client must delete the memory
83 | // in each chunk once it has been used.
84 | //
85 | virtual bool getIncomingData(const RsPeerId& peer_id,std::vector& chunks) ;
86 |
87 | virtual int sendEasyTransportHangUpCall(const RsPeerId& peer_id) ;
88 | virtual int sendEasyTransportRinging(const RsPeerId& peer_id) ;
89 | virtual int sendEasyTransportAcceptCall(const RsPeerId &peer_id) ;
90 |
91 | /***** overloaded from p3Service *****/
92 | /*!
93 | * This retrieves all chat msg items and also (important!)
94 | * processes chat-status items that are in service item queue. chat msg item requests are also processed and not returned
95 | * (important! also) notifications sent to notify base on receipt avatar, immediate status and custom status
96 | * : notifyCustomState, notifyChatStatus, notifyPeerHasNewAvatar
97 | * @see NotifyBase
98 | */
99 | virtual int tick();
100 | virtual int status();
101 | virtual bool recvItem(RsItem *item);
102 |
103 | /*************** pqiMonitor callback ***********************/
104 | //virtual void statusChange(const std::list &plist);
105 |
106 |
107 | /************* from p3Config *******************/
108 | virtual RsSerialiser *setupSerialiser() ;
109 |
110 | /*!
111 | * chat msg items and custom status are saved
112 | */
113 | virtual bool saveList(bool& cleanup, std::list&) ;
114 | virtual bool loadList(std::list& load) ;
115 | virtual std::string configurationFileName() const { return "net_example.cfg" ; }
116 |
117 | virtual RsServiceInfo getServiceInfo() ;
118 |
119 | void ping_all();
120 |
121 | void broadcast_paint(int x, int y);
122 | void msg_all(std::string msg);
123 | void msg_peer(std::string msg, RsPeerId peerId);
124 | private:
125 | int sendPackets();
126 | void sendPingMeasurements();
127 | void sendBandwidthInfo();
128 |
129 | int sendEasyTransportBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec) ;
130 |
131 | int handlePing(RsEasyTransportPingItem *item);
132 | int handlePong(RsEasyTransportPongItem *item);
133 |
134 | int storePingAttempt(const RsPeerId &id, double ts, uint32_t mCounter);
135 | int storePongResult(const RsPeerId& id, uint32_t counter, double ts, double rtt, double offset);
136 |
137 | void handleProtocol(RsEasyTransportProtocolItem*) ;
138 | void handlePaint(RsEasyTransportPaintItem *item);
139 | void handleData(RsEasyTransportDataItem*) ;
140 |
141 | RsMutex mEasyTransportMtx;
142 |
143 | EasyTransportPeerInfo *locked_GetPeerInfo(const RsPeerId& id);
144 |
145 | static RsTlvKeyValue push_int_value(const std::string& key,int value) ;
146 | static int pop_int_value(const std::string& s) ;
147 |
148 | std::map mPeerInfo;
149 | time_t mSentPingTime;
150 | time_t mSentBandwidthInfoTime;
151 | uint32_t mCounter;
152 |
153 | RsServiceControl *mServiceControl;
154 | EasyTransportNotify *mNotify ;
155 |
156 | int _atransmit ;
157 | int _voice_hold ;
158 | int _vadmin ;
159 | int _vadmax ;
160 | int _min_loudness ;
161 | int _noise_suppress ;
162 | bool _echo_cancel ;
163 | };
164 |
--------------------------------------------------------------------------------
/EasyTransportPlugin.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************
2 | * RetroShare is distributed under the following license:
3 | *
4 | * Copyright (C) 2015
5 | *
6 | * This program is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU General Public License
8 | * as published by the Free Software Foundation; either version 2
9 | * of the License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 | * Boston, MA 02110-1301, USA.
20 | ****************************************************************/
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | #include "EasyTransportPlugin.h"
31 | #include "interface/rsEasyTransport.h"
32 | #include "gui/NEMainpage.h"
33 | #include "gui/EasyTransportNotify.h"
34 |
35 |
36 | #define IMAGE_EasyTransport ":/images/talking_on.svg"
37 |
38 | static void *inited = new EasyTransportPlugin() ;
39 |
40 | extern "C" {
41 |
42 | // This is *the* functions required by RS plugin system to give RS access to the plugin.
43 | // Be careful to:
44 | // - always respect the C linkage convention
45 | // - always return an object of type RsPlugin*
46 | //
47 | void *RETROSHARE_PLUGIN_provide()
48 | {
49 | static EasyTransportPlugin *p = new EasyTransportPlugin() ;
50 |
51 | return (void*)p ;
52 | }
53 |
54 | // This symbol contains the svn revision number grabbed from the executable.
55 | // It will be tested by RS to load the plugin automatically, since it is safe to load plugins
56 | // with same revision numbers, assuming that the revision numbers are up-to-date.
57 | //
58 | uint32_t RETROSHARE_PLUGIN_revision = RS_REVISION_NUMBER ;
59 |
60 | // This symbol contains the svn revision number grabbed from the executable.
61 | // It will be tested by RS to load the plugin automatically, since it is safe to load plugins
62 | // with same revision numbers, assuming that the revision numbers are up-to-date.
63 | //
64 | uint32_t RETROSHARE_PLUGIN_api = RS_PLUGIN_API_VERSION ;
65 | }
66 |
67 | void EasyTransportPlugin::getPluginVersion(int& major, int& minor, int& build, int& svn_rev) const
68 | {
69 | major = RS_MAJOR_VERSION ;
70 | minor = RS_MINOR_VERSION ;
71 | build = RS_BUILD_NUMBER ;
72 | svn_rev = RS_REVISION_NUMBER ;
73 | }
74 |
75 | EasyTransportPlugin::EasyTransportPlugin()
76 | {
77 | qRegisterMetaType("RsPeerId");
78 | mainpage = NULL ;
79 | mEasyTransport = NULL ;
80 | mPlugInHandler = NULL;
81 | mPeers = NULL;
82 | config_page = NULL ;
83 | mIcon = NULL ;
84 |
85 | mEasyTransportNotify = new EasyTransportNotify;
86 | }
87 |
88 | void EasyTransportPlugin::setInterfaces(RsPlugInInterfaces &interfaces)
89 | {
90 | mPeers = interfaces.mPeers;
91 | }
92 |
93 | /*ConfigPage *EasyTransportPlugin::qt_config_page() const
94 | {
95 | // The config pages are deleted when config is closed, so it's important not to static the
96 | // created object.
97 | //
98 | return new AudioInputConfig() ;
99 | }*/
100 |
101 | QDialog *EasyTransportPlugin::qt_about_page() const
102 | {
103 | static QMessageBox *about_dialog = NULL ;
104 |
105 | if(about_dialog == NULL)
106 | {
107 | about_dialog = new QMessageBox() ;
108 |
109 | QString text ;
110 | text += QObject::tr("
RetroShare EasyTransport plugin
* Contributors: Cyril Soler, Josselin Jacquard ") ;
111 | text += QObject::tr(" The EasyTransport plugin adds EasyTransport to the private chat window of RetroShare. to use it, proceed as follows:
") ;
112 | text += QObject::tr("
setup microphone levels using the configuration panel
") ;
113 | text += QObject::tr("
check your microphone by looking at the VU-metters
") ;
114 | text += QObject::tr("
in the private chat, enable sound input/output by clicking on the two EasyTransport icons
") ;
115 | text += QObject::tr("Your friend needs to run the plugin to talk/listen to you, or course.") ;
116 | text += QObject::tr("
This is an experimental feature. Don't hesitate to send comments and suggestion to the RS dev team.") ;
117 |
118 | about_dialog->setText(text) ;
119 | about_dialog->setStandardButtons(QMessageBox::Ok) ;
120 | }
121 |
122 | return about_dialog ;
123 | }
124 |
125 | /*ChatWidgetHolder *EasyTransportPlugin::qt_get_chat_widget_holder(ChatWidget *chatWidget) const
126 | {
127 | switch (chatWidget->chatType()) {
128 | case ChatWidget::CHATTYPE_PRIVATE:
129 | return new EasyTransportChatWidgetHolder(chatWidget, mEasyTransportNotify);
130 | case ChatWidget::CHATTYPE_UNKNOWN:
131 | case ChatWidget::CHATTYPE_LOBBY:
132 | case ChatWidget::CHATTYPE_DISTANT:
133 | break;
134 | }
135 |
136 | return NULL;
137 | }*/
138 |
139 | p3Service *EasyTransportPlugin::p3_service() const
140 | {
141 | if(mEasyTransport == NULL)
142 | rsEasyTransport = mEasyTransport = new p3EasyTransport(mPlugInHandler,mEasyTransportNotify) ; // , 3600 * 24 * 30 * 6); // 6 Months
143 |
144 | return mEasyTransport ;
145 | }
146 |
147 | void EasyTransportPlugin::setPlugInHandler(RsPluginHandler *pgHandler)
148 | {
149 | mPlugInHandler = pgHandler;
150 | }
151 |
152 | QIcon *EasyTransportPlugin::qt_icon() const
153 | {
154 | if (mIcon == NULL) {
155 | Q_INIT_RESOURCE(EasyTransport_images);
156 |
157 | mIcon = new QIcon(IMAGE_EasyTransport);
158 | }
159 |
160 | return mIcon;
161 | }
162 | MainPage *EasyTransportPlugin::qt_page() const
163 | {
164 | if(mainpage == NULL){
165 | mainpage = new NEMainpage(0, mEasyTransportNotify);//mPeers, mFiles) ;
166 | //tpage = new NEMainpage( );
167 | //mainpage = tpage;
168 | }
169 |
170 | return mainpage ;
171 | }
172 |
173 | std::string EasyTransportPlugin::getShortPluginDescription() const
174 | {
175 | return "EasyTransport";
176 | }
177 |
178 | std::string EasyTransportPlugin::getPluginName() const
179 | {
180 | return "EasyTransportPlugin";
181 | }
182 |
183 | QTranslator* EasyTransportPlugin::qt_translator(QApplication */*app*/, const QString& languageCode, const QString& externalDir) const
184 | {
185 | return NULL;
186 | }
187 |
188 | void EasyTransportPlugin::qt_sound_events(SoundEvents &/*events*/) const
189 | {
190 | // events.addEvent(QApplication::translate("EasyTransport", "EasyTransport"), QApplication::translate("EasyTransport", "Incoming call"), EasyTransport_SOUND_INCOMING_CALL);
191 | }
192 |
193 | /*ToasterNotify *EasyTransportPlugin::qt_toasterNotify(){
194 | if (!mEasyTransportToasterNotify) {
195 | mEasyTransportToasterNotify = new EasyTransportToasterNotify(mEasyTransport, mEasyTransportNotify);
196 | }
197 | return mEasyTransportToasterNotify;
198 | }*/
199 |
--------------------------------------------------------------------------------
/services/rsEasyTransportItems.h:
--------------------------------------------------------------------------------
1 | /* this describes the datatypes sent over the network, and how to (de)serialise them */
2 | /****************************************************************
3 | * RetroShare is distributed under the following license:
4 | *
5 | * Copyright (C) 2015
6 | *
7 | * This program is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU General Public License
9 | * as published by the Free Software Foundation; either version 2
10 | * of the License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 | * Boston, MA 02110-1301, USA.
21 | ****************************************************************/
22 |
23 | #pragma once
24 |
25 | /*
26 | * libretroshare/src/serialiser: rsEasyTransportItems.h
27 | *
28 | * RetroShare Serialiser.
29 | *
30 | * Copyright 2011 by Robert Fernie.
31 | *
32 | * This library is free software; you can redistribute it and/or
33 | * modify it under the terms of the GNU Library General Public
34 | * License Version 2 as published by the Free Software Foundation.
35 | *
36 | * This library is distributed in the hope that it will be useful,
37 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39 | * Library General Public License for more details.
40 | *
41 | * You should have received a copy of the GNU Library General Public
42 | * License along with this library; if not, write to the Free Software
43 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
44 | * USA.
45 | *
46 | * Please report all bugs and problems to "retroshare@lunamutt.com".
47 | *
48 | */
49 |
50 | #include