Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if an interface is listed multiple times in LIST_INTERFACES #1981

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions common/utils/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,18 +488,22 @@ void CapitalizeLabel(string *s) {
void CustomCapitalizeLabel(string *s) {
// Remember to update the Doxygen in include/ola/StringUtils.h too
static const char* const transforms[] = {
"asc",
"dhcp",
"dmx",
"dns",
"ip",
"ipv4", // Should really be IPv4 probably, but better than nothing
"ipv6", // Should really be IPv6 probably, but better than nothing
"json",
"led",
"mdmx", // City Theatrical, should really be mDMX, but better than nothing
"nsc",
"pdl",
"pid",
"rdm",
"uid",
"url",
NULL
};
const size_t size = s->size();
Expand Down
4 changes: 4 additions & 0 deletions include/ola/StringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,16 +490,20 @@ void CapitalizeLabel(std::string *s);
*
* @param s a string to transform.
* The following are capitalized:
* - asc
* - dhcp
* - dmx
* - dns
* - ip
* - ipv4
* - ipv6
* - json
* - led
* - mdmx
* - nsc
* - rdm
* - uid
* - url
*/
void CustomCapitalizeLabel(std::string *s);

Expand Down
7 changes: 4 additions & 3 deletions plugins/osc/README.developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ Before we begin you should do the following:
* Have an understanding of the map & vector classes from the STL
(http://www.sgi.com/tech/stl/ or http://www.cplusplus.com/reference/stl/).
* Know something about the
[OSC specification](http://opensoundcontrol.org/spec-1_0). You don't need
to know the wire format for the OSC messages. but you should at least
recognize OSC addresses and know the different data types in a message.
[OSC specification](https://opensoundcontrol.stanford.edu/spec-1_0.html).
You don't need to know the wire format for the OSC messages. but you
should at least recognize OSC addresses and know the different data types
in a message.
* Look at the [liblo site](http://liblo.sourceforge.net/) and read the
examples.
* Get familiar with the
Expand Down
2 changes: 1 addition & 1 deletion plugins/osc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OSC (Open Sound Control) Plugin
===============================

This plugin allows OLA to send and receive
[OSC](http://www.opensoundcontrol.org/) messages.
[OSC](https://opensoundcontrol.stanford.edu/) messages.

OLA uses the blob type for transporting DMX data.

Expand Down
8 changes: 8 additions & 0 deletions tools/rdm/TestDefinitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7225,9 +7225,11 @@
return

interfaces = []
count_by_interface = {}

for interface in fields['interfaces']:
interface_id = interface['interface_identifier']
count_by_interface[interface_id] = count_by_interface.get(interface_id, 0) + 1

Check failure on line 7232 in tools/rdm/TestDefinitions.py

View workflow job for this annotation

GitHub Actions / flake8

E501 line too long (84 > 80 characters)
if (interface_id < RDM_INTERFACE_INDEX_MIN or
interface_id > RDM_INTERFACE_INDEX_MAX):
self.AddWarning('Interface index %d is outside allowed range (%d to '
Expand All @@ -7242,6 +7244,12 @@
'interface %d' %
(interface['interface_hardware_type'], interface_id))

# Check for duplicate interfaces
for interface, count in count_by_interface.items():
if count > 1:
self.AddAdvisory('Interface %s listed %d times in list interfaces' %
(interface, count))

self.SetProperty(self.PROVIDES[0], interfaces)


Expand Down
Loading