/*
 * ex: set ro:
 * DO NOT EDIT.
 * generated by smc (http://smc.sourceforge.net/)
 * from file : sm_dialog_subscribe.sm
 */


//	** Copyright (C) 2009 Doubango Telecom <imsframework(at)gmail.com> 
//
//	This file is part of 'Doubango IMS Client Framework'.
//
//    'Doubango IMS Client Framework' is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    'Doubango IMS Client Framework' is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//  along with 'Doubango IMS Client Framework'.  If not, see <http://www.gnu.org/licenses/>.
//
//	** For commercial use, you must purchase a proprietary license from Doubango Telecom.
//
//
///* Copyright (C) 2009 Doubango Telecom
//*
//* Authors:	F0076RTY <imsframework@gmail.com>
//*
//*/
//


#include "sip_dialog_subscribe.h"
#include "..\..\doubango\src\sm_dialog_subscribe_sm.h"

using namespace statemap;

namespace dgo
{
    // Static class declarations.
    map_dialog_subscribe_Initialized map_dialog_subscribe::Initialized("map_dialog_subscribe::Initialized", 0);
    map_dialog_subscribe_Trying map_dialog_subscribe::Trying("map_dialog_subscribe::Trying", 1);
    map_dialog_subscribe_Established map_dialog_subscribe::Established("map_dialog_subscribe::Established", 2);
    map_dialog_subscribe_Authentifying map_dialog_subscribe::Authentifying("map_dialog_subscribe::Authentifying", 3);
    map_dialog_subscribe_Terminated map_dialog_subscribe::Terminated("map_dialog_subscribe::Terminated", 4);

    void sip_dialog_subscribeState::sm_1xx_response(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_2xx_response(sip_dialog_subscribeContext& context, bool unsub)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_3xx_response(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_401_407_421_494_response(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_4xx_response(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_5xx_response(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_6xx_response(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_authentificationSent(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_cancelSent(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_notify_response(sip_dialog_subscribeContext& context, bool term)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_subscribeSent(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_unsubscribeSent(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::sm_xxx_response(sip_dialog_subscribeContext& context)
    {
        Default(context);
        return;
    }

    void sip_dialog_subscribeState::Default(sip_dialog_subscribeContext& context)
    {
        assert(1==0);

        return;
    }

    void map_dialog_subscribe_Default::sm_401_407_421_494_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Authentifying);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Default::sm_3xx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Default::sm_4xx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Default::sm_5xx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Default::sm_6xx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Default::sm_xxx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Default::Default(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Initialized::Entry(sip_dialog_subscribeContext& context)

{
        sip_dialog_subscribe& ctxt(context.getOwner());

        ctxt.OnStateChanged(SS_SUBSCRIBE_INITIALIZED);
        return;
    }

    void map_dialog_subscribe_Initialized::sm_subscribeSent(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Trying);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Trying::Entry(sip_dialog_subscribeContext& context)

{
        sip_dialog_subscribe& ctxt(context.getOwner());

        ctxt.OnStateChanged(SS_SUBSCRIBE_TRYING);
        return;
    }

    void map_dialog_subscribe_Trying::Default(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Trying::sm_1xx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Trying::sm_2xx_response(sip_dialog_subscribeContext& context, bool unsub)
    {

        if (unsub == true)
        {
            (context.getState()).Exit(context);
            // No actions.
            context.setState(map_dialog_subscribe::Terminated);
            (context.getState()).Entry(context);
        }
        else if (unsub == false)
    
    {
            (context.getState()).Exit(context);
            // No actions.
            context.setState(map_dialog_subscribe::Established);
            (context.getState()).Entry(context);
        }        else
        {
             map_dialog_subscribe_Default::sm_2xx_response(context, unsub);
        }

        return;
    }

    void map_dialog_subscribe_Trying::sm_3xx_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Trying::sm_401_407_421_494_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Authentifying);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Trying::sm_4xx_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Trying::sm_5xx_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Trying::sm_6xx_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Trying::sm_cancelSent(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Trying::sm_notify_response(sip_dialog_subscribeContext& context, bool term)
    {
        sip_dialog_subscribe& ctxt(context.getOwner());

        if (term == true)
        {
            (context.getState()).Exit(context);
            context.clearState();
            try
            {
                ctxt.OnStateChanged(SS_SUBSCRIBE_NOTIFIED);
                context.setState(map_dialog_subscribe::Terminated);
            }
            catch (...)
            {
                context.setState(map_dialog_subscribe::Terminated);
}
            (context.getState()).Entry(context);
        }
        else if (term == false)
    
    {
            sip_dialog_subscribeState& endState = context.getState();

            context.clearState();
            try
            {
                ctxt.OnStateChanged(SS_SUBSCRIBE_NOTIFIED);
                context.setState(endState);
            }
            catch (...)
            {
                context.setState(endState);
}
        }        else
        {
             map_dialog_subscribe_Default::sm_notify_response(context, term);
        }

        return;
    }

    void map_dialog_subscribe_Trying::sm_xxx_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Established::Entry(sip_dialog_subscribeContext& context)

{
        sip_dialog_subscribe& ctxt(context.getOwner());

        ctxt.OnStateChanged(SS_SUBSCRIBE_ESTABLISHED);
        return;
    }

    void map_dialog_subscribe_Established::Default(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Established::sm_1xx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Established::sm_2xx_response(sip_dialog_subscribeContext& context, bool unsub)
    {

        if (unsub == true)
        {
            (context.getState()).Exit(context);
            // No actions.
            context.setState(map_dialog_subscribe::Terminated);
            (context.getState()).Entry(context);
        }
        else if (unsub == false)
    
    {
            // No actions.
        }        else
        {
             map_dialog_subscribe_Default::sm_2xx_response(context, unsub);
        }

        return;
    }

    void map_dialog_subscribe_Established::sm_401_407_421_494_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Authentifying);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Established::sm_notify_response(sip_dialog_subscribeContext& context, bool term)
    {
        sip_dialog_subscribe& ctxt(context.getOwner());

        if (term == true)
        {
            (context.getState()).Exit(context);
            context.clearState();
            try
            {
                ctxt.OnStateChanged(SS_SUBSCRIBE_NOTIFIED);
                context.setState(map_dialog_subscribe::Terminated);
            }
            catch (...)
            {
                context.setState(map_dialog_subscribe::Terminated);
}
            (context.getState()).Entry(context);
        }
        else if (term == false)
    
    {
            sip_dialog_subscribeState& endState = context.getState();

            context.clearState();
            try
            {
                ctxt.OnStateChanged(SS_SUBSCRIBE_NOTIFIED);
                context.setState(endState);
            }
            catch (...)
            {
                context.setState(endState);
}
        }        else
        {
             map_dialog_subscribe_Default::sm_notify_response(context, term);
        }

        return;
    }

    void map_dialog_subscribe_Established::sm_unsubscribeSent(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Trying);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Established::sm_xxx_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Authentifying::Entry(sip_dialog_subscribeContext& context)

{
        sip_dialog_subscribe& ctxt(context.getOwner());

        ctxt.OnStateChanged(SS_SUBSCRIBE_AUTHENTIFYING);
        return;
    }

    void map_dialog_subscribe_Authentifying::Default(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Authentifying::sm_1xx_response(sip_dialog_subscribeContext& context)
    {


        return;
    }

    void map_dialog_subscribe_Authentifying::sm_2xx_response(sip_dialog_subscribeContext& context, bool unsub)
    {

        if (unsub == true)
        {
            (context.getState()).Exit(context);
            // No actions.
            context.setState(map_dialog_subscribe::Terminated);
            (context.getState()).Entry(context);
        }
        else if (unsub == false)
    
    {
            (context.getState()).Exit(context);
            // No actions.
            context.setState(map_dialog_subscribe::Established);
            (context.getState()).Entry(context);
        }        else
        {
             map_dialog_subscribe_Default::sm_2xx_response(context, unsub);
        }

        return;
    }

    void map_dialog_subscribe_Authentifying::sm_authentificationSent(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Trying);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Authentifying::sm_xxx_response(sip_dialog_subscribeContext& context)
    {

        (context.getState()).Exit(context);
        context.setState(map_dialog_subscribe::Terminated);
        (context.getState()).Entry(context);

        return;
    }

    void map_dialog_subscribe_Terminated::Entry(sip_dialog_subscribeContext& context)

{
        sip_dialog_subscribe& ctxt(context.getOwner());

        ctxt.OnStateChanged(SS_SUBSCRIBE_TERMINATED);
        return;
    }

    void map_dialog_subscribe_Terminated::Default(sip_dialog_subscribeContext& context)
    {


        return;
    }
}

/*
 * Local variables:
 *  buffer-read-only: t
 * End:
 */
