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_ip.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->
setProcessor
(
dai::ProcessorType::LEON_CSS
);
15
script->setScript(R
"(
16
import socket
17
import fcntl
18
import struct
19
20
def get_ip_address(ifname):
21
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
22
return socket.inet_ntoa(fcntl.ioctl(
23
s.fileno(),
24
-1071617759, # SIOCGIFADDR
25
struct.pack('256s', ifname[:15].encode())
26
)[20:24])
27
28
ip = get_ip_address('re0') # '192.168.0.110'
29
node.warn(f'IP of the device: {ip}')
30
node.io['end'].send(Buffer(32))
31
)");
32
33
// XLinkOut
34
auto
xout = pipeline.
create
<
dai::node::XLinkOut
>();
35
xout->
setStreamName
(
"end"
);
36
script->outputs[
"end"
].link(xout->input);
37
38
// Connect to device with pipeline
39
dai::Device
device(pipeline);
40
device.
getOutputQueue
(
"end"
)->get<
dai::Buffer
>();
41
return
0;
42
}
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
main
int main()
Definition:
script_get_ip.cpp:6
dai::Device::getOutputQueue
std::shared_ptr< DataOutputQueue > getOutputQueue(const std::string &name)
Definition:
Device.cpp:86
depthai.hpp
dai::Pipeline::create
std::shared_ptr< N > create()
Definition:
Pipeline.hpp:145
dai::ProcessorType::LEON_CSS
@ LEON_CSS
dai::node::Script
Definition:
Script.hpp:15
dai::node::Script::setProcessor
void setProcessor(ProcessorType type)
Definition:
Script.cpp:53
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