Skip to content

Commit

Permalink
Merge pull request #1960 from peternewman/e1.33-cherry-pick
Browse files Browse the repository at this point in the history
E1.33 cherry pick vii
  • Loading branch information
peternewman authored Aug 27, 2024
2 parents d72f35e + 7826970 commit 1593985
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 104 deletions.
26 changes: 11 additions & 15 deletions include/ola/e133/E133StatusHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,20 @@
namespace ola {
namespace e133 {

using std::string;
using ola::acn::RPTStatusVector;
using ola::e133::E133StatusCode;
using ola::e133::E133ConnectStatusCode;
using ola::rdm::RDMStatusCode;
bool IntToStatusCode(uint16_t input, ola::e133::E133StatusCode *status_code);
std::string StatusCodeToString(ola::e133::E133StatusCode status_code);

bool IntToStatusCode(uint16_t input, E133StatusCode *status_code);
string StatusCodeToString(E133StatusCode status_code);

bool IntToConnectStatusCode(uint16_t input,
E133ConnectStatusCode *connect_status_code);
string ConnectStatusCodeToString(E133ConnectStatusCode connect_status_code);
bool IntToConnectStatusCode(
uint16_t input,
ola::e133::E133ConnectStatusCode *connect_status_code);
std::string ConnectStatusCodeToString(
E133ConnectStatusCode connect_status_code);

bool IntToRPTStatusCode(uint16_t input,
RPTStatusVector *rpt_status_code);
string RPTStatusCodeToString(RPTStatusVector rpt_status_code);
bool RPTStatusCodeToRDMStatusCode(RPTStatusVector rpt_status_code,
RDMStatusCode *rdm_status_code);
ola::acn::RPTStatusVector *rpt_status_code);
std::string RPTStatusCodeToString(ola::acn::RPTStatusVector rpt_status_code);
bool RPTStatusCodeToRDMStatusCode(ola::acn::RPTStatusVector rpt_status_code,
ola::rdm::RDMStatusCode *rdm_status_code);
} // namespace e133
} // namespace ola
#endif // INCLUDE_OLA_E133_E133STATUSHELPER_H_
46 changes: 24 additions & 22 deletions include/ola/rdm/RDMEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,28 +159,6 @@ typedef enum {
PID_PRESET_MERGEMODE = 0x1043,
PID_POWER_ON_SELF_TEST = 0x1044,

// Draft E1.33 PIDs - DO NOT USE
PID_ENDPOINT_LIST = 0x7FE0,
PID_ENDPOINT_TO_UNIVERSE = 0x7FE1,
PID_RDM_TRAFFIC_ENABLE = 0x7FE2,
PID_ENDPOINT_MODE = 0x7FE3,
PID_ENDPOINT_LABEL = 0x7FE4,
PID_DISCOVERY_STATE = 0x7FE5,
PID_ENDPOINT_TIMING = 0x7FE6,
PID_ENDPOINT_TIMING_DESCRIPTION = 0x7FE7,
PID_BINDING_CONTROL_FIELDS = 0x7FE8,
PID_ENDPOINT_IDENTIFY = 0x7FE9,
PID_BACKGROUND_DISCOVERY = 0x7FEA,
PID_ENDPOINT_DEVICE_LIST_CHANGE = 0x7FEB,
PID_ENDPOINT_DEVICES = 0x7FEC,
PID_TCP_COMMS_STATUS = 0x7FED,
PID_ENDPOINT_LIST_CHANGE = 0x7FEE,
PID_BACKGROUND_QUEUED_STATUS_POLICY = 0x7FD0,
PID_BACKGROUND_QUEUED_STATUS_POLICY_DESCRIPTION = 0x7FD1,
PID_BACKGROUND_STATUS_TYPE = 0x7FD2,
PID_QUEUED_STATUS_ENDPOINT_COLLECTION = 0x7FD3,
PID_QUEUED_STATUS_UID_COLLECTION = 0x7FD4,

// E1.37-2 PIDs
PID_LIST_INTERFACES = 0x0700,
PID_INTERFACE_LABEL = 0x0701,
Expand All @@ -196,6 +174,30 @@ typedef enum {
PID_DNS_NAME_SERVER = 0x070B,
PID_DNS_HOSTNAME = 0x070C,
PID_DNS_DOMAIN_NAME = 0x070D,

// E1.33 PIDs
PID_COMPONENT_SCOPE = 0x0800,
PID_SEARCH_DOMAIN = 0x0801,
PID_TCP_COMMS_STATUS = 0x0802,
PID_BROKER_STATUS = 0x0803,

// E1.37-7 PIDs
PID_ENDPOINT_LIST = 0x0900,
PID_ENDPOINT_LIST_CHANGE = 0x0901,
PID_IDENTIFY_ENDPOINT = 0x0902,
PID_ENDPOINT_TO_UNIVERSE = 0x0903,
PID_ENDPOINT_MODE = 0x0904,
PID_ENDPOINT_LABEL = 0x0905,
PID_RDM_TRAFFIC_ENABLE = 0x0906,
PID_DISCOVERY_STATE = 0x0907,
PID_BACKGROUND_DISCOVERY = 0x908,
PID_ENDPOINT_TIMING = 0x0909,
PID_ENDPOINT_TIMING_DESCRIPTION = 0x090A,
PID_ENDPOINT_RESPONDERS = 0x090B,
PID_ENDPOINT_RESPONDER_LIST_CHANGE = 0x090C,
PID_BINDING_CONTROL_FIELDS = 0x090D,
PID_BACKGROUND_QUEUED_STATUS_POLICY = 0x090E,
PID_BACKGROUND_QUEUED_STATUS_POLICY_DESCRIPTION = 0x090F,
} rdm_pid;


Expand Down
12 changes: 11 additions & 1 deletion include/olad/PluginAdaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <ola/ExportMap.h>
#include <ola/base/Macro.h>
#include <ola/io/SelectServerInterface.h>
#include <ola/rdm/UID.h>
#include <olad/OlaServer.h>

#include <string>
Expand All @@ -48,13 +49,15 @@ class PluginAdaptor: public ola::io::SelectServerInterface {
* @param preferences_factory pointer to the PreferencesFactory object
* @param port_broker pointer to the PortBroker object
* @param instance_name the instance name of this OlaServer
* @param uid the default ola::rdm::UID of this OlaServer
*/
PluginAdaptor(class DeviceManager *device_manager,
ola::io::SelectServerInterface *select_server,
ExportMap *export_map,
class PreferencesFactory *preferences_factory,
class PortBrokerInterface *port_broker,
const std::string *instance_name);
const std::string *instance_name,
const ola::rdm::UID *default_uid);

// The following methods are part of the SelectServerInterface
bool AddReadDescriptor(ola::io::ReadFileDescriptor *descriptor);
Expand Down Expand Up @@ -98,6 +101,12 @@ class PluginAdaptor: public ola::io::SelectServerInterface {
*/
const std::string InstanceName() const;

/**
* @brief Return the default UID for the OLA server
* @return an ola::rdm::UID which is the UID for the server
*/
const ola::rdm::UID DefaultUID() const;

ExportMap *GetExportMap() const {
return m_export_map;
}
Expand Down Expand Up @@ -134,6 +143,7 @@ class PluginAdaptor: public ola::io::SelectServerInterface {
class PreferencesFactory *m_preferences_factory;
class PortBrokerInterface *m_port_broker;
const std::string *m_instance_name;
const ola::rdm::UID *m_default_uid;

DISALLOW_COPY_AND_ASSIGN(PluginAdaptor);
};
Expand Down
4 changes: 4 additions & 0 deletions libs/acn/E133StatusHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ namespace ola {
namespace e133 {

using std::string;
using ola::acn::RPTStatusVector;
using ola::e133::E133StatusCode;
using ola::e133::E133ConnectStatusCode;
using ola::rdm::RDMStatusCode;

/**
* Verify that the int is a valid E1.33 Status Code.
Expand Down
5 changes: 5 additions & 0 deletions libs/acn/LLRPProbeReplyPDU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ void LLRPProbeReplyPDU::PrependPDU(ola::io::IOStack *stack,
const UID &target_uid,
const MACAddress &hardware_address,
const LLRPComponentType type) {
if (!stack) {
OLA_WARN << "LLRPProbeReplyPDU::PrependPDU: missing stack";
return;
}

llrp_probe_reply_pdu_data data;
target_uid.Pack(data.target_uid, sizeof(data.target_uid));
hardware_address.Pack(data.hardware_address, sizeof(data.hardware_address));
Expand Down
8 changes: 8 additions & 0 deletions libs/acn/LLRPProbeReplyPDUTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ void LLRPProbeReplyPDUTest::testPrepend() {
0xff
};
OLA_ASSERT_DATA_EQUALS(expected_data, sizeof(expected_data), buffer, length);

// test null stack
LLRPProbeReplyPDU::PrependPDU(
NULL,
target_uid,
hardware_address,
LLRPProbeReplyPDU::LLRP_COMPONENT_TYPE_NON_RDMNET);

delete[] buffer;
}
} // namespace acn
Expand Down
15 changes: 10 additions & 5 deletions libs/acn/LLRPProbeRequestInflator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,18 @@ bool LLRPProbeRequestInflator::HandlePDUData(uint32_t vector,
OLA_DEBUG << "Probe from " << UID(pdu_data.lower_uid) << " to "
<< UID(pdu_data.upper_uid);

LLRPProbeRequest request(UID(pdu_data.lower_uid), UID(pdu_data.upper_uid));
request.client_tcp_connection_inactive =
(pdu_data.filter &
LLRPProbeRequestPDU::FILTER_CLIENT_TCP_CONNECTION_INACTIVE);
request.brokers_only = (pdu_data.filter &
LLRPProbeRequestPDU::FILTER_BROKERS_ONLY);
unsigned int known_uids_used_size = known_uids_size;
request.known_uids = UIDSet(pdu_data.known_uids, &known_uids_used_size);

if (m_llrp_probe_request_handler.get()) {
m_llrp_probe_request_handler->Run(&headers,
UID(pdu_data.lower_uid),
UID(pdu_data.upper_uid)
// TODO(Peter): Should we add the filter and known UIDs to the callback too?
//, UIDSet()
);
request);
} else {
OLA_WARN << "No LLRP Probe Request handler defined!";
}
Expand Down
20 changes: 15 additions & 5 deletions libs/acn/LLRPProbeRequestInflator.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,23 @@ class LLRPProbeRequestInflator: public BaseInflator {
friend class LLRPProbeRequestInflatorTest;

public:
struct LLRPProbeRequest {
LLRPProbeRequest(const ola::rdm::UID &_lower, const ola::rdm::UID &_upper)
: lower(_lower),
upper(_upper) {
}
ola::rdm::UID lower;
ola::rdm::UID upper;
bool client_tcp_connection_inactive;
bool brokers_only;
ola::rdm::UIDSet known_uids;
};


// These are pointers so the callers don't have to pull in all the headers.
typedef ola::Callback3<void,
typedef ola::Callback2<void,
const HeaderSet*, // the HeaderSet
const ola::rdm::UID&, // lower UID
const ola::rdm::UID& // upper UID
// TODO(Peter): Should we add the filter and known UIDs to the callback too?
//, const ola::rdm::UIDSet, // known UIDs
const LLRPProbeRequest& // Probe Request Data
> LLRPProbeRequestHandler;

LLRPProbeRequestInflator();
Expand Down
5 changes: 5 additions & 0 deletions libs/acn/LLRPProbeRequestPDU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ void LLRPProbeRequestPDU::PrependPDU(ola::io::IOStack *stack,
bool client_tcp_connection_inactive,
bool brokers_only,
const ola::rdm::UIDSet &known_uids) {
if (!stack) {
OLA_WARN << "LLRPProbeRequestPDU::PrependPDU: missing stack";
return;
}

llrp_probe_request_pdu_data data;
lower_uid.Pack(data.lower_uid, sizeof(data.lower_uid));
upper_uid.Pack(data.upper_uid, sizeof(data.upper_uid));
Expand Down
9 changes: 9 additions & 0 deletions libs/acn/LLRPProbeRequestPDUTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ void LLRPProbeRequestPDUTest::testPrepend() {
0x56, 0x78, 0, 0, 0, 2,
};
OLA_ASSERT_DATA_EQUALS(expected_data, sizeof(expected_data), buffer, length);

// test null stack
LLRPProbeRequestPDU::PrependPDU(NULL,
UID(0x0000, 0x00000000),
UID(0xffff, 0xffffffff),
false,
false,
known_uids);

delete[] buffer;
}
} // namespace acn
Expand Down
2 changes: 1 addition & 1 deletion olad/OlaServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ bool OlaServer::Init() {
auto_ptr<PluginAdaptor> plugin_adaptor(
new PluginAdaptor(device_manager.get(), m_ss, m_export_map,
m_preferences_factory, port_broker.get(),
&m_instance_name));
&m_instance_name, &m_default_uid));

auto_ptr<PluginManager> plugin_manager(
new PluginManager(m_plugin_loaders, plugin_adaptor.get()));
Expand Down
4 changes: 2 additions & 2 deletions olad/PluginManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class MockLoader: public ola::PluginLoader {
*/
void PluginManagerTest::testPluginManager() {
ola::MemoryPreferencesFactory factory;
ola::PluginAdaptor adaptor(NULL, NULL, NULL, &factory, NULL, NULL);
ola::PluginAdaptor adaptor(NULL, NULL, NULL, &factory, NULL, NULL, NULL);

TestMockPlugin plugin1(&adaptor, ola::OLA_PLUGIN_ARTNET);
TestMockPlugin plugin2(&adaptor, ola::OLA_PLUGIN_ESPNET, false);
Expand Down Expand Up @@ -133,7 +133,7 @@ void PluginManagerTest::testPluginManager() {
*/
void PluginManagerTest::testConflictingPlugins() {
ola::MemoryPreferencesFactory factory;
ola::PluginAdaptor adaptor(NULL, NULL, NULL, &factory, NULL, NULL);
ola::PluginAdaptor adaptor(NULL, NULL, NULL, &factory, NULL, NULL, NULL);

set<ola::ola_plugin_id> conflict_set1, conflict_set2, conflict_set3;
conflict_set1.insert(ola::OLA_PLUGIN_ARTNET);
Expand Down
14 changes: 12 additions & 2 deletions olad/plugin_api/PluginAdaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ PluginAdaptor::PluginAdaptor(DeviceManager *device_manager,
ExportMap *export_map,
PreferencesFactory *preferences_factory,
PortBrokerInterface *port_broker,
const std::string *instance_name):
const std::string *instance_name,
const ola::rdm::UID *default_uid):
m_device_manager(device_manager),
m_ss(select_server),
m_export_map(export_map),
m_preferences_factory(preferences_factory),
m_port_broker(port_broker),
m_instance_name(instance_name) {
m_instance_name(instance_name),
m_default_uid(default_uid) {
}

bool PluginAdaptor::AddReadDescriptor(
Expand Down Expand Up @@ -136,4 +138,12 @@ const std::string PluginAdaptor::InstanceName() const {
return "";
}
}

const ola::rdm::UID PluginAdaptor::DefaultUID() const {
if (m_default_uid) {
return *m_default_uid;
} else {
return ola::rdm::UID(0, 0);
}
}
} // namespace ola
2 changes: 1 addition & 1 deletion olad/plugin_api/PortTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void PortTest::testInputPortPriorities() {
MockDevice device(NULL, "foo");
TimeStamp time_stamp;
MockSelectServer ss(&time_stamp);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL, NULL);
// This port operates in static priority mode
TestMockInputPort input_port(&device, 1, &plugin_adaptor);
port_manager.PatchPort(&input_port, universe_id);
Expand Down
6 changes: 3 additions & 3 deletions olad/plugin_api/UniverseTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void UniverseTest::testReceiveDmx() {
ola::PortManager port_manager(m_store, &broker);
TimeStamp time_stamp;
MockSelectServer ss(&time_stamp);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL, NULL);

MockDevice device(NULL, "foo");
TestMockInputPort port(&device, 1, &plugin_adaptor); // input port
Expand Down Expand Up @@ -366,7 +366,7 @@ void UniverseTest::testLtpMerging() {

TimeStamp time_stamp;
MockSelectServer ss(&time_stamp);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL, NULL);
MockDevice device(NULL, "foo");
MockDevice device2(NULL, "bar");
TestMockInputPort port(&device, 1, &plugin_adaptor); // input port
Expand Down Expand Up @@ -446,7 +446,7 @@ void UniverseTest::testHtpMerging() {

TimeStamp time_stamp;
MockSelectServer ss(&time_stamp);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL);
ola::PluginAdaptor plugin_adaptor(NULL, &ss, NULL, NULL, NULL, NULL, NULL);
MockDevice device(NULL, "foo");
MockDevice device2(NULL, "bar");
TestMockInputPort port(&device, 1, &plugin_adaptor); // input port
Expand Down
2 changes: 1 addition & 1 deletion plugins/spi/SPIOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class SPIOutput: public ola::rdm::DiscoverableRDMControllerInterface {

private:
/**
* The RDM Operations for the MovingLightResponder.
* The RDM Operations for the SPIOutput.
*/
class RDMOps : public ola::rdm::ResponderOps<SPIOutput> {
public:
Expand Down
4 changes: 2 additions & 2 deletions python/ola/PidStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ def LoadFile(self, pid_file_name, validate, override=False):
if validate:
if ((pid_pb.value >= RDMConstants.RDM_MANUFACTURER_PID_MIN) and
(pid_pb.value <= RDMConstants.RDM_MANUFACTURER_PID_MAX)):
raise InvalidPidFormat('%0x04hx between %0x04hx and %0x04hx in %s' %
raise InvalidPidFormat('0x%04hx between 0x%04hx and 0x%04hx in %s' %
(pid_pb.value,
RDMConstants.RDM_MANUFACTURER_PID_MIN,
RDMConstants.RDM_MANUFACTURER_PID_MAX,
Expand Down Expand Up @@ -1103,7 +1103,7 @@ def LoadFile(self, pid_file_name, validate, override=False):
if ((pid_pb.value < RDMConstants.RDM_MANUFACTURER_PID_MIN) or
(pid_pb.value > RDMConstants.RDM_MANUFACTURER_PID_MAX)):
raise InvalidPidFormat(
'Manufacturer pid 0x%04hx not between %0x04hx and %0x04hx' %
'Manufacturer pid 0x%04hx not between 0x%04hx and 0x%04hx' %
(pid_pb.value,
RDMConstants.RDM_MANUFACTURER_PID_MIN,
RDMConstants.RDM_MANUFACTURER_PID_MAX))
Expand Down
2 changes: 1 addition & 1 deletion tools/e133/E133Endpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ E133Endpoint::E133Endpoint(DiscoverableRDMControllerInterface *controller,
m_is_physical(properties.is_physical),
m_universe(UNPATCHED_UNIVERSE),
m_endpoint_label(""),
m_device_list_change(0),
m_responder_list_change(0),
m_controller(controller) {
}

Expand Down
Loading

0 comments on commit 1593985

Please sign in to comment.