Пример #1
0
        /// <summary> Called to create a AlertNotification object </summary>
        /// <param name="defaultEncoding"></param>
        /// <param name="buf"></param>
        /// <param name="offset"></param>
        /// <returns> AlertNotification </returns>
        public static AlertNotification Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset)
        {
            AlertNotification alertNotification = new AlertNotification(defaultEncoding);

            try
            {
                int start_offset = offset;

                buf.ExtractHeader(alertNotification, ref offset);

                alertNotification.SourceAddrTon = buf.ExtractByte(ref offset);
                alertNotification.SourceAddrNpi = buf.ExtractByte(ref offset);
                alertNotification.SourceAddr    = buf.ExtractCString(ref offset);
                alertNotification.EsmeAddrTon   = buf.ExtractByte(ref offset);
                alertNotification.EsmeAddrNpi   = buf.ExtractByte(ref offset);
                alertNotification.EsmeAddr      = buf.ExtractCString(ref offset);

                while (offset - start_offset < alertNotification.Length)
                {
                    alertNotification.Optional.Add(buf.ExtractTLV(ref offset));
                }
            }

            catch
            {
                alertNotification = null;
            }

            return(alertNotification);
        }
Пример #2
0
        /// <summary> Called to create a AlertNotification object </summary>
        /// <param name="defaultEncoding"></param>
        /// <param name="buf"></param>
        /// <param name="offset"></param>
        /// <returns> AlertNotification </returns>
        public static AlertNotification Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset)
        {
            AlertNotification alertNotification = new AlertNotification(defaultEncoding);

            try
            {
                int start_offset = offset;

                buf.ExtractHeader(alertNotification, ref offset);

                alertNotification.SourceAddrTon = buf.ExtractByte(ref offset);
                alertNotification.SourceAddrNpi = buf.ExtractByte(ref offset);
                alertNotification.SourceAddr = buf.ExtractCString(ref offset);
                alertNotification.EsmeAddrTon = buf.ExtractByte(ref offset);
                alertNotification.EsmeAddrNpi = buf.ExtractByte(ref offset);
                alertNotification.EsmeAddr = buf.ExtractCString(ref offset);

                while (offset - start_offset < alertNotification.Length)
                {
                    alertNotification.Optional.Add(buf.ExtractTLV(ref offset));
                }
            }

            catch
            {
                alertNotification = null;
            }

            return alertNotification;
        }
Пример #3
0
        /// <summary> Called to fire the alert notification event </summary>
        /// <param name="data"></param>
        internal void OnAlertNotification(AlertNotification data)
        {
            try
            {
                if (AlertNotificationEvent != null)
                {
                    AlertNotificationEvent(this, data);
                }
            }

            catch
            {
            }
        }