public DAPStoreService(kdt_managed.UID asn, ts_t[] tsn, AutoResetEvent sync, SSCPPara theStore)
     : base(asn, MDTService.role_t.SCP, tsn)
 {
     m_theStore = theStore;
     m_sync     = sync;
     m_fileName = m_theStore.StoragePath;
 }
Beispiel #2
0
        private static void SetTSN(MElementList elmlist)
        {
            string str_tsn = "";

            using (MElementRef element = elmlist.get_Element(tag_t.kTransferSyntaxUID))
            {
                if (element != null && element.value_count > 0)
                {
                    str_tsn = element.get_string(0);
                    if (str_tsn == "")
                    {
                        str_tsn = "1.2.840.10008.1.2";
                        kdt_managed.UID tsn = new kdt_managed.UID(str_tsn);
                        element.set_uid(0, tsn);
                    }
                }
            }

            if (str_tsn == "")
            {
                MElement        tsnUid = new MElement(tag_t.kTransferSyntaxUID, vr_t.UI);
                kdt_managed.UID tsn    = new kdt_managed.UID("1.2.840.10008.1.2");
                tsnUid.set_uid(0, tsn);
                elmlist.addElement(tsnUid);
            }
        }
        public void newClientIndication(MDTAe ae)
        {
            _logger.Info("DAPListenerReactor.newClientIndication(): " + "a new connection request received for " + ae.getCallingAE());
            // implementation uid
            const String impl_uid = "1.2.840.113564.12.1.1";

            // implement version name, the major and minor version number should be the same with that in the assembly
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            String impl_version            = "SSM " + asm.GetName(false).Version.Major.ToString() + "." + asm.GetName(false).Version.Minor.ToString();
            // max pdu length
            const UInt32 pdu_length = 256 * 1024;
            // asynchorous window size
            const UInt16 asyn_window = 1;

            // start to do the association negotiation
            try
            {
                kdt_managed.UID implUid = new kdt_managed.UID(impl_uid);

                if (!ae.init
                    (
                        implUid,
                        impl_version,
                        pdu_length,
                        asyn_window,
                        null,
                        null,
                        null
                    ))
                {
                    _logger.Info("DAPListenerReactor.newClientIndication(): " + "initialize failed.");
                    return;
                }

                DAPAcseObserver currentObserver = new DAPAcseObserver(m_sync, m_StorePara, ae);
                DAPEchoService  echo_service    = new DAPEchoService(m_StorePara);
                ae.addService(echo_service);

                // supported transfer syntax for every SOP class
                AddSupportedStoreServices(ref ae, currentObserver, m_sync, m_StorePara);

                if (!ae.associate(currentObserver, null, 0))
                {
                    _logger.Info("DAPListenerReactor.newClientIndication(): " + "associate failed.");
                }
                m_sync.WaitOne(-1, false);
            }
            catch (System.Exception except)
            {
                _logger.Info("DAPListenerReactor.newClientIndication(): " + "pop up an exception--" + except.Message);
            }
        }