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

OpenLightingProject / ola / 8459985651

27 Mar 2024 11:25PM UTC coverage: 45.458% (+0.2%) from 45.276%
8459985651

push

github

web-flow
Merge pull request #1947 from peternewman/e1.33-cherry-pick

E1.33 cherry pick third time lucky

7720 of 17809 branches covered (43.35%)

217 of 310 new or added lines in 20 files covered. (70.0%)

2 existing lines in 1 file now uncovered.

21915 of 48209 relevant lines covered (45.46%)

62.66 hits per line

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

0.0
/libs/acn/LLRPProbeReplyInflator.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
 * LLRPProbeReplyInflator.cpp
17
 * The Inflator for the LLRP Probe Reply PDUs
18
 * Copyright (C) 2020 Peter Newman
19
 */
20

21
#include <iostream>
22
#include <memory>
23
#include "ola/Logging.h"
24
#include "include/ola/rdm/UID.h"
25
#include "include/ola/rdm/UIDSet.h"
26
#include "include/ola/strings/Format.h"
27
#include "libs/acn/LLRPProbeReplyInflator.h"
28
#include "libs/acn/LLRPProbeReplyPDU.h"
29

30
namespace ola {
31
namespace acn {
32

33
using ola::acn::LLRPProbeReplyPDU;
34
using ola::rdm::UID;
35
using ola::rdm::UIDSet;
36

37
/**
38
 * Create a new LLRP Probe Reply inflator
39
 */
NEW
40
LLRPProbeReplyInflator::LLRPProbeReplyInflator()
×
NEW
41
    : BaseInflator(PDU::ONE_BYTE) {
×
NEW
42
}
×
43

44
/**
45
 * Set an LLRPProbeReplyHandler to run when receiving an LLRP Probe Reply
46
 * message.
47
 * @param handler the callback to invoke when there is an LLRP Probe Reply.
48
 */
NEW
49
void LLRPProbeReplyInflator::SetLLRPProbeReplyHandler(
×
50
    LLRPProbeReplyHandler *handler) {
NEW
51
  m_llrp_probe_reply_handler.reset(handler);
×
NEW
52
}
×
53

54

55
/*
56
 * Decode the LLRP Probe Reply 'header', which is 0 bytes in length.
57
 * @param headers the HeaderSet to add to
58
 * @param data a pointer to the data
59
 * @param length length of the data
60
 * @returns true if successful, false otherwise
61
 */
NEW
62
bool LLRPProbeReplyInflator::DecodeHeader(HeaderSet *,
×
63
                                          const uint8_t*,
64
                                          unsigned int,
65
                                          unsigned int *bytes_used) {
NEW
66
  *bytes_used = 0;
×
NEW
67
  return true;
×
68
}
69

70

71
/*
72
 * Handle a LLRP Probe Reply PDU for E1.33.
73
 */
NEW
74
bool LLRPProbeReplyInflator::HandlePDUData(uint32_t vector,
×
75
                                           const HeaderSet &headers,
76
                                           const uint8_t *data,
77
                                           unsigned int pdu_len) {
NEW
78
  if (vector != LLRPProbeReplyPDU::VECTOR_PROBE_REPLY_DATA) {
×
NEW
79
    OLA_INFO << "Not a probe reply, vector was " << vector;
×
NEW
80
    return true;
×
81
  }
82

NEW
83
  ola::strings::FormatData(&std::cout, data, pdu_len);
×
84

NEW
85
  LLRPProbeReplyPDU::llrp_probe_reply_pdu_data pdu_data;
×
NEW
86
  if (pdu_len > sizeof(pdu_data)) {
×
NEW
87
    OLA_WARN << "Got too much data, received " << pdu_len << " only expecting "
×
NEW
88
             << sizeof(pdu_data);
×
NEW
89
    return false;
×
90
  }
91

NEW
92
  memcpy(reinterpret_cast<uint8_t*>(&pdu_data), data, sizeof(pdu_data));
×
93

NEW
94
  OLA_DEBUG << "Probe from " << UID(pdu_data.target_uid);
×
95

NEW
96
  LLRPProbeReply reply(UID(pdu_data.target_uid));
×
97

NEW
98
  if (m_llrp_probe_reply_handler.get()) {
×
NEW
99
    m_llrp_probe_reply_handler->Run(&headers,
×
100
                                    reply);
101
  } else {
NEW
102
    OLA_WARN << "No LLRP Probe Reply handler defined!";
×
103
  }
104
  return true;
105
}
106
}  // namespace acn
107
}  // 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