Skip to content

Commit

Permalink
Set the implied value for AbstractDeviceComponentState/ActivationStat… (
Browse files Browse the repository at this point in the history
Draegerwerk#288)

Set the implied value for AbstractDeviceComponentState/ActivationState
to "On"

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [x] I have updated the [changelog](../CHANGELOG.md) accordingly.
- [x] I have added tests to cover my changes.
  • Loading branch information
a-kleinf authored Nov 27, 2023
1 parent 7449ebe commit c84ba85
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- set the implied value for AbstractDeviceComponentState/ActivationState to "On"

### Added

- support for python version 3.12
Expand Down
2 changes: 1 addition & 1 deletion src/sdc11073/mdib/statecontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class AbstractDeviceComponentStateContainer(AbstractStateContainer):
PhysicalConnector = cp.SubElementProperty([domTag('PhysicalConnector')],
valueClass=pmtypes.PhysicalConnectorInfo) # optional

ActivationState = cp.NodeAttributeProperty('ActivationState') # pmtypes.ComponentActivation
ActivationState = cp.NodeAttributeProperty('ActivationState', impliedPyValue=pmtypes.ComponentActivation.ON)
OperatingHours = cp.IntegerAttributeProperty('OperatingHours') # optional, unsigned int
OperatingCycles = cp.IntegerAttributeProperty('OperatingCycles') # optional, unsigned int
_props = (
Expand Down
10 changes: 8 additions & 2 deletions tests/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ def test_multicast_listening(self):
for address in all_addresses:
unicast_sock.sendto(f'<bla>unicast{address} all </bla>'.encode('utf-8'),
(address, self.MY_MULTICAST_PORT))
time.sleep(0.5)
i = 0
while wrapped_obj.call_count < len(all_addresses) and i < 10:
i += 1
time.sleep(0.25)
self.assertGreaterEqual(wrapped_obj.call_count, len(all_addresses))

wsd_service_all.stop() # do not interfere with next instance
Expand All @@ -396,7 +399,10 @@ def test_multicast_listening(self):
for address in all_addresses:
unicast_sock.sendto(f'<bla>unicast{address} all </bla>'.encode('utf-8'),
(address, self.MY_MULTICAST_PORT))
time.sleep(0.5)
i = 0
while not wrapped_obj.call_count and i < 10:
i += 1
time.sleep(0.25)
wrapped_obj.assert_called()
finally:
unicast_sock.close()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_statecontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def verifyEqual(origin, copied):
sc = statecontainers.AbstractDeviceComponentStateContainer(nsmapper=self.nsmapper,
descriptorContainer=self.dc,
node=None)
self.assertEqual(sc.ActivationState, None)
self.assertEqual(sc.ActivationState, pmtypes.ComponentActivation.ON)
self.assertEqual(sc.OperatingHours, None)
self.assertEqual(sc.OperatingCycles, None)
self.assertEqual(sc.PhysicalConnector, None)
Expand Down

0 comments on commit c84ba85

Please sign in to comment.