Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
b
c
d
e
h
i
l
m
n
p
r
s
u
x
Typedefs
b
c
d
e
f
g
i
m
p
r
u
v
Enumerations
Enumerator
a
b
f
g
i
m
n
r
s
u
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
h
i
m
n
p
q
r
s
t
u
v
x
Enumerations
a
c
d
e
f
k
l
m
p
r
s
t
v
w
Enumerator
a
b
d
f
g
h
i
l
m
n
o
p
r
s
u
v
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
b
c
d
e
f
g
m
o
p
r
s
t
u
v
w
Variables
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
w
Typedefs
Enumerations
Enumerator
Macros
_
d
f
i
m
n
p
s
t
u
examples
Script
script_get_device_info.cpp
Go to the documentation of this file.
1
#include <iostream>
2
3
// Includes common necessary includes for development using depthai library
4
#include "
depthai/depthai.hpp
"
5
6
int
main
() {
7
using namespace
std
;
8
9
// Start defining a pipeline
10
dai::Pipeline
pipeline;
11
12
// Script node
13
auto
script = pipeline.
create
<
dai::node::Script
>();
14
script->
setScript
(R
"(
15
import json
16
data = json.dumps({
17
'deviceId': __device_id__,
18
'fwVersion': __version__
19
}).encode('utf-8')
20
21
b = Buffer(len(data))
22
b.setData(data)
23
node.io['info'].send(b)
24
)");
25
26
// XLinkOut
27
auto
xout = pipeline.
create
<
dai::node::XLinkOut
>();
28
xout->
setStreamName
(
"info"
);
29
script->outputs[
"info"
].link(xout->input);
30
31
// Connect to device with pipeline
32
dai::Device
device(pipeline);
33
auto
msg = device.
getOutputQueue
(
"info"
)->get<
dai::Buffer
>();
34
auto
data
= nlohmann::json::parse(msg->getData());
35
std::cout <<
data
.dump(4) << std::endl;
36
37
return
0;
38
}
dai::node::XLinkOut
XLinkOut node. Sends messages over XLink.
Definition:
XLinkOut.hpp:14
dai::Pipeline
Represents the pipeline, set of nodes and connections between them.
Definition:
Pipeline.hpp:100
DAI_SPAN_NAMESPACE_NAME::detail::data
constexpr auto data(C &c) -> decltype(c.data())
Definition:
span.hpp:177
dai::Device::getOutputQueue
std::shared_ptr< DataOutputQueue > getOutputQueue(const std::string &name)
Definition:
Device.cpp:86
main
int main()
Definition:
script_get_device_info.cpp:6
depthai.hpp
dai::node::Script::setScript
void setScript(const std::string &script, const std::string &name="")
Definition:
Script.cpp:32
dai::Pipeline::create
std::shared_ptr< N > create()
Definition:
Pipeline.hpp:145
dai::node::Script
Definition:
Script.hpp:15
dai::Buffer
Base message - buffer of binary data.
Definition:
Buffer.hpp:13
dai::Device
Definition:
Device.hpp:21
std
Definition:
Node.hpp:366
dai::node::XLinkOut::setStreamName
void setStreamName(const std::string &name)
Definition:
XLinkOut.cpp:13
depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19