emulator: Handle multiple emulator types

This commit is contained in:
Frédéric Danis 2011-02-15 16:06:32 +01:00 committed by Denis Kenzior
parent b5969360d7
commit 421c55bdac
2 changed files with 13 additions and 2 deletions

View File

@ -32,6 +32,7 @@
struct ofono_emulator {
struct ofono_atom *atom;
enum ofono_emulator_type type;
GAtServer *server;
};
@ -94,16 +95,25 @@ struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
enum ofono_emulator_type type)
{
struct ofono_emulator *em;
enum ofono_atom_type atom_t;
DBG("modem: %p, type: %d", modem, type);
if (type == OFONO_EMULATOR_TYPE_DUN)
atom_t = OFONO_ATOM_TYPE_EMULATOR_DUN;
else if (type == OFONO_EMULATOR_TYPE_HFP)
atom_t = OFONO_ATOM_TYPE_EMULATOR_HFP;
else
return NULL;
em = g_try_new0(struct ofono_emulator, 1);
if (em == NULL)
return NULL;
em->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_EMULATOR_DUN,
emulator_remove, em);
em->type = type;
em->atom = __ofono_modem_add_atom(modem, atom_t, emulator_remove, em);
return em;
}

View File

@ -129,6 +129,7 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_CDMA_VOICECALL_MANAGER,
OFONO_ATOM_TYPE_SIM_AUTH,
OFONO_ATOM_TYPE_EMULATOR_DUN,
OFONO_ATOM_TYPE_EMULATOR_HFP,
};
enum ofono_atom_watch_condition {