Skip to content

Commit b92eaea

Browse files
committed
Merge branch '0.10' of https://github.com/openlightingproject/ola into master-resync
2 parents 3a6e0c6 + 451fd45 commit b92eaea

30 files changed

+1254
-107
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ protoc/ola_protoc.exe
195195
protoc/ola_protoc_plugin
196196
protoc/ola_protoc_plugin.exe
197197
python/examples/ola_rdm_set.py
198+
python/ola/ClientWrapperTest.sh
199+
python/ola/OlaClientTest.sh
198200
python/ola/PidStoreLocation.py
201+
python/ola/PidStoreTest.sh
199202
python/ola/Version.py
200203
python/ola/rpc/SimpleRpcControllerTest.sh
201204
slp/slp_client
@@ -227,6 +230,7 @@ tools/ola_trigger/ola_trigger
227230
tools/ola_trigger/ola_trigger.exe
228231
tools/ola_trigger/FileValidateTest.sh
229232
tools/rdm/DataLocation.py
233+
tools/rdm/ResponderTestTest.sh
230234
tools/rdmpro/rdmpro_sniffer
231235
tools/rdmpro/rdmpro_sniffer.exe
232236
tools/slp/slp_client

.travis-ci.sh

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ elif [[ $TASK = 'flake8' ]]; then
247247
travis_fold start "make_builtfiles"
248248
make builtfiles;
249249
travis_fold end "make_builtfiles"
250+
# if you update the flake8 command line, please also update README.developer to match
250251
flake8 --max-line-length 80 --exclude *_pb2.py,.git,__pycache --ignore E111,E114,E121,E127,E129,W504 data/rdm include/ola python scripts tools/ola_mon tools/rdm
251252
elif [[ $TASK = 'pychecker' ]]; then
252253
travis_fold start "autoreconf"

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ install:
312312
# Match the version of protobuf being installed via apt
313313
  - if [[ "$PROTOBUF" == "latest" ]]; then pip install --user protobuf; fi
314314
- if [[ "$PROTOBUF" != "latest" ]]; then pip install --user protobuf==3.1.0; fi
315+
# disable until can be added to all build variants
316+
#- pip install --user timeout-decorator
315317
# We need to use pip rather than apt on Xenial
316318
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user numpy; fi
317319
- if [ "$TASK" = "coverage" ]; then pip install --user cpp-coveralls; fi

AUTHORS

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Primary author:
66

77
Contributors:
88
Bastien Andrès, contributed to the dmx4linux plugin
9+
Bruce Lowekamp, various fixes and python updates
910
Carsten Presser, Karate USB plugin
1011
Dave Olsthoorn, working on a new web-ui
1112
E.S. Rosenberg, further work on ftdidmx plugin.
@@ -20,6 +21,7 @@ Contributors:
2021
Masaki Muranaka, various patches
2122
Nicolas, for the win32 port of libartnet
2223
Nicolas Bertrand, added ShowJockey DMX-U1 support
24+
Nils Van Zuijlen, typos and python lib small update
2325
Peter Newman, MilInst Plugin, Scanlime Fadecandy support and numerous fixes
2426
Ravindra Nath Kakarla, RDM Test Server (Google Summer of Code 2012)
2527
Rowan Maclachlan (hippy) for various changes

README.debian

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ in the top level directory to create a set of .debs
99

1010
If you're building from the git repo do the following:
1111

12-
$ autoreconf
12+
$ autoreconf -i
1313
$ ./configure
1414
$ make dist
1515
$ cp ola-0.X.Y.tar.gz /tmp

README.developer

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ flake8 can be installed following the instructions here:
241241

242242
Run it with:
243243
--max-line-length 80 --exclude *_pb2.py,.git,__pycache \
244-
--ignore E111,E121,E127,E129 data/rdm include/ola python scripts \
244+
--ignore E111,E114,E121,E127,E129,W504 data/rdm include/ola python scripts \
245245
tools/ola_mon tools/rdm
246246

247247
Build System

common/rdm/PidStoreTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ void PidStoreTest::testPidStoreDirectoryLoad() {
409409

410410
vector<const PidDescriptor*> all_pids;
411411
esta_store->AllPids(&all_pids);
412-
OLA_ASSERT_EQ(static_cast<size_t>(4), all_pids.size());
412+
OLA_ASSERT_EQ(static_cast<size_t>(6), all_pids.size());
413413

414414
// check manufacturer pids
415415
const PidStore *open_lighting_store =

common/rdm/testdata/pids/pids1.proto

+53
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,59 @@ pid {
3636
}
3737
get_sub_device_range: ROOT_DEVICE
3838
}
39+
pid {
40+
name: "DEVICE_INFO"
41+
value: 96
42+
get_request {
43+
}
44+
get_response {
45+
field {
46+
type: UINT8
47+
name: "protocol_major"
48+
}
49+
field {
50+
type: UINT8
51+
name: "protocol_minor"
52+
}
53+
field {
54+
type: UINT16
55+
name: "device_model"
56+
}
57+
field {
58+
type: UINT16
59+
name: "product_category"
60+
}
61+
field {
62+
type: UINT32
63+
name: "software_version"
64+
}
65+
field {
66+
type: UINT16
67+
name: "dmx_footprint"
68+
}
69+
field {
70+
type: UINT8
71+
name: "current_personality"
72+
}
73+
field {
74+
type: UINT8
75+
name: "personality_count"
76+
}
77+
field {
78+
type: UINT16
79+
name: "dmx_start_address"
80+
}
81+
field {
82+
type: UINT16
83+
name: "sub_device_count"
84+
}
85+
field {
86+
type: UINT8
87+
name: "sensor_count"
88+
}
89+
}
90+
get_sub_device_range: ROOT_OR_SUBDEVICE
91+
}
3992
manufacturer {
4093
manufacturer_id: 31344
4194
manufacturer_name: "Open Lighting"

common/rdm/testdata/pids/pids2.proto

+17
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ pid {
5353
}
5454
get_sub_device_range: ROOT_DEVICE
5555
}
56+
pid {
57+
name: "SUPPORTED_PARAMETERS"
58+
value: 80
59+
get_request {
60+
}
61+
get_response {
62+
field {
63+
type: GROUP
64+
name: "params"
65+
field {
66+
type: UINT16
67+
name: "param_id"
68+
}
69+
}
70+
}
71+
get_sub_device_range: ROOT_OR_SUBDEVICE
72+
}
5673
manufacturer {
5774
manufacturer_id: 161
5875
manufacturer_name: "Creative Lighting And Sound Systems Pty Ltd."

common/web/SchemaParserTest.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ void JsonSchemaParserTest::ReadTestCases(const string& filename,
159159
const string comment_prefix = "//";
160160
string line;
161161
while (getline(in, line)) {
162+
// erase trailing \r for source trees from windows docker host
163+
line.erase(line.find_last_not_of("\r")+1);
162164
if (line.compare(0, comment_prefix.size(), comment_prefix) == 0) {
163165
continue;
164166
} else if (line == "--------") {

configure.ac

+12-2
Original file line numberDiff line numberDiff line change
@@ -981,11 +981,21 @@ fi
981981
# the non-generated files $srcdir/python/ols/PidStore.py). To get the tests
982982
# to pass we symlink the files we need for the tests from the builddir to the
983983
# srcdir and set PYTHONPATH=${top_builddir}/python in data/rdm/Makefile.am
984-
AC_CONFIG_LINKS([python/ola/PidStore.py:python/ola/PidStore.py
984+
AC_CONFIG_LINKS([python/ola/__init__.py:python/ola/__init__.py
985+
python/ola/ClientWrapper.py:python/ola/ClientWrapper.py
985986
python/ola/MACAddress.py:python/ola/MACAddress.py
987+
python/ola/OlaClient.py:python/ola/OlaClient.py
988+
python/ola/PidStore.py:python/ola/PidStore.py
986989
python/ola/RDMConstants.py:python/ola/RDMConstants.py
990+
python/ola/TestUtils.py:python/ola/TestUtils.py
987991
python/ola/UID.py:python/ola/UID.py
988-
python/ola/__init__.py:python/ola/__init__.py])
992+
python/ola/rpc/__init__.py:python/ola/rpc/__init__.py
993+
python/ola/rpc/SimpleRpcController.py:python/ola/rpc/SimpleRpcController.py
994+
python/ola/rpc/StreamRpcChannel.py:python/ola/rpc/StreamRpcChannel.py
995+
tools/rdm/ExpectedResults.py:tools/rdm/ExpectedResults.py
996+
tools/rdm/TestCategory.py:tools/rdm/TestCategory.py
997+
tools/rdm/TestState.py:tools/rdm/TestState.py
998+
tools/rdm/TimingStats.py:tools/rdm/TimingStats.py])
989999

9901000
# Non-makefile generated files.
9911001
AC_CONFIG_FILES([include/ola/base/Version.h

python/ola/ClientWrapper.py

+45-11
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,48 @@ class _Event(object):
3636
"""An _Event represents a timer scheduled to expire in the future.
3737
3838
Args:
39-
time_ms: the number of ms before this event fires
39+
delay: datetime.timedelta or number of ms before this event fires
4040
callback: the callable to run
4141
"""
42-
def __init__(self, time_ms, callback):
42+
def __init__(self, delay, callback):
4343
self._run_at = (datetime.datetime.now() +
44-
datetime.timedelta(milliseconds=time_ms))
44+
(delay if isinstance(delay, datetime.timedelta)
45+
else datetime.timedelta(milliseconds=delay)))
4546
self._callback = callback
4647

47-
def __cmp__(self, other):
48-
return cmp(self._run_at, other._run_at)
48+
def __eq__(self, other):
49+
if not isinstance(other, self.__class__):
50+
return False
51+
return self._run_at == other._run_at and self._callback == other._callback
52+
53+
def __lt__(self, other):
54+
if not isinstance(other, self.__class__):
55+
return NotImplemented
56+
if self._run_at != other._run_at:
57+
return self._run_at < other._run_at
58+
return self._callback.__name__ < other._callback.__name__
59+
60+
# These 4 can be replaced with functools:total_ordering when 2.6 is dropped
61+
def __le__(self, other):
62+
if not isinstance(other, self.__class__):
63+
return NotImplemented
64+
return self < other or self == other
65+
66+
def __gt__(self, other):
67+
if not isinstance(other, self.__class__):
68+
return NotImplemented
69+
return not self <= other
70+
71+
def __ge__(self, other):
72+
if not isinstance(other, self.__class__):
73+
return NotImplemented
74+
return not self < other
75+
76+
def __ne__(self, other):
77+
return not self == other
78+
79+
def __hash__(self):
80+
return hash((self._run_at, self._callback))
4981

5082
def TimeLeft(self, now):
5183
"""Get the time remaining before this event triggers.
@@ -186,8 +218,10 @@ def Run(self):
186218
sleep_time = 1
187219
now = datetime.datetime.now()
188220
self._CheckTimeouts(now)
221+
if self._quit:
222+
sleep_time = 0
189223
if len(self._events):
190-
sleep_time = min(1.0, self._events[0].TimeLeft(now))
224+
sleep_time = min(sleep_time, self._events[0].TimeLeft(now))
191225

192226
i, o, e = select.select(self._read_descriptors.keys(),
193227
self._write_descriptors.keys(),
@@ -204,14 +238,14 @@ def Run(self):
204238
# descriptors).
205239
self.RemoveReadDescriptor(self._local_socket[0])
206240

207-
def AddEvent(self, time_in_ms, callback):
241+
def AddEvent(self, delay, callback):
208242
"""Schedule an event to run in the future.
209243
210244
Args:
211-
time_in_ms: An interval in milliseconds when this should run.
245+
delay: timedelta or number of ms before this event fires
212246
callback: The function to run.
213247
"""
214-
event = _Event(time_in_ms, callback)
248+
event = _Event(delay, callback)
215249
heapq.heappush(self._events, event)
216250

217251
def _CheckTimeouts(self, now):
@@ -256,9 +290,9 @@ def _DrainAndExecute(self):
256290

257291

258292
class ClientWrapper(object):
259-
def __init__(self):
293+
def __init__(self, socket=None):
260294
self._ss = SelectServer()
261-
self._client = OlaClient()
295+
self._client = OlaClient(socket)
262296
self._ss.AddReadDescriptor(self._client.GetSocket(),
263297
self._client.SocketReady)
264298

0 commit comments

Comments
 (0)