-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathsmoke-test.cpp
More file actions
executable file
·114 lines (101 loc) · 2.97 KB
/
Copy pathsmoke-test.cpp
File metadata and controls
executable file
·114 lines (101 loc) · 2.97 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
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
105
106
107
108
109
110
111
112
113
114
#include <QFile>
#include <fstream>
#include <quface-io/engine.hpp>
#include <quface/logger.hpp>
#include <regex>
#include <string>
#include <thread>
#include <vector>
#include "config.hpp"
#include "mpi_sys.h"
using namespace suanzi;
using namespace suanzi::io;
void test() {
LCDScreenType screen_type = RH_9881_8INCH_800X1280;
if (!Config::load_screen_type(screen_type)) return;
SensorType sensor0_type = SONY_IMX327_2L_MIPI_2M_30FPS_12BIT;
SensorType sensor1_type = SONY_IMX327_2L_MIPI_2M_30FPS_12BIT;
if (!Config::load_sensor_type(sensor0_type, sensor1_type)) return;
EngineOption opt = {
.bgr =
{
.sensor_type = sensor0_type,
.dev = 0,
.flip = true,
.wdr = false,
.channels =
{
{
.index = 0,
.rotate = 0,
.size =
{
.width = 1920,
.height = 1080,
},
},
},
},
.nir =
{
.sensor_type = sensor1_type,
.dev = 1,
.flip = true,
.wdr = false,
.channels =
{
{
.index = 0,
.rotate = 0,
.size =
{
.width = 1920,
.height = 1080,
},
},
},
},
.screen =
{
.type = screen_type,
},
.show_secondary_win = true,
.secondary_win_percent = SECONDARY_WIN_PERCENT_50,
};
auto engine = Engine::instance();
engine->set_option(opt);
engine->start();
{
for (int i = 0; i < 5; i++) {
SZ_LOG_INFO("Turn on light box ... {}", i);
engine->gpio_set(GpioPinLightBox, true);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
SZ_LOG_INFO("Turn off light box ... {}", i);
engine->gpio_set(GpioPinLightBox, false);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}
{
std::string name = ":asserts/zh-CN/recognition_succeed.aac";
std::vector<SZ_BYTE> audio;
QFile audio_file(name.c_str());
if (!audio_file.open(QIODevice::ReadOnly)) {
SZ_LOG_ERROR("Open {} failed", name);
}
auto data = audio_file.readAll();
audio.assign(data.begin(), data.end());
engine->audio_set_volume(100);
for (int i = 0; i < 5; i++) {
SZ_LOG_INFO("Play audio ... {}", i);
engine->audio_play(audio);
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
}
}
int main() {
HI_MPI_SYS_Init();
test();
std::this_thread::sleep_for(std::chrono::milliseconds(60000));
HI_MPI_SYS_Exit();
return 0;
}