예제 #1
0
        }//Prcd_CONNECT_ACTIVE_IND

        /// <summary>
        /// Responds to notification of incoming call
        /// </summary>
        /// <param name="CAPImsg">CAPI message to send CONNECT_RESP</param>
        /// <param name="Protocol_Event">Protocol event set to NO_ONE on exit</param>
        /// <param name="PLCIPCurrState">Protocol machine state set to wait for connection (if accepted) or disconnection (if rejected)</param>
        /// <param name="ident"></param>
        private void Prcd_CONNECT_RESP
        (
            CAPI.CAPI_Message CAPImsg,
            out CAPI_Wrapper.comsub Protocol_Event,
            out PLCI_States PLCIPCurrState,
            short ident)
        {
            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
            CAPImsg.number = ident;
            Manager.Assert(
                //MPNI implementacja konfiguracji protokolów
                CAPI_Interface.Send_msg_connect_resp
                (
                    ref CAPImsg, 1, PLCI, accept, B1_config,
                    B2_config, B3_config,
                    out info
                )
                ); //Manager.Assert
            if (accept)
            {
                PLCIPCurrState = PLCI_States.P4;
            }
            else
            {
                PLCIPCurrState = PLCI_States.P5;
            }
        } //Prcd_CONNECT_RESP
예제 #2
0
        } // Prcd_DISCONNECT_IND

        /// <summary>
        /// Start the physical disconnection procedure
        /// </summary>
        /// <param name="CAPImsg">CAPI message to send DISCONNECT_REQ</param>
        /// <param name="Protocol_Event">Protocol event set to NO_ONE on exit</param>
        /// <param name="PLCIPCurrState">Protocol machine state set to wait for disconnection network</param>
        private void Prcd_DISCONNECT_REQ
            (CAPI.CAPI_Message CAPImsg, out CAPI_Wrapper.comsub Protocol_Event, out PLCI_States PLCIPCurrState)
        {
            Manager.Assert(
                CAPI_Interface.Send_msg_disconnect_req(ref CAPImsg, 1, PLCI, out info)
                );
            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
            PLCIPCurrState = PLCI_States.P5;
        } // Prcd_DISCONNECT_REQ
예제 #3
0
        } // Prcd_DISCONNECT_REQ

        /// <summary>
        /// Respond to notification of physical connection from netwok
        /// </summary>
        /// <param name="CAPImsg">CAPI message to send CONNECT_ACTIVE_RESP</param>
        /// <param name="Protocol_Event">Protocol event set to CONNECT_B3_REQ on exit</param>
        /// <param name="PLCIPCurrState">Protocol machine state set to connection active on exit</param>
        private void Prcd_CONNECT_ACTIVE_IND
            (CAPI.CAPI_Message CAPImsg, out CAPI_Wrapper.comsub Protocol_Event, out PLCI_States PLCIPCurrState)
        {
            Manager.Assert
                (CAPI_Interface.Send_msg_connect_active_resp(ref CAPImsg, 1, PLCI, out info));
            if (issueB3_req)
            {
                Protocol_Event = CAPI_Wrapper.comsub.CONNECT_B3_REQ;
            }
            else
            {
                Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
            }
            PLCIPCurrState = PLCI_States.P_ACT;
        }//Prcd_CONNECT_ACTIVE_IND
예제 #4
0
        /// <summary>
        /// Listening protocol machine.
        /// Handles all events concerning listening states.
        /// </summary>
        /// <param name="LEventt"></param>
        public void SM_Listen(Listen_Events LEventt)
        {
            info = (uint)CAPI_Interface.TInterfaceError.GENERAL_ERROR;
            switch (state)
            {
            case Listen_States.L0:
                #region L0
                switch (LEventt)
                {
                case C_ListenState.Listen_Events.LISTEN_REQ:
                    CAPI.CAPI_Message CAPImsg = new CAPI.CAPI_Message();
                    Manager.Assert
                    (
                        CAPI_Interface.Send_msg_listen_req(ref CAPImsg, 1, start_listen, out info)
                    );
                    state = Listen_States.L01;
                    break;
                }
                ;
                break;

            case Listen_States.L01:
                switch (LEventt)
                {
                case C_ListenState.Listen_Events.LISTEN_CONF_INFO_0_CIP_0:
                case C_ListenState.Listen_Events.LISTEN_CONF_INFO_N0:
                    state = Listen_States.L0;
                    break;

                case C_ListenState.Listen_Events.LISTEN_CONF_INFO_O_CIP_N0:
                    state = Listen_States.L1;
                    break;
                }
                ;
                break;

                #endregion
            case Listen_States.L1:
                #region L1
                switch (LEventt)
                {
                case C_ListenState.Listen_Events.LISTEN_REQ:
                    CAPI.CAPI_Message CAPImsg = new CAPI.CAPI_Message();
                    Manager.Assert
                    (
                        CAPI_Interface.Send_msg_listen_req(ref CAPImsg, 1, start_listen, out info)
                    );
                    state = Listen_States.L11;
                    if (start_listen == true)
                    {
                        CIP = 2;
                    }
                    else
                    {
                        CIP = 0;
                    }
                    break;
                }
                ;
                break;

                #endregion
            case Listen_States.L11:
                #region L11
                switch (LEventt)
                {
                case C_ListenState.Listen_Events.LISTEN_CONF_INFO_0_CIP_0:
                    state = Listen_States.L0;
                    break;

                case C_ListenState.Listen_Events.LISTEN_CONF_INFO_N0:
                case C_ListenState.Listen_Events.LISTEN_CONF_INFO_O_CIP_N0:
                    state = Listen_States.L1;
                    break;
                }
                ;
                #endregion
                break;
            }
        }
예제 #5
0
        /// <summary>
        /// Physical connection protocol machine.
        /// Handles all events concerning physical connection states.
        /// </summary>
        /// <param name="CAPImsg">CAPI message to operate on</param>
        /// <param name="Protocol_Event">Last protocol event that occured during application's activity</param>
        internal void SM_PLCI
            (CAPI.CAPI_Message CAPImsg, CAPI_Wrapper.comsub Protocol_Event)
        {
            lock (this)
            {
                while (Protocol_Event != CAPI_Wrapper.comsub.NO_ONE)
                {
                    short packetNum = 0;
                    info = (uint)CAPImsg.get_info;
                    switch (PLCIPCurrState)
                    {
                    case PLCI_States.P0WaitingFConnIndication:
                        #region P0WaitingFConnIndication
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.CONNECT_IND:
                            accept         = true;
                            PLCI           = CAPImsg.plci;
                            packetNum      = CAPImsg.number;
                            Protocol_Event = CAPI_Wrapper.comsub.CONNECT_RESP;
                            PLCIPCurrState = PLCI_States.P2;
                            break;

                        default:
//                Manager.Assert(false);
                            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                            break;
                        }
                        ;
                        break;

                        #endregion
                    case PLCI_States.P0:
                        #region P0
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.INTERNAL_WaitFConnInd:
                            PLCI           = CAPImsg.plci;
                            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                            PLCIPCurrState = PLCI_States.P0WaitingFConnIndication;
                            break;

                        case CAPI_Wrapper.comsub.CONNECT_IND:
                            accept         = false;
                            PLCI           = CAPImsg.plci;
                            packetNum      = CAPImsg.number;
                            Protocol_Event = CAPI_Wrapper.comsub.CONNECT_RESP;
                            PLCIPCurrState = PLCI_States.P2;
                            break;

                        case CAPI_Wrapper.comsub.CONNECT_REQ:
                            Manager.Assert(
                                CAPI_Interface.Send_msg_connect_req
                                (
                                    ref CAPImsg,
                                    portTelNumber,
                                    1,
                                    CAPI.CAPI_Wrapper.CIP_Value.UNRESTR_DIG_INFO,
                                    B1_config,
                                    B2_config,
                                    B3_config,
                                    (short)(PLCI + Byte.MaxValue),
                                    out info)
                                );
                            issueB3_req    = true;
                            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                            PLCIPCurrState = PLCI_States.P01;
                            break;

                        // not supported
                        //              case CAPI_Wrapper.comsub.FACILITY_IND_STATE_PLUS:
                        //                PLCIPCurrState = PLCI_States.P1;
                        //                Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //                break;
                        default:
                            Manager.Assert(false);
                            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                            break;
                        }
                        ;
                        break;

                        #endregion
                    case PLCI_States.P01:
                        #region P01
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.CONNECT_CONF:
                            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                            if (info == 0)
                            {
                                PLCIPCurrState = PLCI_States.P1;
                                PLCI           = CAPImsg.plci;
                            }
                            else
                            {
                                PLCIPCurrState = PLCI_States.P0;
                                IsDisconnectedCon.Notify();
                            }
                            break;

                        //              case CAPI_Wrapper.comsub.FACILITY_IND_STATE_MINUS:
                        //                //MPNI - do zrobienia nie wiem o co chodzi
                        //                Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //                PLCIPCurrState = PLCI_States.P5;
                        //                break;
                        default:
                            Manager.Assert(false);
                            break;
                        }
                        ;
                        break;

                        // PLCI_States.P01
                        #endregion
                    case PLCI_States.P1:
                        #region P1
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.CONNECT_ACTIVE_IND:
                            Prcd_CONNECT_ACTIVE_IND(CAPImsg, out Protocol_Event, out PLCIPCurrState);
                            break;

                        //MPNI - do zrobienia nie wiem o co chodzi
                        //case CAPI_Wrapper.comsub.FACILITY_IND_STATE_MINUS:
                        //  Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //  PLCIPCurrState = PLCI_States.P5;
                        //  break;
                        case CAPI_Wrapper.comsub.DISCONNECT_IND:
                            Prcd_DISCONNECT_IND(out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.DISCONNECT_REQ:
                            Prcd_DISCONNECT_REQ(CAPImsg, out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.INFO_IND:
                        case CAPI_Wrapper.comsub.INFO_REQ:
                            break;

                        default:
                            Manager.Assert(false);
                            break;
                        }
                        ;
                        break;

                        //PLCI_States.P1
                        #endregion
                    case PLCI_States.P2:
                        #region P2
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.ALERT_REQ:
                            //MPNI nie zrobi³em z braku wiedzy i czasu
                            Manager.Assert(false);
                            break;

                        case CAPI_Wrapper.comsub.CONNECT_RESP:
                            Prcd_CONNECT_RESP(CAPImsg, out Protocol_Event, out PLCIPCurrState, packetNum);
                            break;

                        //MPNI not supported
                        //case CAPI_Wrapper.comsub.FACILITY_IND_STATE_PLUS:
                        //  Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //  PLCIPCurrState = PLCI_States.P3;
                        //  break;
                        //case CAPI_Wrapper.comsub.FACILITY_IND_STATE_MINUS:
                        //MPNI - do zrobienia nie wiem o co chodzi
                        //Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //PLCIPCurrState = PLCI_States.P5;
                        //break;
                        case CAPI_Wrapper.comsub.DISCONNECT_IND:
                            Prcd_DISCONNECT_IND(out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.DISCONNECT_REQ:
                            Prcd_DISCONNECT_REQ(CAPImsg, out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.INFO_IND:
                        case CAPI_Wrapper.comsub.INFO_REQ:
                            break;

                        default:
                            Manager.Assert(false);
                            break;
                        }
                        ;
                        break;

                        // PLCI_States.P2
                        #endregion
                    case PLCI_States.P3:
                        #region P3
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.CONNECT_RESP:
                            Prcd_CONNECT_RESP(CAPImsg, out Protocol_Event, out PLCIPCurrState, packetNum);
                            break;

                        //MPNI - do zrobienia nie wiem o co chodzi - zrobiæ metodê wspó³na
                        //case CAPI_Wrapper.comsub.FACILITY_IND_STATE_MINUS:
                        //  Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //  PLCIPCurrState = PLCI_States.P5;
                        //  break;
                        case CAPI_Wrapper.comsub.DISCONNECT_IND:
                            Prcd_DISCONNECT_IND(out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.DISCONNECT_REQ:
                            Prcd_DISCONNECT_REQ(CAPImsg, out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.INFO_IND:
                        case CAPI_Wrapper.comsub.INFO_REQ:
                            break;

                        default:
                            Manager.Assert(false);
                            break;
                        }
                        ;
                        break;

                        //PLCI_States.P3
                        #endregion
                    case PLCI_States.P4:
                        #region p4
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.CONNECT_ACTIVE_IND:
                            Prcd_CONNECT_ACTIVE_IND(CAPImsg, out Protocol_Event, out PLCIPCurrState);
                            break;

                        //MPNI - do zrobienia nie wiem o co chodzi
                        //case CAPI_Wrapper.comsub.FACILITY_IND_STATE_MINUS:
                        //Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //PLCIPCurrState = PLCI_States.P5;
                        //break;
                        case CAPI_Wrapper.comsub.DISCONNECT_IND:
                            Prcd_DISCONNECT_IND(out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.DISCONNECT_REQ:
                            Prcd_DISCONNECT_REQ(CAPImsg, out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.INFO_IND:
                        case CAPI_Wrapper.comsub.INFO_REQ:
                            break;

                        default:
                            Manager.Assert(false);
                            break;
                        }
                        ;
                        break;

                        // PLCI_States.P4
                        #endregion
                    case PLCI_States.P5:
                        #region P5
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.DISCONNECT_CONF:
                            Manager.Assert(info == 0);
                            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                            break;

                        case CAPI_Wrapper.comsub.DISCONNECT_IND:
                            Protocol_Event = CAPI_Wrapper.comsub.DISCONNECT_RESP;
                            PLCIPCurrState = PLCI_States.P6;
                            break;

                        case CAPI_Wrapper.comsub.INFO_IND:
                            Manager.Assert(false);
                            //MPNI tu coœ trzeba zrobiæ
                            break;

                        //MPNI - do zrobienia nie wiem o co chodzi
                        //case CAPI_Wrapper.comsub.FACILITY_IND_STATE_MINUS:
                        //Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        //PLCIPCurrState = PLCI_States.P5;
                        //break;
                        default:
                            Manager.Assert(false);
                            break;
                        }
                        ;
                        break;

                        // PLCI_States.P5
                        #endregion
                    case PLCI_States.P6:
                        #region P6
                        switch (Protocol_Event)
                        {
                        case CAPI_Wrapper.comsub.DISCONNECT_RESP:
                            Manager.Assert(CAPI_Interface.Send_msg_disconnect_resp(ref CAPImsg, 1, PLCI, out info));
                            Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                            PLCIPCurrState = PLCI_States.P0;
                            IsDisconnectedCon.Notify();
                            Signal_Disconnected();
                            PLCI = 0;
//				NCCI = 0;
                            break;

                        default:
                            Manager.Assert(false);
                            break;
                        }
                        ;
                        break;

                        // PLCI_States.P6
                        #endregion
                    case PLCI_States.P_ACT:
                        #region P_ACT
                        switch (Protocol_Event)
                        {
                        //case CAPI_Wrapper.comsub.FACILITY_IND_STATE_MINUS:
                        //MPNI - do zrobienia nie wiem o co chodzi
                        //PLCIPCurrState = PLCI_States.P5;
                        //break;
                        //MPTI tu chyba najpierw trzeba roz³¹czyæ B3
                        case CAPI_Wrapper.comsub.DISCONNECT_IND:
                            issueB3_req = false;
                            Prcd_DISCONNECT_IND(out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.DISCONNECT_REQ:
                            Prcd_DISCONNECT_REQ(CAPImsg, out Protocol_Event, out PLCIPCurrState);
                            break;

                        case CAPI_Wrapper.comsub.INFO_IND:
                        case CAPI_Wrapper.comsub.INFO_REQ:
                            break;

                        default:
                            SM_NCCI(ref CAPImsg, ref Protocol_Event);
                            break;
                        } // switch
                        break;
                        // PLCI_States.P_ACT
                        #endregion
                    } // switch
                }     //while
            }         // lock
        }
예제 #6
0
        /// <summary>
        /// Logical connection protocol machine.
        /// Handles all events concerning logical connection states.
        /// </summary>
        /// <param name="CAPImsg">CAPI message to operate on</param>
        /// <param name="Protocol_Event">Last protocol event that occured during application's activity</param>
        protected void SM_NCCI(ref CAPI.CAPI_Message CAPImsg, ref CAPI_Wrapper.comsub Protocol_Event)
        {
            //zmienna zwi¹zana z obslug¹ odrzuconego DISCONNECT_B3_REQ
            NCCI_States previousState = NCCI_States.N_ACT;

            switch (NCCIPCurrState)
            {
            case NCCI_States.N0:
                #region N0
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.CONNECT_B3_REQ:
                    #region CONNECT_B3_REQ
                    Manager.Assert(CAPI_Interface.Send_msg_connect_b3_req(ref CAPImsg, 1, PLCI, out info));
                    NCCIPCurrState = NCCI_States.N01;
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                    #endregion
                case CAPI_Wrapper.comsub.CONNECT_B3_IND:
                    #region CONNECT_B3_IND
                    NCCI   = CAPImsg.ncci;
                    accept = true;
                    //MPNI tu trzeba zrobic sprawdzenie czy oczekujemy na konkretny protokol
                    Disconnect_B3_Pending = false;
                    NCCIPCurrState        = NCCI_States.N1;
                    Protocol_Event        = CAPI_Wrapper.comsub.CONNECT_B3_RESP;
                    break;

                    #endregion
                default:
                    Manager.Assert(false);
                    break;
                }
                ;
                break;

                #endregion
            case NCCI_States.N01:
                #region N01
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.CONNECT_B3_CONF:
                    if (info != 0)
                    {
                        NCCIPCurrState = NCCI_States.N0;
                    }
                    else
                    {
                        NCCIPCurrState = NCCI_States.N2;
                        NCCI           = CAPImsg.ncci;
                    }
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                default:
                    Manager.Assert(false);
                    break;
                }
                ;
                break;

                #endregion
            case NCCI_States.N1:
                #region N1
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.CONNECT_B3_RESP:
                    #region CONNECT_B3_RESP
                    Manager.Assert(
                        CAPI_Interface.Send_msg_connect_b3_resp(
                            ref CAPImsg, 1, PLCI, NCCI, accept, out info));
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    if (accept)
                    {
                        NCCIPCurrState = NCCI_States.N2;
                    }
                    else
                    {
                        NCCIPCurrState = NCCI_States.N4;
                    }
                    break;

                    #endregion
                    #region N1_DISCONNECT
                // wspolne dla N-1, N-2, N-3, N-ACT
                case CAPI_Wrapper.comsub.DISCONNECT_B3_REQ:
                    Manager.Assert(false);
                    break;

                case CAPI_Wrapper.comsub.DISCONNECT_B3_IND:
                    NCCIPCurrState = NCCI_States.N5;
                    Protocol_Event = CAPI_Wrapper.comsub.DISCONNECT_B3_RESP;
                    break;

                    #endregion
                default:
                    Manager.Assert(false);
                    break;
                }
                ;
                break;

                #endregion
            case NCCI_States.N2:
                #region N2
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.CONNECT_B3_ACTIVE_IND:
                    Manager.Assert(CAPI_Interface.Send_msg_connect_b3_active_resp(ref CAPImsg, 1, PLCI, NCCI, out info));
                    NCCIPCurrState = NCCI_States.N_ACT;
                    buff_TxMess.redyToSend();
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    IsConnectedCon.Notify();
                    break;

                // wspolne dla N-1, N-2, N-3, N-ACT
                case CAPI_Wrapper.comsub.DISCONNECT_B3_REQ:
                    Manager.Assert(false);
                    break;

                case CAPI_Wrapper.comsub.DISCONNECT_B3_IND:
                    NCCIPCurrState = NCCI_States.N5;
                    Protocol_Event = CAPI_Wrapper.comsub.DISCONNECT_B3_RESP;
                    break;

                default:
                    Manager.Assert(false);
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;
                }
                ;
                break;

                #endregion
            case NCCI_States.N3:
                #region N3
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.RESET_B3_IND:
                    //MPNI - TU TRZEBA WYS£AÆ res
                    NCCIPCurrState = NCCI_States.N_ACT;
                    buff_TxMess.redyToSend();
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    IsConnectedCon.Notify();
                    break;

                    #region N3_DISCONNECT
                // wspolne dla N-1, N-2, N-3, N-ACT
                case CAPI_Wrapper.comsub.DISCONNECT_B3_REQ:
                    Manager.Assert(false);
                    break;

                case CAPI_Wrapper.comsub.DISCONNECT_B3_IND:
                    NCCIPCurrState = NCCI_States.N5;
                    Protocol_Event = CAPI_Wrapper.comsub.DISCONNECT_B3_RESP;
                    break;

                    #endregion
                default:
                    Manager.Assert(false);
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;
                }
                ;
                break;

                #endregion
            case NCCI_States.N4:
                #region N4
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.DISCONNECT_B3_CONF:
                    if (info != 0)
                    {
                        Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                        NCCIPCurrState = previousState;
                    }
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                case CAPI_Wrapper.comsub.DISCONNECT_B3_IND:
                    NCCIPCurrState = NCCI_States.N5;
                    Protocol_Event = CAPI_Wrapper.comsub.DISCONNECT_B3_RESP;
                    break;

                default:
                    Manager.Assert(false);
                    break;
                }
                ;
                break;

                #endregion
            case NCCI_States.N5:
                #region N5
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.DISCONNECT_B3_RESP:
                    Manager.Assert
                    (
                        CAPI_Interface.Send_msg_disconnect_b3_resp
                            (ref CAPImsg, 1, PLCI, NCCI, out info)
                    );
                    NCCI           = 0;
                    NCCIPCurrState = NCCI_States.N0;
                    if (Disconnect_B3_Pending)
                    {
                        Protocol_Event = CAPI_Wrapper.comsub.DISCONNECT_REQ;
                    }
                    else
                    {
                        Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    }
                    break;

                default:
                    Manager.Assert(false);
                    break;
                }
                ;
                break;

                #endregion
            case NCCI_States.N_ACT:
                #region N_ACT
                switch (Protocol_Event)
                {
                case CAPI_Wrapper.comsub.DATA_B3_REQ:
                    Manager.Assert
                    (
                        CAPI_Interface.Send_msg_data_b3_req
                        (
                            ref CAPImsg, 1, PLCI, NCCI, buff_TxMess.TxDataGet, out info
                        )
                    );
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                case CAPI_Wrapper.comsub.DATA_B3_CONF:
                    Manager.Assert(info == 0);
                    buff_TxMess.TxDataRelease();
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                case CAPI_Wrapper.comsub.DATA_B3_RESP:
                    Manager.Assert
                    (
                        CAPI_Interface.Send_msg_data_b3_resp(ref CAPImsg, 1, PLCI, NCCI, out info)
                    );
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                case CAPI_Wrapper.comsub.DATA_B3_IND:
                    ISesDBuffer newBuffor = myDBufferPool.GetEmptyISesDBuffer();
                    CAPImsg.Get_Data(newBuffor);
                    IEnvelope newIEBuffor = (IEnvelope)newBuffor;
                    newBuffor = null;
                    buff_RxMess.SendMsg(ref newIEBuffor);
                    Protocol_Event = CAPI_Wrapper.comsub.DATA_B3_RESP;
                    break;

                case CAPI_Wrapper.comsub.RESET_B3_REQ:
                    //MPNI sprawdziæ co robi Reset - w stanie N3 nie s¹ przyjmowane dane
                    //MPNI zaimplementowac funkcje reset
                    Manager.Assert(CAPI_Interface.Send_msg_reset_b3_req(ref CAPImsg, 1, PLCI, NCCI, out info)
                                   );
                    NCCIPCurrState = NCCI_States.N3;
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                case CAPI_Wrapper.comsub.RESET_B3_IND:
                    //mpni - TU TRZEBA WYS£AÆ res
                    NCCIPCurrState = NCCI_States.N_ACT;
                    Protocol_Event = CAPI_Wrapper.comsub.NO_ONE;
                    break;

                    #region DISCONNECT
                // wspolne dla N-1, N-2, N-3, N-ACT
                case CAPI_Wrapper.comsub.DISCONNECT_B3_REQ:
                    Manager.Assert
                        (CAPI_Interface.Send_msg_disconnect_b3_req(ref CAPImsg, 1, PLCI, NCCI, out info));
                    Disconnect_B3_Pending = true;
                    previousState         = NCCI_States.N_ACT;
                    NCCIPCurrState        = NCCI_States.N4;
                    Protocol_Event        = CAPI_Wrapper.comsub.NO_ONE;
                    buff_TxMess.TxDataClear();
                    buff_RxMess.Close();
                    break;

                case CAPI_Wrapper.comsub.DISCONNECT_B3_IND:
                    NCCIPCurrState = NCCI_States.N5;
                    Protocol_Event = CAPI_Wrapper.comsub.DISCONNECT_B3_RESP;
                    buff_TxMess.TxDataClear();
                    buff_RxMess.Close();
                    break;

                    #endregion
                default:
                    Manager.Assert(false);
                    break;
                }
                ; //switch
                break;
                #endregion
            }
            ; //switch (NCCIPCurrState)
        } //public void SM_NCCI