forked from martinruenz/v360
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_camera.cpp
More file actions
76 lines (62 loc) · 1.93 KB
/
Copy pathrun_camera.cpp
File metadata and controls
76 lines (62 loc) · 1.93 KB
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
#include <string>
#include "../v360.hpp"
#include <iostream>
#ifdef unix
#include <unistd.h>
#endif
#ifdef _WIN32
#include <windows.h>
void sleep(int s)
{
Sleep(s * 1000);
}
#endif
using namespace std;
const string pin = "0000"; // use your camera-pin here
const string btmac = "B4:99:4C:4B:CE:1C"; // use findCameras() to obtain this values or call 'hcitool lescan'
int main(){
v360::Remote cam = v360::Remote();
v360::Variant name = cam.getName();
if(name.isSet()) cout << name << endl;
else {
cout << "Not connected to camera wifi, try booting camera..." << endl;
#ifdef unix
cam.turnOn(btmac)
sleep(25);
#else
cout << "Your system does not provide gatttool. Hence, turning on the camera via bluetooth LE is not possible." << endl;
#endif
}
name = cam.getName();
if (name.isSet()) cout << name << endl;
if (cam.connect(pin)){
cout << "Connected! Play video for 30 seconds and disconnect." << endl;
cout << "Battery " << cam.getBattery() << "%" << endl;
cout << "HDMI " << cam.getHdmiConnected() << endl;
cout << "Powered " << cam.getPowerConnected() << endl;
cout << "Start video " << cam.startVideo() << endl;
sleep(25);
cout << "Stop video " << cam.stopVideo() << endl;
cam.disconnect();
cout << "Now reconnect, play a video with sepia effect for another 30 seconds and turn off." << endl;
cam.setVerbose(false);
if (cam.connect(pin)){
cout << "Battery " << cam.getBattery() << "%" << endl;
cout << "HDMI " << cam.getHdmiConnected() << endl;
cout << "Powered " << cam.getPowerConnected() << endl;
cam.setVideoEffect("sepia");
cout << "Start video " << cam.startVideo() << endl;
sleep(30);
cout << "Stop video " << cam.stopVideo() << endl;
cam.setVideoEffect("none");
cam.turnOff();
}
else{
cout << "Could not reconnect to camera." << endl;
}
}
else {
cout << "Could not connect to camera. Make sure you (automatically) connected to the camera wifi." << endl;
}
return 0;
}