コード例 #1
0
bool SdpParseInsertServiceName(const uint8 size_service_record, const uint8* service_record, char* service_name)
{
	Region value;
	uint8 size_service_name, size_old_service_name, k;
	
	size_service_name= strlen(service_name);
	
	if(size_service_name <= MAX_SIZE_SERVICE_NAME && size_service_name > 0)
	{
		/* if found service name field */
		if(findServiceName(size_service_record, service_record, saServiceName, &value))
		{	
			/* move to size service name value */
			value.end = value.begin;
			value.begin--;
			
			/* read in old value */
			size_old_service_name = RegionReadUnsigned(&value);
			
			if(size_service_name <= size_old_service_name)
			{
				/* move to first string element */
				value.begin++;
				value.end = value.begin + 1;
			
				/* copy string element into array and move to next */
				for(k = 0; k < size_service_name; k++)
				{
					RegionWriteUnsigned(&value, (uint32)service_name[k]);
					value.begin ++;
					value.end ++;
				}
								
				/* fill the rest with spaces */
				for(k = size_service_name; k < size_old_service_name; k++)
				{
					RegionWriteUnsigned(&value, (uint32)' ');
					value.begin++;
					value.end++;
				}
			
				return TRUE;
			}
		}
	}
	/* Failed */
	return FALSE;
}
コード例 #2
0
/* Insert the rfcomm server channel into a service record */
static uint16 insertRfcommServerChannel(const uint8 *ptr, const uint8 *end, uint8 chan)
{
    Region value;
    if(findRfcommServerChannel(ptr, end, &value) && RegionSize(&value) == 1)
    {
		RegionWriteUnsigned(&value, (uint32) chan);
		return 1;
    }
    return 0;
}
コード例 #3
0
/* Insert the supported features into the HFP service record */
static uint16 insertHfpSupportedFeatures(const uint8 *begin, const uint8 *end, uint8 features)
{
	Region value;

	if (findHfpSupportedFeatures(begin, end, &value) && RegionSize(&value) == 2)
	{
		RegionWriteUnsigned(&value, (uint32) features);
		return 1;
	}
	return 0;
}
コード例 #4
0
bool SdpParseInsertPbapRepos(const uint8 size_service_record, const uint8* service_record, uint8 repos)
{
	Region value;
	if(findPbapRepos(size_service_record, service_record, &value))
	{
		RegionWriteUnsigned(&value, repos);
		/* Inserted Successfully */
		return TRUE;
	}
	/* Failed */
	return FALSE;
}
コード例 #5
0
bool SdpParseInsertSupportedFeatures(const uint8 size_service_record, const uint8* service_record, uint16 features)
{
	Region value;

	if (findSupportedFeatures(size_service_record, service_record, &value) && RegionSize(&value) == 2)
	{
		RegionWriteUnsigned(&value, (uint32) features);
		/* Inserted Successfully */
		return TRUE;
	}
	/* Failed */
	return FALSE;
}
コード例 #6
0
bool SdpParseInsertRfcommServerChannel(const uint8 size_service_record, const uint8* service_record, uint8 chan)
{
	Region protocols,value;
    if(findProtocolDescriptorList(size_service_record, service_record, &protocols))
    	if(findServerChannel(&protocols, (uint32) UUID_RFCOMM, &value))
		{
			RegionWriteUnsigned(&value, (uint32) chan);
			/* Inserted Successfully */
			return TRUE;
    	}
	/* Failed */
    return FALSE;
}
コード例 #7
0
/* Insert the profile version number depending on the type of instance initialised */
static uint16 insertHfpProfileVersion(const uint8 *begin, const uint8 *end, hfp_profile profile)
{
    Region value;
    if (findProfileVersion(begin, end, &value))
    {
        if (RegionSize(&value) == 2)
        {
            uint32 profile_version = 0;
            
            if (supportedProfileIsHfp15(profile))
                profile_version = 0x0105;
            else
                profile_version = 0x0101;
            
            /* Insert the data */
            RegionWriteUnsigned(&value, profile_version);
            return 1;
        }
    }

    return 0;
}