Skip to content

Commit

Permalink
There's a bug with abortPDU not being catched... will check
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Tremblay <christian.tremblay@servisys.com>
  • Loading branch information
ChristianTremblay committed Feb 15, 2016
1 parent a974699 commit e9cd844
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
15 changes: 9 additions & 6 deletions BAC0/core/app/ScriptApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,20 @@ def confirmation(self, apdu):
evt.wait()
#raise UnknownPropertyError('Cannot find property on point')

else:
raise APDUError('%s' % self.error)

elif isinstance(apdu, AbortPDU):
print('Abort PDU : %s' % AbortPDU.apduAbortRejectReason)
evt = Event()
self.ResponseQueue.put((None, evt))
evt.wait()
print('Abort PDU : %s' % AbortPDU.apduAbortRejectReason)
if AbortPDU.apduAbortRejectReason == 'segmentationNotSupported':
print('Abort PDU : %s' % AbortPDU.apduAbortRejectReason)
evt = Event()
self.ResponseQueue.put(('', evt))
evt.wait()
raise SegmentationNotSupported('Segmentation problem with device')
else:
print('Abort PDU : %s' % AbortPDU.apduAbortRejectReason)
evt = Event()
self.ResponseQueue.put((None, evt))
evt.wait()
raise NoResponseFromController('Abort PDU received')

if isinstance(apdu, SimpleAckPDU):
Expand Down
5 changes: 5 additions & 0 deletions BAC0/core/devices/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ def _buildPointList(self):
if self.properties.pollDelay > 0:
self.poll()
except SegmentationNotSupported as error:
print('Segmentation not supported')
self.segmentation_supported = False
self.new_state(DeviceDisconnected)
except NoResponseFromController as error:
print('Segmentation not supported')
self.segmentation_supported = False
self.new_state(DeviceDisconnected)

Expand Down
7 changes: 5 additions & 2 deletions BAC0/core/devices/mixins/read_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ def read_multiple(self, points_list, *, points_per_request=25, discover_request=
(self.properties.address, ''.join(request)))

val = self.properties.network.readMultiple(request)
if val == None:
self.properties.segmentation_supported = False
val = self.read_multiple(request)
except KeyError as error:
raise Exception('Unknown point name : %s' % error)

except SegmentationNotSupported as error:
self.properties.segmentation_supported = False
raise

val = self.properties.network.readMultiple(request)
print('Seg not supported')
# Save each value to history of each point
else:
for points_info in self._batches(val, info_length):
Expand Down

0 comments on commit e9cd844

Please sign in to comment.