forked from opelpanfan/PowerTune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgopro.cpp
104 lines (85 loc) · 2.79 KB
/
gopro.cpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright (C) 2017 Bastian Gschrey & Markus Ippy
*
* GoPro Wifi remote based on the information provided by
* Based on the information provided by https://github.com/KonradIT/goprowifihack
* •Konrad Iturbe - main developer
* •dough29 - HERO2 research
* •EvilWombat - general and HERO3
* •3v1n0 - HERO4 research
* •Maelstrom Napalm - HERO4 research
* •fraannk - HERO4 research
*
* This software comes under the GPL (GNU Public License)
* You may freely copy,distribute etc. this as long as the source code
* is made available for FREE.
*
* No warranty is made or implied. You use this program at your own risk.
*/
#include "gopro.h"
#include <QtNetwork>
#include <QNetworkAccessManager>
#include <QNetworkReply>
QString Command; // GoPro Command URL
GoPro::GoPro(QObject *parent)
: QObject(parent)
{
}
//Function for GoPro command forwarding
void GoPro::goProSettings(const int &goProSelect, const QString &goPropass)
{
int Index = goProSelect;
QString OPTION;
QString PARAM1;
QString PARAM2;
QString PASSWORD = goPropass;
QString ADRESS;
//HERO
if (Index == 0)
{
//ADRESS = "http://10.5.5.9/gp/gpControl/command/shutter?p=";
//http://10.5.5.9/gp/gpControl/status
ADRESS = "http://10.5.5.9/gp/gpControl/status";
//Command = QString (ADRESS) + QString (OPTION);
Command = QString (ADRESS);
}
//HERO 2
if (Index == 1)
{
ADRESS = "http://10.5.5.9/";
PARAM1 = "bacpac";
PARAM2 = "SH";
Command = QString (ADRESS) + QString (PARAM1) +"/"+ QString (PARAM2) + "?t=" + QString (PASSWORD) + "&p=%" + "0" + QString (OPTION);
}
//HERO 3
if (Index == 2)
{
ADRESS = "http://10.5.5.9/";
PARAM1 = "camera";
PARAM2 = "SH";
Command = QString (ADRESS) +QString (PARAM1) +"/"+ QString (PARAM2) + "?t=" + QString (PASSWORD) + "&p=%" + "0" + QString (OPTION);
}
//HERO 4
if (Index == 3)
{
PARAM1 = "camera";
PARAM2 = "SH";
Command = QString (ADRESS) +QString (PARAM1) +"/"+ QString (PARAM2) + "?t=" + QString (PASSWORD) + "&p=%" + QString (OPTION);
}
//qDebug() << "Gopro Index" <<Index;
//qDebug() << "Gopro Command" <<Command;
}
void GoPro::goprorec(const QString &record)
{
QString cmdstatus = record; // Status of GoPro command ,on off (0/1)
//qDebug()<< "cmdstatus " << cmdstatus;
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
GoPro::connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(QUrl(QString (Command) + QString (cmdstatus))));
//qDebug() << "sending HTTP request " <<QString (Command) + QString (cmdstatus);
}
void GoPro::replyFinished(QNetworkReply *net_reply)
{
QString data = net_reply->readAll();
qDebug() << "reply raw" << data;
}