Begin implementing FSM manager.

This commit is contained in:
bossiel 2010-02-17 17:31:54 +00:00
parent fdd44e3b92
commit e960e35d2e
9 changed files with 695 additions and 3 deletions

View File

@ -100,6 +100,10 @@
#define TSK_MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif /* TSK_MAX */
#ifndef TSK_NULL
#define TSK_NULL 0
#endif /* TSK_NULL */
#include <stdint.h>
#include <stddef.h>

View File

@ -42,7 +42,7 @@ TSK_BEGIN_DECLS
#include "tsk_memory.h"
#include "tsk_url.h"
#include "tsk_params.h"
#include "tsk_fsm.h"
#include "tsk_time.h"
#include "tsk_timer.h"

235
trunk/tinySAK/src/tsk_fsm.c Normal file
View File

@ -0,0 +1,235 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsk_fsm.c
* @brief Finite-state machine (FSM) implementation.
* @sa http://en.wikipedia.org/wiki/Finite-state_machine.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#include "tsk_fsm.h"
#include "tsk_memory.h"
#include "tsk_debug.h"
int tsk_fsm_exec_nothing(va_list *app){ return 1; }
int tsk_fsm_cond_always(void* data1, void* data2) { return 1; }
int tsk_fsm_set(tsk_fsm_t* self, ...)
{
va_list args;
int guard;
if(!self){
return -1;
}
va_start(args, self);
while((guard=va_arg(args, int)))
{
tsk_fsm_entry_t* entry;
if((entry = TSK_FSM_ENTRY_CREATE()))
{
entry->from = va_arg(args, tsk_fsm_state_id);
entry->action = va_arg(args, tsk_fsm_action_id);
entry->cond = va_arg(args, tsk_fsm_cond);
entry->to = va_arg(args, tsk_fsm_state_id);
entry->exec = va_arg(args, tsk_fsm_exec);
entry->desc = va_arg(args, const char*);
tsk_list_push_back_data(self->entries, (void**)&entry);
}
}
va_end(args);
return 0;
}
int tsk_fsm_set_callback_terminated(tsk_fsm_t* self, tsk_fsm_onterminated callback, const void* callbackdata)
{
if(self)
{
self->callback_term = callback;
self->callback_data = callbackdata;
return 0;
}
return -1;
}
int tsk_fsm_act(tsk_fsm_t* self, tsk_fsm_action_id action, void* cond_data1, void* cond_data2, ...)
{
tsk_list_item_t *item;
va_list ap;
int found = 0;
if(!self){
TSK_DEBUG_ERROR("Null FSM.");
return -1;
}
if(self->current == self->term){
TSK_DEBUG_WARN("The FSM is in the final state.");
return -2;
}
// lock
tsk_safeobj_lock(self);
va_start(ap, cond_data2);
tsk_list_foreach(item, self->entries)
{
tsk_fsm_entry_t* entry = item->data;
if((entry->from != self->current)){
continue;
}
if((entry->action != action) && (entry->action != tsk_fsm_state_any)){
continue;
}
// check condition
if(entry->cond(cond_data1, cond_data2)){
self->current = entry->to;
if(entry->exec){
entry->exec(&ap);
}
found = 1;
// For debug information
if(self->debug){
TSK_DEBUG_INFO("State machine: %s", entry->desc);
}
if(self->current == self->term){
if(self->callback_term){
self->callback_term(self->callback_data);
}
}
break;
}
}
va_end(ap);
// unlock
tsk_safeobj_unlock(self);
if(!found){
TSK_DEBUG_WARN("State machine: No matching state found.");
}
return 0;
}
//=================================================================================================
// fsm object definition
//
static void* tsk_fsm_create(void * self, va_list * app)
{
tsk_fsm_t *fsm = self;
if(fsm)
{
fsm->current = va_arg(*app, tsk_fsm_state_id);
fsm->term = va_arg(*app, tsk_fsm_state_id);
fsm->entries = TSK_LIST_CREATE();
#if defined(DEBUG) || defined(_DEBUG)
fsm->debug = 1;
#endif
tsk_safeobj_init(fsm);
}
return self;
}
static void* tsk_fsm_destroy(void * self)
{
tsk_fsm_t *fsm = self;
if(fsm)
{
tsk_safeobj_deinit(fsm);
TSK_OBJECT_SAFE_FREE(fsm->entries);
}
return self;
}
static const tsk_object_def_t tsk_fsm_def_s =
{
sizeof(tsk_fsm_t),
tsk_fsm_create,
tsk_fsm_destroy,
0,
};
const void *tsk_fsm_def_t = &tsk_fsm_def_s;
//=================================================================================================
// fsm entry object definition
//
static void* tsk_fsm_entry_create(void * self, va_list * app)
{
tsk_fsm_entry_t *fsm_entry = self;
if(fsm_entry)
{
}
return self;
}
static void* tsk_fsm_entry_destroy(void * self)
{
tsk_fsm_entry_t *fsm_entry = self;
if(fsm_entry)
{
//TSK_FREE(fsm_entry->desc);
}
return self;
}
static int tsk_string_cmp(const void *obj1, const void *obj2)
{
const tsk_fsm_entry_t* entry1 = obj1;
const tsk_fsm_entry_t* entry2 = obj2;
if(entry1 && entry2)
{
if(entry1->from == tsk_fsm_state_any){
return -1;
}
else if(entry2->from == tsk_fsm_state_any){
return 1;
}
}
return 0;
}
static const tsk_object_def_t tsk_fsm_entry_def_s =
{
sizeof(tsk_fsm_entry_t),
tsk_fsm_entry_create,
tsk_fsm_entry_destroy,
0,
};
const void *tsk_fsm_entry_def_t = &tsk_fsm_entry_def_s;

122
trunk/tinySAK/src/tsk_fsm.h Normal file
View File

@ -0,0 +1,122 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file tsk_fsm.h
* @brief Finite-state machine (FSM) implementation.
* @sa http://en.wikipedia.org/wiki/Finite-state_machine.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef _TINYSAK_FSM_H_
#define _TINYSAK_FSM_H_
#include "tinySAK_config.h"
#include "tsk_list.h"
#include "tsk_safeobj.h"
TSK_BEGIN_DECLS
#define TSK_FSM_CREATE(state_curr, state_term) tsk_object_new(tsk_fsm_def_t, (tsk_fsm_state_id)state_curr, (tsk_fsm_state_id)state_term)
#define TSK_FSM_ENTRY_CREATE() tsk_object_new(tsk_fsm_entry_def_t)
/*==============
* from (stateA) ---> [fsm_actionB {fsm_cond_B or fsm_cond_always}] ---> to (stateB) ==> execute(fsm_functionB)
* ---> [fsm_actionC {fsm_cond_C or fsm_cond_always}] ---> to (stateC) ==> execute(fsm_functionC)
*
* The starting state is "stateA". If after executing "fsm_actionB" action, "fsm_cond_B" or "fsm_cond_always" condition is true
* then we can move to "stateB". At "stateB" we execute "fsm_functionB" function.
*/
#define tsk_fsm_state_any -0xFFFF
#define tsk_fsm_state_default -0xFFF0
#define tsk_fsm_state_none -0xFF00
#define tsk_fsm_state_final -0xF000
#define tsk_fsm_action_any -0xFFFF
typedef int tsk_fsm_state_id;
typedef int tsk_fsm_action_id;
typedef int (*tsk_fsm_cond)(void*, void*);
typedef int (*tsk_fsm_exec)(va_list *app);
typedef int (*tsk_fsm_onterminated)(const void*);
#define TSK_FSM_ADD(from, action, cond, to, exec, desc)\
1,\
(tsk_fsm_state_id)from, \
(tsk_fsm_action_id)action, \
(tsk_fsm_cond)cond, \
(tsk_fsm_state_id)to, \
(tsk_fsm_exec)exec, \
(const char*)desc
#define TSK_FSM_ADD_ALWAYS(from, action, to, exec, desc) TSK_FSM_ADD(from, action, tsk_fsm_cond_always, to, exec, desc)
#define TSK_FSM_ADD_NOTING(from, action, cond, desc) TSK_FSM_ADD(from, action, cond, from, tsk_fsm_exec_nothing, desc)
#define TSK_FSM_ADD_ALWAYS_NOTHING(from, desc) TSK_FSM_ADD(from, tsk_fsm_action_any, tsk_fsm_cond_always, from, tsk_fsm_exec_nothing, desc)
#define TSK_FSM_ADD_DEFAULT()
#define TSK_FSM_ADD_NULL()\
0
typedef struct tsk_fsm_entry_s
{
TSK_DECLARE_OBJECT;
tsk_fsm_state_id from;
tsk_fsm_action_id action;
tsk_fsm_cond cond;
tsk_fsm_state_id to;
tsk_fsm_exec exec;
const char* desc;
}
tsk_fsm_entry_t;
typedef tsk_list_t tsk_fsm_entries_L_t;
typedef struct tsk_fsm_s
{
TSK_DECLARE_OBJECT;
unsigned debug:1;
tsk_fsm_state_id current;
tsk_fsm_state_id term;
tsk_fsm_entries_L_t* entries;
tsk_fsm_onterminated callback_term;
const void* callback_data;
TSK_DECLARE_SAFEOBJ;
}
tsk_fsm_t;
TINYSAK_API int tsk_fsm_exec_nothing(va_list *app);
TINYSAK_API int tsk_fsm_cond_always(void*, void*);
TINYSAK_API int tsk_fsm_set(tsk_fsm_t* self, ...);
TINYSAK_API int tsk_fsm_set_callback_terminated(tsk_fsm_t* self, tsk_fsm_onterminated callback, const void* callbackdata);
TINYSAK_API int tsk_fsm_act(tsk_fsm_t* self, tsk_fsm_action_id action, void* cond_data1, void* cond_data2, ...);
TINYSAK_GEXTERN const void *tsk_fsm_def_t;
TINYSAK_GEXTERN const void *tsk_fsm_entry_def_t;
TSK_END_DECLS
#endif /* _TINYSAK_FSM_H_ */

View File

@ -50,7 +50,8 @@
#define RUN_TEST_MD5 0
#define RUN_TEST_SHA1 0
#define RUN_TEST_BASE64 0
#define RUN_TEST_UUID 1
#define RUN_TEST_UUID 0
#define RUN_TEST_FSM 1
#if RUN_TEST_LISTS || RUN_TEST_ALL
#include "test_lists.h"
@ -120,6 +121,9 @@
#include "test_uuid.h"
#endif
#if RUN_TEST_FSM || RUN_TEST_ALL
#include "test_fsm.h"
#endif
#ifdef _WIN32_WCE
@ -239,6 +243,11 @@ int main()
test_uuid();
#endif
#if RUN_TEST_FSM || RUN_TEST_ALL
/* test FSM */
test_fsm();
#endif
}
getchar();

View File

@ -0,0 +1,311 @@
/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
#ifndef _TEST_FSM_H_
#define _TEST_FSM_H_
typedef struct test_fsm_ctx_s
{
unsigned unsubscribing:1;
}
test_fsm_ctx_t;
/* ======================== actions ======================== */
typedef enum test_fsm_action_e
{
test_fsm_action_send,
test_fsm_action_1xx,
test_fsm_action_2xx,
test_fsm_action_401_407_421_494,
test_fsm_action_423,
test_fsm_action_300_to_699,
test_fsm_action_cancel,
test_fsm_action_notify,
test_fsm_action_unsubscribe,
test_fsm_action_refresh,
test_fsm_action_transporterror,
test_fsm_action_error,
}
test_fsm_action_t;
/* ======================== execs ======================== */
int test_fsm_exec_Started_2_Trying_X_send(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Trying_X_1xx(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Terminated_X_2xx(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Connected_X_2xx(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Trying_X_401_407_421_494(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Trying_X_423(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Terminated_X_300_to_699(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Terminated_X_cancel(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Trying_2_Trying_X_NOTIFY(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Connected_2_Trying_X_unsubscribe(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Connected_2_Trying_X_refresh(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Connected_2_Connected_X_NOTIFY(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Connected_2_Terminated_X_NOTIFY(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Any_2_Trying_X_hangup(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Any_2_Terminated_X_transportError(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
int test_fsm_exec_Any_2_Terminated_X_Error(va_list *app)
{
const test_fsm_ctx_t* ctx = va_arg(*app, const test_fsm_ctx_t *);
const void* message = va_arg(*app, const void *);
return 0;
}
/* ======================== conds ======================== */
int test_fsm_cond_unsubscribing(test_fsm_ctx_t* ctx, void* data)
{
return ctx->unsubscribing ? 1 : 0;
}
int test_fsm_cond_subscribing(test_fsm_ctx_t* ctx, void* data)
{
return !test_fsm_cond_unsubscribing(ctx, data);
}
int test_fsm_cond_notify_terminated(test_fsm_ctx_t* ctx, void* sipmessage)
{
return 0;
}
int test_fsm_cond_notify_not_terminated(test_fsm_ctx_t* ctx, void* sipmessage)
{
return !test_fsm_cond_notify_terminated(ctx, sipmessage);
}
typedef enum test_fsm_state_e
{
__nil = 0,
Started,
Trying,
Connected,
Terminated
}
test_fsm_state_t;
int test_fsm_onterminated(const test_fsm_ctx_t* ctx)
{
TSK_DEBUG_INFO("FSM in terminal state.");
return 0;
}
#define TEST_FSM_ACTIONS_COUNT 5
test_fsm_action_t test_fsm_tests[TEST_FSM_ACTIONS_COUNT][TEST_FSM_ACTIONS_COUNT] =
{
{ test_fsm_action_send, test_fsm_action_300_to_699 },
{ test_fsm_action_send, test_fsm_action_401_407_421_494, test_fsm_action_2xx, test_fsm_action_refresh, test_fsm_action_300_to_699},
{ test_fsm_action_send, test_fsm_action_401_407_421_494, test_fsm_action_2xx, test_fsm_action_refresh, test_fsm_action_2xx},
{ test_fsm_action_send, test_fsm_action_2xx, test_fsm_action_2xx, test_fsm_action_refresh, test_fsm_action_2xx},
{ test_fsm_action_send, test_fsm_action_423, test_fsm_action_2xx, test_fsm_action_refresh, test_fsm_action_401_407_421_494},
};
void test_fsm()
{
size_t i;
for(i=0; i<TEST_FSM_ACTIONS_COUNT; i++)
{
size_t j;
tsk_fsm_t* fsm = TSK_FSM_CREATE(Started, Terminated);
test_fsm_ctx_t ctx;
ctx.unsubscribing = 0;
tsk_fsm_set_callback_terminated(fsm, test_fsm_onterminated, &ctx);
tsk_fsm_set(fsm,
/*=======================
* === Any ===
*/
// Any -> (transport error) -> Terminated
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, test_fsm_action_transporterror, Terminated, test_fsm_exec_Any_2_Terminated_X_transportError, "test_fsm_exec_Any_2_Terminated_X_transportError"),
// Any -> (transport error) -> Terminated
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, test_fsm_action_error, Terminated, test_fsm_exec_Any_2_Terminated_X_Error, "test_fsm_exec_Any_2_Terminated_X_Error"),
// Any -> (hangup) -> Terminated
// Any -> (hangup) -> Trying
/*=======================
* === Started ===
*/
// Started -> (Send) -> Trying
TSK_FSM_ADD_ALWAYS(Started, test_fsm_action_send, Trying, test_fsm_exec_Started_2_Trying_X_send, "test_fsm_exec_Started_2_Trying_X_send"),
// Started -> (Any) -> Started
TSK_FSM_ADD_ALWAYS_NOTHING(Started, "test_fsm_exec_Started_2_Started_X_any"),
/*=======================
* === Trying ===
*/
// Trying -> (1xx) -> Trying
TSK_FSM_ADD_ALWAYS(Trying, test_fsm_action_1xx, Trying, test_fsm_exec_Trying_2_Trying_X_1xx, "test_fsm_exec_Trying_2_Trying_X_1xx"),
// Trying -> (2xx) -> Terminated
TSK_FSM_ADD(Trying, test_fsm_action_2xx, test_fsm_cond_unsubscribing, Terminated, test_fsm_exec_Trying_2_Terminated_X_2xx, "test_fsm_exec_Trying_2_Terminated_X_2xx"),
// Trying -> (2xx) -> Connected
TSK_FSM_ADD(Trying, test_fsm_action_2xx, test_fsm_cond_subscribing, Connected, test_fsm_exec_Trying_2_Connected_X_2xx, "test_fsm_exec_Trying_2_Connected_X_2xx"),
// Trying -> (401/407/421/494) -> Trying
TSK_FSM_ADD_ALWAYS(Trying, test_fsm_action_401_407_421_494, Trying, test_fsm_exec_Trying_2_Trying_X_401_407_421_494, "test_fsm_exec_Trying_2_Trying_X_401_407_421_494"),
// Trying -> (423) -> Trying
TSK_FSM_ADD_ALWAYS(Trying, test_fsm_action_423, Trying, test_fsm_exec_Trying_2_Trying_X_423, "test_fsm_exec_Trying_2_Trying_X_423"),
// Trying -> (300_to_699) -> Terminated
TSK_FSM_ADD_ALWAYS(Trying, test_fsm_action_300_to_699, Terminated, test_fsm_exec_Trying_2_Terminated_X_300_to_699, "test_fsm_exec_Trying_2_Terminated_X_300_to_699"),
// Trying -> (cancel) -> Terminated
TSK_FSM_ADD_ALWAYS(Trying, test_fsm_action_cancel, Terminated, test_fsm_exec_Trying_2_Terminated_X_cancel, "test_fsm_exec_Trying_2_Terminated_X_cancel"),
// Trying -> (Notify) -> Trying
TSK_FSM_ADD_ALWAYS(Trying, test_fsm_action_notify, Trying, test_fsm_exec_Trying_2_Trying_X_NOTIFY, "test_fsm_exec_Trying_2_Trying_X_NOTIFY"),
// Trying -> (Any) -> Trying
TSK_FSM_ADD_ALWAYS_NOTHING(Trying, "test_fsm_exec_Trying_2_Trying_X_any"),
/*=======================
* === Connected ===
*/
// Connected -> (unsubscribe) -> Trying
TSK_FSM_ADD_ALWAYS(Connected, test_fsm_action_unsubscribe, Trying, test_fsm_exec_Connected_2_Trying_X_unsubscribe, "test_fsm_exec_Connected_2_Trying_X_unsubscribe"),
// Connected -> (refresh) -> Trying
TSK_FSM_ADD_ALWAYS(Connected, test_fsm_action_refresh, Trying, test_fsm_exec_Connected_2_Trying_X_refresh, "test_fsm_exec_Connected_2_Trying_X_refresh"),
// Connected -> (NOTIFY) -> Connected
TSK_FSM_ADD(Connected, test_fsm_action_notify, test_fsm_cond_notify_not_terminated, Connected, test_fsm_exec_Connected_2_Connected_X_NOTIFY, "test_fsm_exec_Connected_2_Connected_X_NOTIFY"),
// Connected -> (NOTIFY) -> Terminated
TSK_FSM_ADD(Connected, test_fsm_action_notify, test_fsm_cond_notify_terminated, Terminated, test_fsm_exec_Connected_2_Terminated_X_NOTIFY, "test_fsm_exec_Connected_2_Terminated_X_NOTIFY"),
// Connected -> (Any) -> Connected
TSK_FSM_ADD_ALWAYS_NOTHING(Connected, "test_fsm_exec_Connected_2_Connected_X_any"),
TSK_FSM_ADD_NULL());
for(j=0; j<TEST_FSM_ACTIONS_COUNT; j++)
{
tsk_fsm_act(fsm, test_fsm_tests[i][j], &ctx, TSK_NULL, &ctx, TSK_NULL /*message*/);
}
TSK_OBJECT_SAFE_FREE(fsm);
printf("\n\n");
}
}
#endif /* _TEST_FSM_H_ */

View File

@ -213,7 +213,6 @@ void tsip_dialog_subscribe_init(tsip_dialog_subscribe_t *self)
self->package = tsk_strdup(param->value);
}
TSIP_DIALOG(self)->expires = 30;
TSIP_DIALOG(self)->callback = TSIP_DIALOG_EVENT_CALLBACK(tsip_dialog_subscribe_event_callback);
/* from */

View File

@ -378,6 +378,10 @@
RelativePath="..\..\tinySAK\test\test_condwait.h"
>
</File>
<File
RelativePath="..\..\tinySAK\test\test_fsm.h"
>
</File>
<File
RelativePath="..\..\tinySAK\test\test_heap.h"
>

View File

@ -377,6 +377,10 @@
RelativePath="..\..\tinySAK\src\tsk_errno.h"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_fsm.h"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_heap.h"
>
@ -499,6 +503,10 @@
RelativePath="..\..\tinySAK\src\tsk_debug.c"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_fsm.c"
>
</File>
<File
RelativePath="..\..\tinySAK\src\tsk_heap.c"
>