Esempio n. 1
0
struct ofono_devinfo *ofono_devinfo_create(struct ofono_modem *modem,
							unsigned int vendor,
							const char *driver,
							void *data)
{
	struct ofono_devinfo *info;
	GSList *l;

	info = g_new0(struct ofono_devinfo, 1);

	info->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_DEVINFO,
						devinfo_remove, info);

	for (l = g_devinfo_drivers; l; l = l->next) {
		const struct ofono_devinfo_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(info, vendor, data) < 0)
			continue;

		info->driver = drv;
		break;
	}

	return info;
}
Esempio n. 2
0
struct ofono_handsfree *ofono_handsfree_create(struct ofono_modem *modem,
					unsigned int vendor,
					const char *driver,
					void *data)
{
	struct ofono_handsfree *hf;
	GSList *l;

	if (driver == NULL)
		return NULL;

	hf = g_try_new0(struct ofono_handsfree, 1);
	if (hf == NULL)
		return NULL;

	hf->atom = __ofono_modem_add_atom(modem,
					OFONO_ATOM_TYPE_HANDSFREE,
					handsfree_remove, hf);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_handsfree_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(hf, vendor, data) < 0)
			continue;

		hf->driver = drv;
		break;
	}

	return hf;
}
Esempio n. 3
0
struct ofono_audio_settings *ofono_audio_settings_create(struct ofono_modem *modem,
							unsigned int vendor,
							const char *driver,
							void *data)
{
	struct ofono_audio_settings *as;
	GSList *l;

	if (driver == NULL)
		return NULL;

	as = g_try_new0(struct ofono_audio_settings, 1);
	if (as == NULL)
		return NULL;

	as->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_AUDIO_SETTINGS,
						audio_settings_remove, as);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_audio_settings_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver) != 0)
			continue;

		if (drv->probe(as, vendor, data) < 0)
			continue;

		as->driver = drv;
		break;
	}

	return as;
}
Esempio n. 4
0
struct ofono_gnss *ofono_gnss_create(struct ofono_modem *modem,
					unsigned int vendor,
					const char *driver,
					void *data)
{
	struct ofono_gnss *gnss;
	GSList *l;

	if (driver == NULL)
		return NULL;

	gnss = g_try_new0(struct ofono_gnss, 1);

	if (gnss == NULL)
		return NULL;

	gnss->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_GNSS,
						gnss_remove, gnss);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_gnss_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(gnss, vendor, data) < 0)
			continue;

		gnss->driver = drv;
		break;
	}

	return gnss;
}
Esempio n. 5
0
struct ofono_oem_raw *ofono_oem_raw_create(struct ofono_modem *modem,
					unsigned int vendor,
					const char *driver,
					void *data)
{
	struct ofono_oem_raw *oemraw = 0;
	GSList *l;

	if (driver == NULL)
		return NULL;

	oemraw = g_try_new0(struct ofono_oem_raw, 1);
	if (oemraw == NULL)
		return NULL;

	oemraw->atom = __ofono_modem_add_atom(modem,
					OFONO_ATOM_TYPE_OEM_RAW,
					oem_raw_remove, oemraw);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_oem_raw_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(oemraw, vendor, data) < 0)
			continue;

		oemraw->driver = drv;
		break;
	}

	return oemraw;
}
Esempio n. 6
0
struct ofono_call_meter *ofono_call_meter_create(struct ofono_modem *modem,
							unsigned int vendor,
							const char *driver,
							void *data)
{
	struct ofono_call_meter *cm;
	GSList *l;

	if (driver == NULL)
		return NULL;

	cm = g_try_new0(struct ofono_call_meter, 1);

	if (cm == NULL)
		return NULL;

	cm->atom = __ofono_modem_add_atom(modem,
						OFONO_ATOM_TYPE_CALL_METER,
						call_meter_remove, cm);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_call_meter_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(cm, vendor, data) < 0)
			continue;

		cm->driver = drv;
		break;
	}

	return cm;
}
Esempio n. 7
0
struct ofono_call_volume *ofono_call_volume_create(struct ofono_modem *modem,
					unsigned int vendor,
					const char *driver,
					void *data)
{
	struct ofono_call_volume *cv;
	GSList *l;

	if (driver == NULL)
		return NULL;

	cv = g_try_new0(struct ofono_call_volume, 1);
	if (cv == NULL)
		return NULL;

	cv->atom = __ofono_modem_add_atom(modem,
					OFONO_ATOM_TYPES_CALL_VOLUME,
					call_volume_remove, cv);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_call_volume_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(cv, vendor, data) < 0)
			continue;

		cv->driver = drv;
		break;
	}

	return cv;
}
Esempio n. 8
0
File: stk.c Progetto: yongsu/oFono
struct ofono_stk *ofono_stk_create(struct ofono_modem *modem,
					unsigned int vendor,
					const char *driver,
					void *data)
{
	struct ofono_stk *stk;
	GSList *l;

	if (driver == NULL)
		return NULL;

	stk = g_try_new0(struct ofono_stk, 1);

	if (stk == NULL)
		return NULL;

	stk->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_STK,
						stk_remove, stk);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_stk_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(stk, vendor, data) < 0)
			continue;

		stk->driver = drv;
		break;
	}

	return stk;
}
Esempio n. 9
0
struct ofono_ussd *ofono_ussd_create(struct ofono_modem *modem,
					unsigned int vendor,
					const char *driver,
					void *data)
{
	struct ofono_ussd *ussd;
	GSList *l;

	if (driver == NULL)
		return NULL;

	ussd = g_try_new0(struct ofono_ussd, 1);

	if (ussd == NULL)
		return NULL;

	ussd->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_USSD,
						ussd_remove, ussd);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_ussd_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(ussd, vendor, data) < 0)
			continue;

		ussd->driver = drv;
		break;
	}

	return ussd;
}
Esempio n. 10
0
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;
}
Esempio n. 11
0
void __ofono_nettime_probe_drivers(struct ofono_modem *modem)
{
	struct ofono_nettime_driver *driver;
	struct ofono_nettime_context *context;
	GSList *l;

	for (l = nettime_drivers; l; l = l->next) {
		driver = l->data;

		context = nettime_context_create(modem, driver);
		if (context == NULL)
			continue;

		__ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_NETTIME,
						context_remove, context);
	}
}
Esempio n. 12
0
File: sms.c Progetto: AndriusA/ofono
/*
 * Create a SMS driver
 *
 * This creates a SMS driver that is hung off a @modem
 * object. However, for the driver to be used by the system, it has to
 * be registered with the oFono core using ofono_sms_register().
 *
 * This is done once the modem driver determines that SMS is properly
 * supported by the hardware.
 */
struct ofono_sms *ofono_sms_create(struct ofono_modem *modem,
					unsigned int vendor,
					const char *driver,
					void *data)
{
	struct ofono_sms *sms;
	GSList *l;

	if (driver == NULL)
		return NULL;

	sms = g_try_new0(struct ofono_sms, 1);

	if (sms == NULL)
		return NULL;

	sms->sca.type = 129;
	sms->ref = 1;
	sms->txq = g_queue_new();
	sms->messages = g_hash_table_new(uuid_hash, uuid_equal);

	sms->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_SMS,
						sms_remove, sms);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_sms_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(sms, vendor, data) < 0)
			continue;

		sms->driver = drv;
		break;
	}

	return sms;
}
Esempio n. 13
0
struct ofono_cdma_netreg *ofono_cdma_netreg_create(struct ofono_modem *modem,
						unsigned int vendor,
						const char *driver,
						void *data)
{
	struct ofono_cdma_netreg *cdma_netreg;
	GSList *l;

	if (driver == NULL)
		return NULL;

	cdma_netreg = g_try_new0(struct ofono_cdma_netreg, 1);
	if (cdma_netreg == NULL)
		return NULL;

	cdma_netreg->status = CDMA_NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
	cdma_netreg->strength = -1;
	cdma_netreg->hdr_strength = -1;

	cdma_netreg->atom = __ofono_modem_add_atom(modem,
					OFONO_ATOM_TYPE_CDMA_NETREG,
					cdma_netreg_remove, cdma_netreg);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_cdma_netreg_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver))
			continue;

		if (drv->probe(cdma_netreg, vendor, data) < 0)
			continue;

		cdma_netreg->driver = drv;
		break;
	}

	return cdma_netreg;
}
Esempio n. 14
0
struct ofono_location_reporting *ofono_location_reporting_create(
						struct ofono_modem *modem,
						unsigned int vendor,
						const char *driver, void *data)
{
	struct ofono_location_reporting *lr;
	GSList *l;

	if (driver == NULL)
		return NULL;

	/* Only D-Bus >= 1.3 supports fd-passing */
	if (DBUS_TYPE_UNIX_FD == -1)
		return NULL;

	lr = g_try_new0(struct ofono_location_reporting, 1);
	if (lr == NULL)
		return NULL;

	lr->atom = __ofono_modem_add_atom(modem,
					OFONO_ATOM_TYPE_LOCATION_REPORTING,
					location_reporting_remove, lr);

	for (l = g_drivers; l; l = l->next) {
		const struct ofono_location_reporting_driver *drv = l->data;

		if (g_strcmp0(drv->name, driver) != 0)
			continue;

		if (drv->probe(lr, vendor, data) < 0)
			continue;

		lr->driver = drv;
		break;
	}

	return lr;
}