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

OpenLightingProject / ola / 16900099157

12 Aug 2025 05:43AM UTC coverage: 45.72% (-0.02%) from 45.742%
16900099157

Pull #2016

github

web-flow
Merge c368ef6ae into eaf937e80
Pull Request #2016: Bump actions/checkout from 4 to 5

7586 of 17462 branches covered (43.44%)

22424 of 49046 relevant lines covered (45.72%)

51.77 hits per line

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

0.0
/tools/e133/E133Receiver.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
 * E133Receiver.cpp
17
 * Copyright (C) 2013 Simon Newton
18
 */
19

20
#include <ola/Callback.h>
21
#include <ola/Logging.h>
22
#include <ola/acn/ACNVectors.h>
23
#include <ola/e133/E133Receiver.h>
24
#include <ola/network/IPV4Address.h>
25
#include <ola/network/SocketAddress.h>
26

27
#include <memory>
28
#include <string>
29

30
#include "libs/acn/E133Inflator.h"
31
#include "libs/acn/E133StatusInflator.h"
32
#include "libs/acn/RDMInflator.h"
33
#include "libs/acn/RootInflator.h"
34
#include "libs/acn/UDPTransport.h"
35

36
namespace ola {
37
namespace e133 {
38

39
using ola::NewCallback;
40
using ola::network::IPV4Address;
41
using ola::network::IPV4SocketAddress;
42
using ola::rdm::RDMResponse;
43
using std::auto_ptr;
44
using std::string;
45

46

47
/**
48
 * Create a new E133Receiver.
49
 * @param socket the UDP socket to read from
50
 * @param status_callback the callback to run when status messages are
51
 * received.
52
 * @param rdm_callback the callback to run when RDM messages are received.
53
 */
54
E133Receiver::E133Receiver(ola::network::UDPSocket *socket,
×
55
                           StatusCallback *status_callback,
56
                           RDMCallback *rdm_callback)
×
57
    : m_udp_socket(socket),
×
58
      m_status_callback(status_callback),
×
59
      m_rdm_callback(rdm_callback),
×
60
      m_root_inflator(new ola::acn::RootInflator()),
×
61
      m_e133_inflator(new ola::acn::E133Inflator()),
×
62
      m_rdm_inflator(new ola::acn::RDMInflator()),
×
63
      m_e133_status_inflator(new ola::acn::E133StatusInflator()),
×
64
      m_incoming_udp_transport(
×
65
          new ola::acn::IncomingUDPTransport(
66
            m_udp_socket,
67
            m_root_inflator.get())) {
×
68
  m_root_inflator->AddInflator(m_e133_inflator.get());
×
69
  m_e133_inflator->AddInflator(m_rdm_inflator.get());
×
70
  m_e133_inflator->AddInflator(m_e133_status_inflator.get());
×
71

72
  m_rdm_inflator->SetRDMHandler(
×
73
      NewCallback(this, &E133Receiver::HandlePacket));
74
  m_e133_status_inflator->SetStatusHandler(
×
75
      NewCallback(this, &E133Receiver::HandleStatusMessage));
76

77
  m_udp_socket->SetOnData(
×
78
        NewCallback(m_incoming_udp_transport.get(),
79
                    &ola::acn::IncomingUDPTransport::Receive));
80
}
×
81

82

83
/**
84
 * Clean up.
85
 */
86
E133Receiver::~E133Receiver() {
×
87
}
×
88

89

90
/**
91
 * Handle a E1.33 Status Message.
92
 */
93
void E133Receiver::HandleStatusMessage(
×
94
    const ola::acn::TransportHeader *transport_header,
95
    const ola::acn::E133Header *e133_header,
96
    uint16_t status_code,
97
    const string &description) {
98
  if (m_status_callback) {
×
99
    m_status_callback->Run(
×
100
        E133StatusMessage(
×
101
          transport_header->Source().Host(), e133_header->Endpoint(),
×
102
          e133_header->Sequence(), status_code, description));
×
103
  }
104
}
×
105

106

107
/**
108
 * Handle an RDM packet
109
 */
110
void E133Receiver::HandlePacket(
×
111
    const ola::acn::TransportHeader *transport_header,
112
    const ola::acn::E133Header *e133_header,
113
    const string &raw_response) {
114
  if (!m_rdm_callback)
×
115
    return;
×
116

117
  OLA_INFO << "Got E1.33 data from " << transport_header->Source();
×
118

119
  // Attempt to unpack as a response for now.
120
  ola::rdm::RDMStatusCode status_code;
×
121
  const RDMResponse *response = RDMResponse::InflateFromData(
×
122
    reinterpret_cast<const uint8_t*>(raw_response.data()),
×
123
    raw_response.size(),
124
    &status_code);
125

126
  if (!response) {
×
127
    OLA_WARN << "Failed to unpack E1.33 RDM message, ignoring request.";
×
128
    return;
×
129
  }
130

131
  m_rdm_callback->Run(E133RDMMessage(
×
132
      transport_header->Source().Host(), e133_header->Endpoint(),
×
133
      e133_header->Sequence(), status_code, response));
×
134
}
135
}  // namespace e133
136
}  // 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