예제 #1
0
static gboolean get_mdep_from_rec(const sdp_record_t *rec, uint8_t role,
				uint16_t d_type, uint8_t *mdep, char **desc)
{ DBG("");
	sdp_data_t *list, *feat;
	DBG("");
	if (!desc && !mdep)
		return TRUE;

	list = sdp_data_get(rec, SDP_ATTR_SUPPORTED_FEATURES_LIST);

	if (list->dtd != SDP_SEQ8 && list->dtd != SDP_SEQ16 &&
							list->dtd != SDP_SEQ32)
		return FALSE;

	for (feat = list->val.dataseq; feat; feat = feat->next) {
		sdp_data_t *data_type, *mdepid, *role_t, *desc_t;

		if (feat->dtd != SDP_SEQ8 && feat->dtd != SDP_SEQ16 &&
						feat->dtd != SDP_SEQ32)
			continue;

		mdepid = feat->val.dataseq;
		if (!mdepid)
			continue;

		data_type = mdepid->next;
		if (!data_type)
			continue;

		role_t = data_type->next;
		if (!role_t)
			continue;

		desc_t = role_t->next;

		if (data_type->dtd != SDP_UINT16 || mdepid->dtd != SDP_UINT8 ||
						role_t->dtd != SDP_UINT8)
			continue;

		if (data_type->val.uint16 != d_type ||
					!check_role(role_t->val.uint8, role))
			continue;

		if (mdep)
			*mdep = mdepid->val.uint8;

		if (desc  && desc_t && (desc_t->dtd == SDP_TEXT_STR8 ||
					desc_t->dtd == SDP_TEXT_STR16  ||
					desc_t->dtd == SDP_TEXT_STR32))
			*desc = g_strdup(desc_t->val.str);

		return TRUE;
	}

	return FALSE;
}
예제 #2
0
파일: hdp_util.c 프로젝트: ghent360/bluez
static gboolean get_mdep_from_rec(const sdp_record_t *rec, uint8_t role,
				uint16_t d_type, uint8_t *mdep, char **desc)
{
	sdp_data_t *list, *feat;

	if (desc == NULL && mdep == NULL)
		return TRUE;

	list = sdp_data_get(rec, SDP_ATTR_SUPPORTED_FEATURES_LIST);
	if (list == NULL || !SDP_IS_SEQ(list->dtd))
		return FALSE;

	for (feat = list->val.dataseq; feat; feat = feat->next) {
		sdp_data_t *data_type, *mdepid, *role_t, *desc_t;

		if (!SDP_IS_SEQ(feat->dtd))
			continue;

		mdepid = feat->val.dataseq;
		if (mdepid == NULL)
			continue;

		data_type = mdepid->next;
		if (data_type == NULL)
			continue;

		role_t = data_type->next;
		if (role_t == NULL)
			continue;

		desc_t = role_t->next;

		if (data_type->dtd != SDP_UINT16 || mdepid->dtd != SDP_UINT8 ||
						role_t->dtd != SDP_UINT8)
			continue;

		if (data_type->val.uint16 != d_type ||
					!check_role(role_t->val.uint8, role))
			continue;

		if (mdep != NULL)
			*mdep = mdepid->val.uint8;

		if (desc != NULL && desc_t != NULL &&
						SDP_IS_TEXT_STR(desc_t->dtd))
			*desc = g_strdup(desc_t->val.str);

		return TRUE;
	}

	return FALSE;
}
예제 #3
0
파일: save_data.c 프로젝트: kaisert/kilobot
void save_data()
{
    uint8_t *p = START_EEPROM;
    p = save_id(p);
    p = save_role(p);
    p = save_neighs(p);
    p = save_seeders(p);
    if(get_role() == SEEDER)
        p = save_refs(p);

    uint8_t *cp = START_EEPROM;
    cp = check_id(cp);
    cp = check_role(cp);
    cp = check_neighs(cp);
    cp = check_seeders(cp);
    if(get_role() == SEEDER)
        cp = check_refs(cp);
}