|
PACS System 0.1.0
PACS DICOM system library
|
UPS Watch SCP service for subscription and event notification. More...
#include <ups_watch_scp.h>


Public Member Functions | |
| ups_watch_scp (std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct UPS Watch SCP with optional logger. | |
| ~ups_watch_scp () override=default | |
| void | set_subscribe_handler (ups_subscribe_handler handler) |
| void | set_unsubscribe_handler (ups_unsubscribe_handler handler) |
| void | set_get_subscribers_handler (ups_get_subscribers_handler handler) |
| void | set_event_callback (ups_event_callback callback) |
| std::vector< std::string > | supported_sop_classes () const override |
| Get the list of SOP Class UIDs supported by this service. | |
| network::Result< std::monostate > | handle_message (network::association &assoc, uint8_t context_id, const network::dimse::dimse_message &request) override |
| Handle an incoming DIMSE message. | |
| std::string_view | service_name () const noexcept override |
| Get the service name for logging/debugging. | |
| void | notify_state_change (const std::string &workitem_uid, const std::string &new_state) |
| Notify subscribers of a workitem state change. | |
| void | notify_cancel_requested (const std::string &workitem_uid, const std::string &reason) |
| Notify subscribers of a cancel request. | |
| void | notify_progress (const std::string &workitem_uid, int progress_percent) |
| Notify subscribers of progress update. | |
| size_t | subscriptions_created () const noexcept |
| size_t | subscriptions_removed () const noexcept |
| size_t | events_sent () const noexcept |
| void | reset_statistics () noexcept |
Public Member Functions inherited from kcenon::pacs::services::scp_service | |
| scp_service (std::shared_ptr< di::ILogger > logger=nullptr) | |
| Construct SCP service with optional logger. | |
| virtual | ~scp_service ()=default |
| scp_service (const scp_service &)=delete | |
| scp_service & | operator= (const scp_service &)=delete |
| scp_service (scp_service &&)=default | |
| scp_service & | operator= (scp_service &&)=default |
| void | set_logger (std::shared_ptr< di::ILogger > logger) |
| Set the logger instance. | |
| const std::shared_ptr< di::ILogger > & | logger () const noexcept |
| Get the current logger instance. | |
| bool | supports_sop_class (std::string_view sop_class_uid) const |
| Check if this service supports a specific SOP Class. | |
Private Member Functions | |
| network::Result< std::monostate > | handle_n_action (network::association &assoc, uint8_t context_id, const network::dimse::dimse_message &request) |
| network::Result< std::monostate > | handle_subscribe (network::association &assoc, uint8_t context_id, uint16_t message_id, const std::string &sop_instance_uid) |
| network::Result< std::monostate > | handle_unsubscribe (network::association &assoc, uint8_t context_id, uint16_t message_id, const std::string &sop_instance_uid) |
| network::Result< std::monostate > | handle_suspend_global (network::association &assoc, uint8_t context_id, uint16_t message_id) |
| network::Result< std::monostate > | send_n_action_response (network::association &assoc, uint8_t context_id, uint16_t message_id, const std::string &sop_instance_uid, uint16_t action_type_id, network::dimse::status_code status) |
| void | dispatch_event (uint16_t event_type_id, const std::string &workitem_uid, const core::dicom_dataset &event_info) |
Private Attributes | |
| ups_subscribe_handler | subscribe_handler_ |
| ups_unsubscribe_handler | unsubscribe_handler_ |
| ups_get_subscribers_handler | get_subscribers_handler_ |
| ups_event_callback | event_callback_ |
| std::atomic< size_t > | subscriptions_created_ {0} |
| std::atomic< size_t > | subscriptions_removed_ {0} |
| std::atomic< size_t > | events_sent_ {0} |
Additional Inherited Members | |
Protected Attributes inherited from kcenon::pacs::services::scp_service | |
| std::shared_ptr< di::ILogger > | logger_ |
| Logger instance for service logging. | |
UPS Watch SCP service for subscription and event notification.
The UPS Watch SCP handles subscribe/unsubscribe N-ACTION requests and provides event notification infrastructure. When workitem state changes occur (triggered externally, e.g., by UPS Push SCP), the Watch SCP notifies all relevant subscribers via the event callback.
Definition at line 174 of file ups_watch_scp.h.
|
explicit |
Construct UPS Watch SCP with optional logger.
| logger | Logger instance (nullptr uses null_logger) |
Definition at line 21 of file ups_watch_scp.cpp.
|
overridedefault |
|
private |
Definition at line 361 of file ups_watch_scp.cpp.
References event_callback_, events_sent_, get_subscribers_handler_, and kcenon::pacs::services::scp_service::logger_.
Referenced by notify_cancel_requested(), notify_progress(), and notify_state_change().

|
nodiscardnoexcept |
Definition at line 130 of file ups_watch_scp.cpp.
References events_sent_.
|
nodiscardoverridevirtual |
Handle an incoming DIMSE message.
Processes the request and sends appropriate response(s) via the association.
| assoc | The association on which the message was received |
| context_id | The presentation context ID for the message |
| request | The incoming DIMSE request message |
Implements kcenon::pacs::services::scp_service.
Definition at line 55 of file ups_watch_scp.cpp.
References kcenon::pacs::network::dimse::dimse_message::command(), handle_n_action(), kcenon::pacs::pacs_void_error(), kcenon::pacs::services::to_string(), and kcenon::pacs::error_codes::ups_unexpected_command.

|
nodiscardprivate |
Definition at line 144 of file ups_watch_scp.cpp.
References kcenon::pacs::network::dimse::dimse_message::action_type_id(), kcenon::pacs::network::dimse::dimse_message::affected_sop_instance_uid(), handle_subscribe(), handle_suspend_global(), handle_unsubscribe(), kcenon::pacs::network::dimse::dimse_message::message_id(), kcenon::pacs::pacs_void_error(), kcenon::pacs::network::dimse::dimse_message::requested_sop_instance_uid(), send_n_action_response(), kcenon::pacs::error_codes::ups_invalid_action_type, kcenon::pacs::services::ups_watch_action_subscribe, kcenon::pacs::services::ups_watch_action_suspend_global, and kcenon::pacs::services::ups_watch_action_unsubscribe.
Referenced by handle_message().


|
nodiscardprivate |
Definition at line 193 of file ups_watch_scp.cpp.
References kcenon::pacs::network::association::calling_ae(), kcenon::pacs::services::scp_service::logger_, kcenon::pacs::pacs_void_error(), send_n_action_response(), subscribe_handler_, subscriptions_created_, kcenon::pacs::services::ups_global_subscription_instance_uid, kcenon::pacs::error_codes::ups_handler_not_set, and kcenon::pacs::services::ups_watch_action_subscribe.
Referenced by handle_n_action().


|
nodiscardprivate |
Definition at line 293 of file ups_watch_scp.cpp.
References kcenon::pacs::network::association::calling_ae(), kcenon::pacs::services::scp_service::logger_, kcenon::pacs::pacs_void_error(), send_n_action_response(), subscriptions_removed_, unsubscribe_handler_, kcenon::pacs::services::ups_global_subscription_instance_uid, kcenon::pacs::error_codes::ups_handler_not_set, and kcenon::pacs::services::ups_watch_action_suspend_global.
Referenced by handle_n_action().


|
nodiscardprivate |
Definition at line 245 of file ups_watch_scp.cpp.
References kcenon::pacs::network::association::calling_ae(), kcenon::pacs::services::scp_service::logger_, kcenon::pacs::pacs_void_error(), send_n_action_response(), subscriptions_removed_, unsubscribe_handler_, kcenon::pacs::services::ups_global_subscription_instance_uid, kcenon::pacs::error_codes::ups_handler_not_set, and kcenon::pacs::services::ups_watch_action_unsubscribe.
Referenced by handle_n_action().


| void kcenon::pacs::services::ups_watch_scp::notify_cancel_requested | ( | const std::string & | workitem_uid, |
| const std::string & | reason ) |
Notify subscribers of a cancel request.
| workitem_uid | The workitem for which cancel was requested |
| reason | The cancellation reason (may be empty) |
Definition at line 92 of file ups_watch_scp.cpp.
References dispatch_event(), kcenon::pacs::encoding::LT, kcenon::pacs::services::ups_tags::reason_for_cancellation, kcenon::pacs::core::dicom_dataset::set_string(), and kcenon::pacs::services::ups_event_cancel_requested.

| void kcenon::pacs::services::ups_watch_scp::notify_progress | ( | const std::string & | workitem_uid, |
| int | progress_percent ) |
Notify subscribers of progress update.
| workitem_uid | The workitem that reported progress |
| progress_percent | The progress percentage (0-100) |
Definition at line 106 of file ups_watch_scp.cpp.
References dispatch_event(), kcenon::pacs::encoding::DS, kcenon::pacs::services::ups_tags::procedure_step_progress, kcenon::pacs::core::dicom_dataset::set_string(), and kcenon::pacs::services::ups_event_progress_report.

| void kcenon::pacs::services::ups_watch_scp::notify_state_change | ( | const std::string & | workitem_uid, |
| const std::string & | new_state ) |
Notify subscribers of a workitem state change.
Looks up subscribers for the given workitem and dispatches UPS State Report events via the event callback.
| workitem_uid | The workitem that changed state |
| new_state | The new state string |
Definition at line 80 of file ups_watch_scp.cpp.
References kcenon::pacs::encoding::CS, dispatch_event(), kcenon::pacs::services::ups_tags::procedure_step_state, kcenon::pacs::core::dicom_dataset::set_string(), and kcenon::pacs::services::ups_event_state_report.

|
noexcept |
Definition at line 134 of file ups_watch_scp.cpp.
References events_sent_, subscriptions_created_, and subscriptions_removed_.
|
nodiscardprivate |
Definition at line 337 of file ups_watch_scp.cpp.
References kcenon::pacs::network::association::send_dimse(), and kcenon::pacs::services::ups_watch_sop_class_uid.
Referenced by handle_n_action(), handle_subscribe(), handle_suspend_global(), and handle_unsubscribe().


|
nodiscardoverridevirtualnoexcept |
Get the service name for logging/debugging.
Implements kcenon::pacs::services::scp_service.
Definition at line 72 of file ups_watch_scp.cpp.
| void kcenon::pacs::services::ups_watch_scp::set_event_callback | ( | ups_event_callback | callback | ) |
Definition at line 41 of file ups_watch_scp.cpp.
References event_callback_.
| void kcenon::pacs::services::ups_watch_scp::set_get_subscribers_handler | ( | ups_get_subscribers_handler | handler | ) |
Definition at line 36 of file ups_watch_scp.cpp.
References get_subscribers_handler_.
| void kcenon::pacs::services::ups_watch_scp::set_subscribe_handler | ( | ups_subscribe_handler | handler | ) |
Definition at line 28 of file ups_watch_scp.cpp.
References subscribe_handler_.
| void kcenon::pacs::services::ups_watch_scp::set_unsubscribe_handler | ( | ups_unsubscribe_handler | handler | ) |
Definition at line 32 of file ups_watch_scp.cpp.
References unsubscribe_handler_.
|
nodiscardnoexcept |
Definition at line 122 of file ups_watch_scp.cpp.
References subscriptions_created_.
|
nodiscardnoexcept |
Definition at line 126 of file ups_watch_scp.cpp.
References subscriptions_removed_.
|
nodiscardoverridevirtual |
Get the list of SOP Class UIDs supported by this service.
Implements kcenon::pacs::services::scp_service.
Definition at line 49 of file ups_watch_scp.cpp.
References kcenon::pacs::services::ups_watch_sop_class_uid.
|
private |
Definition at line 301 of file ups_watch_scp.h.
Referenced by dispatch_event(), and set_event_callback().
|
private |
Definition at line 305 of file ups_watch_scp.h.
Referenced by dispatch_event(), events_sent(), and reset_statistics().
|
private |
Definition at line 300 of file ups_watch_scp.h.
Referenced by dispatch_event(), and set_get_subscribers_handler().
|
private |
Definition at line 298 of file ups_watch_scp.h.
Referenced by handle_subscribe(), and set_subscribe_handler().
|
private |
Definition at line 303 of file ups_watch_scp.h.
Referenced by handle_subscribe(), reset_statistics(), and subscriptions_created().
|
private |
Definition at line 304 of file ups_watch_scp.h.
Referenced by handle_suspend_global(), handle_unsubscribe(), reset_statistics(), and subscriptions_removed().
|
private |
Definition at line 299 of file ups_watch_scp.h.
Referenced by handle_suspend_global(), handle_unsubscribe(), and set_unsubscribe_handler().