pynetdicom.dimse.DIMSEServiceProvider¶
-
class
pynetdicom.dimse.
DIMSEServiceProvider
(assoc)[source]¶ The DIMSE service provider.
Changed in version 1.2: Added msg_queue attribute
Messages
Primitive
Type
Message Class
C-CANCEL
Request/indication
C_CANCEL_RQ
C-ECHO
Request/indication
C_ECHO_RQ
Response/confirmation
C_ECHO_RSP
C-FIND
Request/indication
C_FIND_RQ
Response/confirmation
C_FIND_RSP
C-GET
Request/indication
C_GET_RQ
Response/confirmation
C_GET_RSP
C-MOVE
Request/indication
C_MOVE_RQ
Response/confirmation
C_MOVE_RSP
C-STORE
Request/indication
C_STORE_RQ
Response/confirmation
C_STORE_RSP
N-ACTION
Request/indication
N_ACTION_RQ
Response/confirmation
N_ACTION_RSP
N-CREATE
Request/indication
N_CREATE_RQ
Response/confirmation
N_CREATE_RSP
N-DELETE
Request/indication
N_DELETE_RQ
Response/confirmation
N_DELETE_RSP
N-EVENT-REPORT
Request/indication
N_EVENT_REPORT_RQ
Response/confirmation
N_EVENT_REPORT_RSP
N-GET
Request/indication
N_GET_RQ
Response/confirmation
N_GET_RSP
N-SET
Request/indication
N_SET_RQ
Response/confirmation
N_SET_RSP
-
cancel_rq
¶ A dict of
{MessageIDBeingRespondedTo : C_CANCEL}
messages received. The dict is cleared out at the start and end of Service Class operations and is limited to a maximum of 10 messages.- Type
-
msg_queue
¶ A queue holding decoded DIMSE Message primitives received from the peer, except for C-CANCEL requests.
- Type
queue.queue of dimse_messages.DIMSEMessage
References
DICOM Standard, Part 7
-
__init__
(assoc)[source]¶ Initialise the DIMSE service provider.
Changed in version 1.3: Class initialisation now only takes assoc parameter.
- Parameters
assoc (association.Association) – The association to provide DIMSE services for.
Methods
__init__
(assoc)Initialise the DIMSE service provider.
get_msg
([block])Get the next available DIMSE message.
peek_msg
()Return the first message in the message queue or
None
.receive_primitive
(primitive)Process a P-DATA primitive received from the remote.
send_msg
(primitive, context_id)Encode and send a DIMSE-C or DIMSE-N message to the peer AE.
Attributes
Return the parent
Association
.Return the DIMSE timeout as numeric or
None
.Return the
DULServiceProvider
.Return the peer’s maximum PDU length as
int
.-
property
assoc
¶ Return the parent
Association
.New in version 1.3.
-
property
dimse_timeout
¶ Return the DIMSE timeout as numeric or
None
.
-
property
dul
¶ Return the
DULServiceProvider
.
-
get_msg
(block=False)[source]¶ Get the next available DIMSE message.
New in version 1.2.
Changed in version 1.5: Changed to also return
(None, None)
if the peer aborts the association or the connection is closed.- Parameters
block (bool) – If
True
then the function will block until either a message is available ordimse_timeout
expires, otherwise non-blocking.- Returns
The next available (Context ID, DIMSE Message), which is taken off the queue, or
(None, None)
if the peer has aborted the association, the connection is closed or if no messages are available within thedimse_timeout
period.- Return type
-
receive_primitive
(primitive)[source]¶ Process a P-DATA primitive received from the remote.
New in version 1.2.
A DIMSE message is split into one or more P-DATA primitives, which must be sent in sequential order. While waiting for all the P-DATA primitives associated with a message the encoded data is stored in
message
, which is decoded only when complete and converted into a DIMSE Message primitive which is added to themsg_queue
.This makes it possible to process incoming P-DATA primitives into DIMSE messages while a service class implementation is running.
- Parameters
primitive (pdu_primitives.P_DATA) – A P-DATA primitive received from the peer to be processed.
-
send_msg
(primitive, context_id)[source]¶ Encode and send a DIMSE-C or DIMSE-N message to the peer AE.
- Parameters
primitive (dimse_primitives DIMSE Primitive class) – The DIMSE message primitive to send to the peer.
context_id (int) – The ID of the presentation context that the message is to be sent under.
-