WPILibC++
2025.0.0-alpha-1-24-g6478ba6
DsClient.h
Go to the documentation of this file.
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
#pragma once
6
7
#include <memory>
8
#include <string>
9
#include <string_view>
10
11
#include <
wpi/Signal.h
>
12
13
namespace
wpi
{
14
15
class
Logger;
16
17
namespace
uv {
18
class
Loop;
19
class
Tcp;
20
class
Timer;
21
}
// namespace uv
22
23
class
DsClient
:
public
std::enable_shared_from_this<DsClient> {
24
struct
private_init {};
25
26
public
:
27
static
std::shared_ptr<DsClient>
Create
(
wpi::uv::Loop
& loop,
28
wpi::Logger
& logger) {
29
return
std::make_shared<DsClient>(loop, logger, private_init{});
30
}
31
32
DsClient
(
wpi::uv::Loop
& loop,
wpi::Logger
& logger,
const
private_init&);
33
~DsClient
();
34
DsClient
(
const
DsClient
&) =
delete
;
35
DsClient
&
operator=
(
const
DsClient
&) =
delete
;
36
37
void
Close
();
38
39
sig::Signal<std::string_view>
setIp
;
40
sig::Signal<>
clearIp
;
41
42
private
:
43
void
Connect();
44
void
HandleIncoming(
std::string_view
in
);
45
void
ParseJson();
46
47
wpi::Logger
& m_logger;
48
49
std::shared_ptr<wpi::uv::Tcp> m_tcp;
50
std::shared_ptr<wpi::uv::Timer> m_timer;
51
52
std::string m_json;
53
};
54
55
}
// namespace wpi
wpi::DsClient
Definition:
DsClient.h:23
wpi::DsClient::clearIp
sig::Signal clearIp
Definition:
DsClient.h:40
wpi::DsClient::Close
void Close()
wpi::DsClient::setIp
sig::Signal< std::string_view > setIp
Definition:
DsClient.h:39
wpi::DsClient::Create
static std::shared_ptr< DsClient > Create(wpi::uv::Loop &loop, wpi::Logger &logger)
Definition:
DsClient.h:27
wpi::DsClient::operator=
DsClient & operator=(const DsClient &)=delete
wpi::DsClient::DsClient
DsClient(wpi::uv::Loop &loop, wpi::Logger &logger, const private_init &)
wpi::DsClient::~DsClient
~DsClient()
wpi::DsClient::DsClient
DsClient(const DsClient &)=delete
wpi::Logger
Definition:
Logger.h:27
wpi::sig::SignalBase
SignalBase is an implementation of the observer pattern, through the use of an emitting object and sl...
Definition:
Signal.h:495
wpi::uv::Loop
Event loop.
Definition:
Loop.h:37
detail::in
constexpr auto in(type t, int set) -> bool
Definition:
base.h:701
wpi
Definition:
ntcore_cpp.h:26
string_view
basic_string_view< char > string_view
Definition:
base.h:601
Signal.h
wpinet
DsClient.h
Generated on Sun Jul 7 2024 13:45:43 for WPILibC++ by
1.9.4