Skip to content

Commit

Permalink
Update to the standardised PID names for E1.37-7
Browse files Browse the repository at this point in the history
(cherry picked from commit 672ca47)
  • Loading branch information
peternewman committed Apr 21, 2024
1 parent 9a89af1 commit 9de59d7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion tools/e133/E133Endpoint.cpp
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
14 changes: 7 additions & 7 deletions tools/e133/E133Endpoint.h
Expand Up @@ -81,11 +81,11 @@ class E133EndpointInterface

// ENDPOINT_TIMING_DESCRIPTION

// ENDPOINT_DEVICE_LIST_CHANGE
virtual uint32_t device_list_change() const = 0;
// ENDPOINT_RESPONDER_LIST_CHANGE
virtual uint32_t responder_list_change() const = 0;

// ENDPOINT_DEVICES
virtual void EndpointDevices(UIDSet *uids) const = 0;
// ENDPOINT_RESPONDERS
virtual void EndpointResponders(UIDSet *uids) const = 0;

// BINDING_AND_CONTROL_FIELDS

Expand Down Expand Up @@ -141,8 +141,8 @@ class E133Endpoint: public E133EndpointInterface {
m_endpoint_label = endpoint_label;
}

uint32_t device_list_change() const { return m_device_list_change; }
void EndpointDevices(UIDSet *uids) const { *uids = m_uids; }
uint32_t responder_list_change() const { return m_responder_list_change; }
void EndpointResponders(UIDSet *uids) const { *uids = m_uids; }

virtual void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
virtual void RunIncrementalDiscovery(
Expand All @@ -156,7 +156,7 @@ class E133Endpoint: public E133EndpointInterface {
const bool m_is_physical;
uint16_t m_universe;
string m_endpoint_label;
uint32_t m_device_list_change;
uint32_t m_responder_list_change;
UIDSet m_uids;
DiscoverableRDMControllerInterface *m_controller;
};
Expand Down
58 changes: 29 additions & 29 deletions tools/e133/ManagementEndpoint.cpp
Expand Up @@ -59,9 +59,9 @@ const ola::rdm::ResponderOps<ManagementEndpoint>::ParamHandler
{ ola::rdm::PID_ENDPOINT_LIST_CHANGE,
&ManagementEndpoint::GetEndpointListChange,
NULL},
{ ola::rdm::PID_ENDPOINT_IDENTIFY,
&ManagementEndpoint::GetEndpointIdentify,
&ManagementEndpoint::SetEndpointIdentify},
{ ola::rdm::PID_IDENTIFY_ENDPOINT,
&ManagementEndpoint::GetIdentifyEndpoint,
&ManagementEndpoint::SetIdentifyEndpoint},
{ ola::rdm::PID_ENDPOINT_TO_UNIVERSE,
&ManagementEndpoint::GetEndpointToUniverse,
&ManagementEndpoint::SetEndpointToUniverse},
Expand All @@ -76,11 +76,11 @@ const ola::rdm::ResponderOps<ManagementEndpoint>::ParamHandler
// PID_BACKGROUND_DISCOVERY
// PID_ENDPOINT_TIMING
// PID_ENDPOINT_TIMING_DESCRIPTION
{ ola::rdm::PID_ENDPOINT_LIST_CHANGE,
&ManagementEndpoint::GetEndpointDeviceListChange,
{ ola::rdm::PID_ENDPOINT_RESPONDER_LIST_CHANGE,
&ManagementEndpoint::GetEndpointResponderListChange,
NULL},
{ ola::rdm::PID_ENDPOINT_DEVICES,
&ManagementEndpoint::GetEndpointDevices,
{ ola::rdm::PID_ENDPOINT_RESPONDERS,
&ManagementEndpoint::GetEndpointResponders,
NULL},
// PID_BINDING_AND_CONTROL_FIELDS
{ ola::rdm::PID_TCP_COMMS_STATUS,
Expand Down Expand Up @@ -222,9 +222,9 @@ RDMResponse *ManagementEndpoint::GetEndpointListChange(


/**
* Handle PID_ENDPOINT_IDENTIFY
* Handle PID_IDENTIFY_ENDPOINT
*/
RDMResponse *ManagementEndpoint::GetEndpointIdentify(
RDMResponse *ManagementEndpoint::GetIdentifyEndpoint(
const RDMRequest *request) {
uint16_t endpoint_id;
if (!ResponderHelper::ExtractUInt16(request, &endpoint_id)) {
Expand All @@ -243,41 +243,41 @@ RDMResponse *ManagementEndpoint::GetEndpointIdentify(
uint16_t endpoint_number;
uint8_t identify_mode;
});
IdentifyEndpointParamData endpoint_identify_message = {
IdentifyEndpointParamData identify_endpoint_message = {
HostToNetwork(endpoint_id), endpoint->identify_mode()
};

return GetResponseFromData(
request,
reinterpret_cast<uint8_t*>(&endpoint_identify_message),
sizeof(endpoint_identify_message));
reinterpret_cast<uint8_t*>(&identify_endpoint_message),
sizeof(identify_endpoint_message));
}

RDMResponse *ManagementEndpoint::SetEndpointIdentify(
RDMResponse *ManagementEndpoint::SetIdentifyEndpoint(
const RDMRequest *request) {
PACK(
struct IdentifyEndpointParamData {
uint16_t endpoint_number;
uint8_t identify_mode;
});
IdentifyEndpointParamData endpoint_identify_message;
IdentifyEndpointParamData identify_endpoint_message;

if (request->ParamDataSize() != sizeof(endpoint_identify_message)) {
if (request->ParamDataSize() != sizeof(identify_endpoint_message)) {
return NackWithReason(request, NR_FORMAT_ERROR);
}

memcpy(reinterpret_cast<uint8_t*>(&endpoint_identify_message),
memcpy(reinterpret_cast<uint8_t*>(&identify_endpoint_message),
request->ParamData(),
sizeof(endpoint_identify_message));
sizeof(identify_endpoint_message));

E133Endpoint *endpoint = m_endpoint_manager->GetEndpoint(
ola::network::NetworkToHost(endpoint_identify_message.endpoint_number));
ola::network::NetworkToHost(identify_endpoint_message.endpoint_number));
// endpoint not found
if (!endpoint) {
return NackWithReason(request, ola::rdm::NR_ENDPOINT_NUMBER_INVALID);
}

endpoint->set_identify_mode(endpoint_identify_message.identify_mode);
endpoint->set_identify_mode(identify_endpoint_message.identify_mode);
return GetResponseFromData(request, NULL, 0);
}

Expand Down Expand Up @@ -324,9 +324,9 @@ RDMResponse *ManagementEndpoint::SetEndpointLabel(const RDMRequest *request) {
}

/**
* Handle PID_ENDPOINT_DEVICE_LIST_CHANGE
* Handle PID_ENDPOINT_RESPONDER_LIST_CHANGE
*/
RDMResponse *ManagementEndpoint::GetEndpointDeviceListChange(
RDMResponse *ManagementEndpoint::GetEndpointResponderListChange(
const RDMRequest *request) {
uint16_t endpoint_id;
if (!ResponderHelper::ExtractUInt16(request, &endpoint_id)) {
Expand All @@ -340,17 +340,17 @@ RDMResponse *ManagementEndpoint::GetEndpointDeviceListChange(
return NackWithReason(request, ola::rdm::NR_ENDPOINT_NUMBER_INVALID);
}

uint32_t list_change_id = HostToNetwork(endpoint->device_list_change());
uint32_t list_change_id = HostToNetwork(endpoint->responder_list_change());
return GetResponseFromData(
request,
reinterpret_cast<uint8_t*>(&list_change_id),
sizeof(list_change_id));
}

/**
* Handle PID_ENDPOINT_DEVICES
* Handle PID_ENDPOINT_RESPONDERS
*/
RDMResponse *ManagementEndpoint::GetEndpointDevices(const RDMRequest *request) {
RDMResponse *ManagementEndpoint::GetEndpointResponders(const RDMRequest *request) {

Check failure on line 353 in tools/e133/ManagementEndpoint.cpp

View workflow job for this annotation

GitHub Actions / cpplint

Lines should be <= 80 characters long [whitespace/line_length] [2]
uint16_t endpoint_id;
if (!ResponderHelper::ExtractUInt16(request, &endpoint_id)) {
return NackWithReason(request, NR_FORMAT_ERROR);
Expand All @@ -369,20 +369,20 @@ RDMResponse *ManagementEndpoint::GetEndpointDevices(const RDMRequest *request) {
}

UIDSet uids;
uint32_t list_change_id = HostToNetwork(endpoint->device_list_change());
endpoint->EndpointDevices(&uids);
uint32_t list_change_id = HostToNetwork(endpoint->responder_list_change());
endpoint->EndpointResponders(&uids);

struct DeviceListParamData {
struct ResponderListParamData {
uint16_t endpoint;
uint32_t list_change;
uint8_t data[0];
};

// TODO(simon): fix this - we can overflow an RDM packet if there are too
// many devices!
// many responders!
unsigned int param_data_size = 2 + 4 + uids.Size() * UID::UID_SIZE;
uint8_t *raw_data = new uint8_t[param_data_size];
DeviceListParamData *param_data = reinterpret_cast<DeviceListParamData*>(
ResponderListParamData *param_data = reinterpret_cast<ResponderListParamData*>(

Check failure on line 385 in tools/e133/ManagementEndpoint.cpp

View workflow job for this annotation

GitHub Actions / cpplint

Lines should be <= 80 characters long [whitespace/line_length] [2]
raw_data);

// TODO(simon): fix this to track changes.
Expand Down
12 changes: 6 additions & 6 deletions tools/e133/ManagementEndpoint.h
Expand Up @@ -30,7 +30,7 @@ using ola::rdm::RDMResponse;
using ola::rdm::RDMCallback;

/**
* The ManagementEndpoint handles RDMCommands directed at this E1.33 device. It
* The ManagementEndpoint handles RDMCommands directed at this E1.33 Component. It
* can also pass through commands to another controller if there is one
* supplied.
*/
Expand All @@ -50,7 +50,7 @@ class ManagementEndpoint: public E133Endpoint {

private:
/**
* The RDM Operations for the MovingLightResponder.
* The RDM Operations for the ManagementEndpoint.
*/
class RDMOps : public ola::rdm::ResponderOps<ManagementEndpoint> {
public:
Expand All @@ -74,16 +74,16 @@ class ManagementEndpoint: public E133Endpoint {
// RDM PID handlers.
RDMResponse *GetEndpointList(const RDMRequest *request);
RDMResponse *GetEndpointListChange(const RDMRequest *request);
RDMResponse *GetEndpointIdentify(const RDMRequest *request);
RDMResponse *SetEndpointIdentify(const RDMRequest *request);
RDMResponse *GetIdentifyEndpoint(const RDMRequest *request);
RDMResponse *SetIdentifyEndpoint(const RDMRequest *request);
RDMResponse *GetEndpointToUniverse(const RDMRequest *request);
RDMResponse *SetEndpointToUniverse(const RDMRequest *request);
RDMResponse *GetEndpointMode(const RDMRequest *request);
RDMResponse *SetEndpointMode(const RDMRequest *request);
RDMResponse *GetEndpointLabel(const RDMRequest *request);
RDMResponse *SetEndpointLabel(const RDMRequest *request);
RDMResponse *GetEndpointDeviceListChange(const RDMRequest *request);
RDMResponse *GetEndpointDevices(const RDMRequest *request);
RDMResponse *GetEndpointResponderListChange(const RDMRequest *request);
RDMResponse *GetEndpointResponders(const RDMRequest *request);
RDMResponse *GetTCPCommsStatus(const RDMRequest *request);
RDMResponse *SetTCPCommsStatus(const RDMRequest *request);

Expand Down

0 comments on commit 9de59d7

Please sign in to comment.