예제 #1
0
        /// <summary>  Determines if this SIF_Ack has a specific status code.</summary>
        /// <param name="code">The status code to test for
        /// </param>
        /// <returns> true if the SIF_Ack has one or more SIF_Status children and one
        /// of those contains the status code
        /// </returns>
        public virtual bool HasStatusCode(int code)
        {
            SIF_Status stat = this.SIF_Status;

            if (stat != null && stat.SIF_Code == code)
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        private void  LogCommon(string direction, log4net.ILog log)
        {
            System.Text.StringBuilder b = new System.Text.StringBuilder(direction);
            b.Append(ElementDef.Tag(SifVersion));
            b.Append(" (Status = ");

            SIF_Status stat = this.SIF_Status;

            if (stat != null)
            {
                b.Append(stat.SIF_Code);
            }
            else
            {
                b.Append("none");
            }

            SIF_Error err = this.SIF_Error;

            if (err != null)
            {
                b.Append("; 1 Error");
            }

            b.Append(")");
            log.Debug(b.ToString());

            if (err != null && (Adk.Debug & AdkDebugFlags.Messaging) != 0)
            {
                log.Debug(err.ToString());
            }

            if ((Adk.Debug & AdkDebugFlags.Messaging_Detailed) != 0)
            {
                string id = MsgId;
                log.Debug("  MsgId: " + (id == null?"<none>":id));
                id = SIF_OriginalMsgId;
                log.Debug("  OrgId: " + (id == null?"<none>":id));
            }
        }
예제 #3
0
        /// <summary>  Create a SIF_Ack for this message.</summary>
        /// <param name="code">The SIF_Status/SIF_Code value
        /// </param>
        /// <returns> A new SIF_Ack instance where the SIF_Status/SIF_Code value is
        /// set to the specified value and SIF_Ack header values are derived
        /// from this message's header values
        /// </returns>
        public virtual SIF_Ack ackStatus(int code)
        {
            SIF_Ack ack = new SIF_Ack();
            SIF_Status status = new SIF_Status(code);
            ack.SIF_Status = status;
            ack.SIF_OriginalMsgId = MsgId;
            ack.SIF_OriginalSourceId = SourceId;

            SifVersion msgVersion = this.SifVersion;

            if (code == 8 /* Receiver is sleeping */ )
            {
                if (msgVersion.Major == 1)
                {
                    // SIF 1.x used SIF_Data for text
                    SIF_Data d = new SIF_Data();
                    d.TextValue = "Receiver is sleeping";
                    status.SIF_Data = d;
                }
                else
                {
                    status.SIF_Desc = "Receiver is sleeping";
                }
            }

            ack.message = this;

            //  Ack using the same version of SIF as this message
            ack.SifVersion = msgVersion;

            return ack;
        }