emulator: always create emulators in offline state

this allows to fix problem when atom created in online state
are destroyed when modem goes to offline state
This commit is contained in:
Frédéric Danis 2011-02-17 18:23:29 +01:00 committed by Denis Kenzior
parent de02942e77
commit afe16ba22a
3 changed files with 21 additions and 1 deletions

View File

@ -115,7 +115,8 @@ struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
em->type = type;
em->atom = __ofono_modem_add_atom(modem, atom_t, emulator_remove, em);
em->atom = __ofono_modem_add_atom_offline(modem, atom_t,
emulator_remove, em);
return em;
}

View File

@ -189,6 +189,20 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
return atom;
}
struct ofono_atom *__ofono_modem_add_atom_offline(struct ofono_modem *modem,
enum ofono_atom_type type,
void (*destruct)(struct ofono_atom *),
void *data)
{
struct ofono_atom *atom;
atom = __ofono_modem_add_atom(modem, type, destruct, data);
atom->modem_state = MODEM_STATE_OFFLINE;
return atom;
}
void *__ofono_atom_get_data(struct ofono_atom *atom)
{
return atom->data;

View File

@ -148,6 +148,11 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
void (*destruct)(struct ofono_atom *),
void *data);
struct ofono_atom *__ofono_modem_add_atom_offline(struct ofono_modem *modem,
enum ofono_atom_type type,
void (*destruct)(struct ofono_atom *),
void *data);
struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem,
enum ofono_atom_type type);