WPILibC++ 2024.3.2
MulticastServiceAnnouncer.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 <stdint.h>
8
9#ifdef __cplusplus
10#include <memory>
11#include <span>
12#include <string>
13#include <string_view>
14#include <utility>
15namespace wpi {
17 public:
18 /**
19 * Creates a MulticastServiceAnnouncer.
20 *
21 * @param serviceName service name
22 * @param serviceType service type
23 * @param port port
24 * @param txt txt
25 */
27 std::string_view serviceName, std::string_view serviceType, int port,
28 std::span<const std::pair<std::string, std::string>> txt);
29 /**
30 * Creates a MulticastServiceAnnouncer.
31 *
32 * @param serviceName service name
33 * @param serviceType service type
34 * @param port port
35 * @param txt txt
36 */
38 std::string_view serviceName, std::string_view serviceType, int port,
39 std::span<const std::pair<std::string_view, std::string_view>> txt);
40 /**
41 * Creates a MulticastServiceAnnouncer.
42 *
43 * @param serviceName service name
44 * @param serviceType service type
45 * @param port port
46 */
48 std::string_view serviceType, int port);
50 /**
51 * Starts multicast service announcer.
52 */
53 void Start();
54 /**
55 * Stops multicast service announcer.
56 */
57 void Stop();
58 /**
59 * Returns true if there's a multicast service announcer implementation.
60 *
61 * @return True if there's a multicast service announcer implementation.
62 */
63 bool HasImplementation() const;
64 struct Impl;
65
66 private:
67 std::unique_ptr<Impl> pImpl;
68};
69} // namespace wpi
70extern "C" {
71#endif
72
73typedef unsigned int WPI_MulticastServiceAnnouncerHandle; // NOLINT
74
76 const char* serviceName, const char* serviceType, int32_t port,
77 int32_t txtCount, const char** keys, const char** values);
78
81
84
87
90
91#ifdef __cplusplus
92} // extern "C"
93#endif
void WPI_FreeMulticastServiceAnnouncer(WPI_MulticastServiceAnnouncerHandle handle)
void WPI_StopMulticastServiceAnnouncer(WPI_MulticastServiceAnnouncerHandle handle)
unsigned int WPI_MulticastServiceAnnouncerHandle
Definition: MulticastServiceAnnouncer.h:73
void WPI_StartMulticastServiceAnnouncer(WPI_MulticastServiceAnnouncerHandle handle)
int32_t WPI_GetMulticastServiceAnnouncerHasImplementation(WPI_MulticastServiceAnnouncerHandle handle)
WPI_MulticastServiceAnnouncerHandle WPI_CreateMulticastServiceAnnouncer(const char *serviceName, const char *serviceType, int32_t port, int32_t txtCount, const char **keys, const char **values)
Definition: MulticastServiceAnnouncer.h:16
bool HasImplementation() const
Returns true if there's a multicast service announcer implementation.
MulticastServiceAnnouncer(std::string_view serviceName, std::string_view serviceType, int port, std::span< const std::pair< std::string_view, std::string_view > > txt)
Creates a MulticastServiceAnnouncer.
MulticastServiceAnnouncer(std::string_view serviceName, std::string_view serviceType, int port)
Creates a MulticastServiceAnnouncer.
void Stop()
Stops multicast service announcer.
void Start()
Starts multicast service announcer.
MulticastServiceAnnouncer(std::string_view serviceName, std::string_view serviceType, int port, std::span< const std::pair< std::string, std::string > > txt)
Creates a MulticastServiceAnnouncer.
basic_string_view< char > string_view
Definition: core.h:501
Definition: array.h:89
Definition: ntcore_cpp.h:26