• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OpenLightingProject / ola / 24609073669

18 Apr 2026 04:36PM UTC coverage: 44.864% (-0.9%) from 45.72%
24609073669

push

github

web-flow
Merge pull request #2043 from peternewman/nortle-ftdi

Revert some stuff via 146cf26 which accidentally snuck into #1999 by mistake

8554 of 19846 branches covered (43.1%)

22105 of 49271 relevant lines covered (44.86%)

48.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.68
/libs/acn/LLRPProbeRequestPDU.cpp
1
/*
2
 * This program is free software; you can redistribute it and/or modify
3
 * it under the terms of the GNU General Public License as published by
4
 * the Free Software Foundation; either version 2 of the License, or
5
 * (at your option) any later version.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU Library General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15
 *
16
 * LLRPProbeRequestPDU.cpp
17
 * The LLRPProbeRequestPDU
18
 * Copyright (C) 2020 Peter Newman
19
 */
20

21
#include "libs/acn/LLRPProbeRequestPDU.h"
22

23
#include <ola/network/NetworkUtils.h>
24
#include <ola/rdm/UID.h>
25
#include <ola/rdm/UIDSet.h>
26

27
namespace ola {
28
namespace acn {
29

30
using ola::io::OutputStream;
31
using ola::network::HostToNetwork;
32
using ola::rdm::UID;
33

34
unsigned int LLRPProbeRequestPDU::DataSize() const {
9✔
35
  llrp_probe_request_pdu_data data;
9✔
36
  return static_cast<unsigned int>(sizeof(llrp_probe_request_pdu_data) -
9✔
37
                                   sizeof(data.known_uids) +
38
                                   (m_known_uids.Size() * UID::LENGTH));
9✔
39
}
40

41
bool LLRPProbeRequestPDU::PackData(uint8_t *data, unsigned int *length) const {
2✔
42
  llrp_probe_request_pdu_data pdu_data;
2✔
43
  m_lower_uid.Pack(pdu_data.lower_uid, sizeof(pdu_data.lower_uid));
2✔
44
  m_upper_uid.Pack(pdu_data.upper_uid, sizeof(pdu_data.upper_uid));
2✔
45
  uint16_t filter = 0;
2✔
46
  if (m_client_tcp_connection_inactive) {
2✔
47
    filter |= FILTER_CLIENT_TCP_CONNECTION_INACTIVE;
×
48
  }
49
  if (m_brokers_only) {
2✔
50
    filter |= FILTER_BROKERS_ONLY;
×
51
  }
52
  pdu_data.filter = HostToNetwork(filter);
2✔
53
  // TODO(Peter): We need to check we've got <= 200 UIDs here
54
  m_known_uids.Pack(pdu_data.known_uids, sizeof(pdu_data.known_uids));
2✔
55
  *length = static_cast<unsigned int>(sizeof(llrp_probe_request_pdu_data) -
2✔
56
                                      sizeof(pdu_data.known_uids) +
2✔
57
                                      (m_known_uids.Size() * UID::LENGTH));
2✔
58

59
  memcpy(data, &pdu_data, *length);
2✔
60
  return true;
2✔
61
}
62

63
void LLRPProbeRequestPDU::PackData(ola::io::OutputStream *stream) const {
1✔
64
  llrp_probe_request_pdu_data data;
1✔
65
  m_lower_uid.Pack(data.lower_uid, sizeof(data.lower_uid));
1✔
66
  m_upper_uid.Pack(data.upper_uid, sizeof(data.upper_uid));
1✔
67
  uint16_t filter = 0;
1✔
68
  if (m_client_tcp_connection_inactive) {
1✔
69
    filter |= FILTER_CLIENT_TCP_CONNECTION_INACTIVE;
×
70
  }
71
  if (m_brokers_only) {
1✔
72
    filter |= FILTER_BROKERS_ONLY;
×
73
  }
74
  data.filter = HostToNetwork(filter);
1✔
75
  // TODO(Peter): We need to check we've got <= 200 UIDs here
76
  m_known_uids.Pack(data.known_uids, sizeof(data.known_uids));
1✔
77
  stream->Write(reinterpret_cast<uint8_t*>(&data),
1✔
78
                static_cast<unsigned int>(sizeof(llrp_probe_request_pdu_data) -
79
                                          sizeof(data.known_uids) +
80
                                          (m_known_uids.Size() * UID::LENGTH)));
1✔
81
}
1✔
82

83
void LLRPProbeRequestPDU::PrependPDU(ola::io::IOStack *stack,
2✔
84
                                     const UID &lower_uid,
85
                                     const UID &upper_uid,
86
                                     bool client_tcp_connection_inactive,
87
                                     bool brokers_only,
88
                                     const ola::rdm::UIDSet &known_uids) {
89
  if (!stack) {
2✔
90
    OLA_WARN << "LLRPProbeRequestPDU::PrependPDU: missing stack";
1✔
91
    return;
1✔
92
  }
93

94
  llrp_probe_request_pdu_data data;
1✔
95
  lower_uid.Pack(data.lower_uid, sizeof(data.lower_uid));
1✔
96
  upper_uid.Pack(data.upper_uid, sizeof(data.upper_uid));
1✔
97
  uint16_t filter = 0;
1✔
98
  if (client_tcp_connection_inactive) {
1✔
99
    filter |= FILTER_CLIENT_TCP_CONNECTION_INACTIVE;
×
100
  }
101
  if (brokers_only) {
1✔
102
    filter |= FILTER_BROKERS_ONLY;
×
103
  }
104
  data.filter = HostToNetwork(filter);
1✔
105
  // TODO(Peter): We need to check we've got <= 200 UIDs here
106
  known_uids.Pack(data.known_uids, sizeof(data.known_uids));
1✔
107
  stack->Write(reinterpret_cast<uint8_t*>(&data),
1✔
108
               static_cast<unsigned int>(sizeof(llrp_probe_request_pdu_data) -
109
                                         sizeof(data.known_uids) +
110
                                         (known_uids.Size() * UID::LENGTH)));
1✔
111
  uint8_t vector = HostToNetwork(VECTOR_PROBE_REQUEST_DATA);
1✔
112
  stack->Write(reinterpret_cast<uint8_t*>(&vector), sizeof(vector));
1✔
113
  PrependFlagsAndLength(stack, VFLAG_MASK | HFLAG_MASK | DFLAG_MASK, true);
1✔
114
}
115
}  // namespace acn
116
}  // namespace ola
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc