Esempio n. 1
0
        public byte[] GetBytes()
        {
            //Approximate buffer required;
            int        capacity = 4 + vAddress == null ? 1 : vAddress.Length;
            ByteBuffer buffer   = new ByteBuffer(capacity);

            buffer.Append((byte)vTon);
            buffer.Append((byte)vNpi);
            buffer.Append(PDU.EncodeCString(vAddress));
            return(buffer.ToBytes());
        }
Esempio n. 2
0
        internal static SmppAddress Parse(ByteBuffer buffer)
        {
            //We require at least 3 bytes for SMPPAddress instance to be craeted
            if (buffer.Length < 3)
            {
                throw new NotEnoughBytesException("SMPPAddress requires at least 3 bytes");
            }
            TypeOfNumber           ton = (TypeOfNumber)PDU.GetByte(buffer);
            NumberingPlanIndicator npi = (NumberingPlanIndicator)PDU.GetByte(buffer);
            string address             = PDU.DecodeCString(buffer);

            return(new SmppAddress(ton, npi, address));
        }
Esempio n. 3
0
 public void Send(PDU pdu)
 {
     if (pdu == null) { throw new ArgumentNullException("pdu"); }
     byte[] bytesToSend = pdu.GetBytes();
     vTcpIpSession.Send(bytesToSend);
 }
Esempio n. 4
0
 public PDUErrorEventArgs(PDUException exception, byte[] byteDump, PDUHeader header, PDU pdu)
     : this(exception,byteDump,header)
 {
     vPdu = pdu;
 }
Esempio n. 5
0
 private void RaisePduErrorEvent(PDUException exception, byte[] byteDump, PDUHeader header, PDU pdu)
 {
     if (PDUError == null) { return; }
     PDUErrorEventArgs e = new PDUErrorEventArgs(exception, byteDump, header, pdu);
     foreach (EventHandler<PDUErrorEventArgs> del in PDUError.GetInvocationList())
     { del.BeginInvoke(this, e, AsyncCallBackRaisePduErrorEvent, del); }
 }