Event types#
pynetdicom uses an event-handler system to give the user access to the
data exchanged between different services within an AE as well as the PDUs
and data sent between the local and peer AEs. Two different types of events
are used: notification events and intervention events. Events are imported
using from pynetdicom import evt
Notification Events#
Notification events are those events where bound event handlers don’t need to return or yield anything (i.e. the user is notified some event has occurred). Each notification event can have multiple handlers bound to it and any exceptions raised by the handlers are caught and the exception message logged instead. The table below lists the available notification events.
Event |
Description |
---|---|
Association aborted |
|
Association accepted |
|
ACSE received a primitive from the DUL service provider |
|
ACSE sent a primitive to the DUL service provider |
|
Connection with remote closed |
|
Connection with remote opened |
|
Data received from the peer AE |
|
Data sent to the peer AE |
|
DIMSE service received and decoded a message |
|
DIMSE service encoded and sent a message |
|
Association established |
|
State machine transitioning |
|
PDU received from the peer AE |
|
PDU sent to the peer AE |
|
Association rejected |
|
Association released |
|
Association requested |
By default a number of notification handlers are bound for logging purposes. If you wish to remove these then you can do the following before creating any associations:
from pynetdicom import _config
# Don't bind any of the default notification handlers
_config.LOG_HANDLER_LEVEL = 'none'
Intervention Events#
Intervention events are those events where the bound event handler must return
or yield certain expected values so that pynetdicom can complete an action
(i.e. user intervention is required).
Each intervention event has only a single handler bound to it at all times.
If the user hasn’t bound their own handler then a default will be
used, which usually returns a negative response (i.e. service request failed,
or extended negotiation ignored). The sole exception is the default handler
for evt.EVT_C_ECHO
which returns an 0x0000
Success status. The
table below lists the possible intervention events.