internal void UnBind()
 {
     if (TcpConnection.Connected)
     {
         var requestPdu  = new SmppUnBindReq();
         var asyncObject = new SmppAsyncObject();
         SendReqPdu(requestPdu, ref asyncObject);
         TcpConnection.Disconnect();
     }
     LastBindRes = null;
 }
 public SmppUnBindEventArgs(Guid ConnGuid, SmppUnBindReq Pdu)
 {
     _Pdu      = Pdu;
     _ConnGuid = ConnGuid;
 }
Example #3
0
        void ProcessPdu(Guid ConnGuid, ByteBuilder bb)
        {
            var header = new SmppHeader(bb);

            if (bb.Count > 0x10)
            {
                bb.ToArray(0x10, bb.Count - 0x10);
            }
            if (((header.CommandId == 2) || (header.CommandId == 1)) || (header.CommandId == 9))
            {
                try {
                    var pdu = new SmppBindReq(bb);
                    if (OnBindReq != null)
                    {
                        OnBindReq(this, new SmppBindEventArgs(ConnGuid, pdu));
                    }
                } catch {}
            }
            else
            {
                int commandId = header.CommandId;
                if (commandId <= -2147483627)
                {
                    switch (commandId)
                    {
                    case -2147483643: {
                        var res = new SmppDeliverSmRes(bb);
                        if (OnDeliverSmRes != null)
                        {
                            OnDeliverSmRes(this, new SmppDeliverSmResEventArgs(ConnGuid, res));
                        }
                        return;
                    }

                    case -2147483627: {
                        var res2 = new SmppEnquireLinkRes(bb);
                        if (OnEnquireLinkRes != null)
                        {
                            OnEnquireLinkRes(this, new SmppEnquireLinkResEventArgs(ConnGuid, res2));
                            return;
                        }
                        break;
                    }
                    }
                }
                else
                {
                    switch (commandId)
                    {
                    case 3: {
                        var req4 = new SmppQuerySmReq(bb);
                        if (OnQuerySmReq != null)
                        {
                            OnQuerySmReq(this, new SmppQuerySmEventArgs(req4, ConnGuid));
                        }
                        return;
                    }

                    case 4: {
                        var req2 = new SmppSubmitSmReq(bb);
                        if (OnSubmitSmReq != null)
                        {
                            OnSubmitSmReq(this, new SmppSubmitSmEventArgs(ConnGuid, req2));
                        }
                        return;
                    }

                    case 5:
                        return;

                    case 6: {
                        var req5 = new SmppUnBindReq(bb);
                        if (OnUnBindReq != null)
                        {
                            OnUnBindReq(this, new SmppUnBindEventArgs(ConnGuid, req5));
                        }
                        return;
                    }

                    case 0x15: {
                        var req3 = new SmppEnquireLinkReq(bb);
                        if (OnEnquireLinkReq != null)
                        {
                            OnEnquireLinkReq(this, new SmppEnquireLinkEventArgs(ConnGuid, req3));
                        }
                        return;
                    }

                    default:
                        return;
                    }
                }
            }
        }