/*************************************************************************** * FUNCTION NAME * SpProfileCreateSeqRecord * * DESCRIPTION * This function creates the Profile Sequence record for the * profile pointed to by pProfile. The Profile Sequence record to * build is pointed to by pSeqRecord. * ***************************************************************************/ SpStatus_t SpProfileCreateSeqRecord(SpProfile_t pProfile, SpProfileSeqDescRecord_t *pSeqRecord) { SpHeader_t header; SpTagValue_t tagValue; SpStatus_t spStatus; /* Get the profiles header */ spStatus = SpProfileGetHeader (pProfile, &header); if (SpStatSuccess != spStatus) { return spStatus; } /* Copy the manufacturer, model, attributes and technology fields into the sequence record */ pSeqRecord->DeviceManufacturer = header.DeviceManufacturer; pSeqRecord->DeviceModel = header.DeviceModel; pSeqRecord->DeviceAttributes.hi = header.DeviceAttributes.hi; pSeqRecord->DeviceAttributes.lo = header.DeviceAttributes.lo; /* Get the technology tag*/ spStatus = SpTagGetById(pProfile, SpTagTechnology, &tagValue); if (SpStatSuccess != spStatus) pSeqRecord->Technology = SpSigNone; else pSeqRecord->Technology = tagValue.Data.Signature; /* Get the manufacturer description */ spStatus = SpTagGetById(pProfile, SpTagDeviceMfgDesc, &tagValue); if (SpStatSuccess != spStatus) { spStatus = SpStringToTextDesc("", &tagValue.Data.TextDesc); if (SpStatSuccess != spStatus) { return spStatus; } } pSeqRecord->DeviceManufacturerDesc = tagValue.Data.TextDesc; /* Get the model description */ spStatus = SpTagGetById(pProfile, SpTagDeviceModelDesc, &tagValue); if (SpStatSuccess != spStatus) { spStatus = SpStringToTextDesc("", &tagValue.Data.TextDesc); if (SpStatSuccess != spStatus) { return spStatus; } } pSeqRecord->DeviceModelDesc = tagValue.Data.TextDesc; return SpStatSuccess; } /* SpProfileCreateSeqRecord */
/*-------------------------------------------------------------------- * DESCRIPTION * Return the Tag from the profile. * If the tag is MultiLang return Ascii * * AUTHOR * doro * * DATE CREATED * October 23, 1995 *------------------------------------------------------------------*/ SpStatus_t KSPAPI SpProfileLoadTag( char *Filename, SpFileProps_t *Props, SpTagId_t TagId, SpTagValue_t FAR *Value) { SpStatus_t Status = SpStatSuccess; SpTagType_t TagType; SpUnicodeInfo_t StringInfo; KpInt32_t StringLength; KpChar_p Text; KpInt16_t Language = 0; KpInt16_t Country = 0; Status = SpProfileLoadTagEx(Filename, Props,TagId,Value); if (SpStatSuccess == Status) { if (Sp_AT_MultiLanguage == Value->TagType) { StringInfo = Value->Data.MultiLang.StringInfo[0]; StringLength = StringInfo.StringLength + 1; Text = SpMalloc (StringLength); SpTagGetType(SPICCVER23, TagId, &TagType); if (Sp_AT_Text == TagType) { Status = MultiLangToMLString(Value, &Language, &Country, &StringLength, Text); SpFreeMultiLang(&Value->Data.MultiLang); Value->TagType = TagType; Value->Data.Text = Text; } else if (Sp_AT_TextDesc == TagType) { Status = MultiLangToMLString(Value, &Language, &Country, &StringLength, Text); SpFreeMultiLang(&Value->Data.MultiLang); Status = SpStringToTextDesc(Text, &Value->Data.TextDesc); Value->TagType = TagType; SpFree (Text); } else { SpFree (Text); /* what's going on? something must be wrong! */ } } } return (Status); }
/*************************************************************************** * FUNCTION NAME * SpProfileSetLinkDesc * * DESCRIPTION * This function creates the Profile Description tag for the * device link profile pointed to by pProfile. The information needed * to form the description string is contained in the SpDevLinkPB * structure pointed to by pDevLinkDesc. The description string * is formed by taking the manufacture, model and device color space * from the first profile in the profile list and taking the * manufacturer, model and connection color space from the last profile * in the list. * ***************************************************************************/ SpStatus_t SpProfileSetLinkDesc(SpProfile_t pProfile, SpDevLinkPB_p pDevLinkDesc) { KpTChar_t manufacturer1[SpMaxTextDesc], model1[SpMaxTextDesc]; KpTChar_t manufacturer2[SpMaxTextDesc], model2[SpMaxTextDesc]; KpTChar_p pDescStr; KpInt32_t length; SpProfListEntry_p pCurProfEntry; SpTagValue_t tagValue; SpStatus_t spStatus; /* Get the manufacturer information from the first profile */ pCurProfEntry = pDevLinkDesc->pProfileList; strcpy (manufacturer1, "Unknown"); spStatus = SpTagGetById(pCurProfEntry->profile, SpTagDeviceMfgDesc, &tagValue); if (SpStatSuccess == spStatus) { length = sizeof (manufacturer1); SpTagGetString(&tagValue, &length, manufacturer1); SpTagFree(&tagValue); } /* Get the model information from the first profile */ strcpy(model1, "Unknown"); spStatus = SpTagGetById(pCurProfEntry->profile, SpTagDeviceModelDesc, &tagValue); if (SpStatSuccess == spStatus) { length = sizeof (model1); SpTagGetString(&tagValue, &length, model1); SpTagFree(&tagValue); } /* Get the manufacturer information from the last profile */ pCurProfEntry = pDevLinkDesc->pProfileList + (pDevLinkDesc->numProfiles - 1); strcpy(manufacturer2, "Unknown"); spStatus = SpTagGetById(pCurProfEntry->profile, SpTagDeviceMfgDesc, &tagValue); if (SpStatSuccess == spStatus) { length = sizeof (manufacturer2); SpTagGetString(&tagValue, &length, manufacturer2); SpTagFree(&tagValue); } /* Get the model information from the last profile */ strcpy(model2, "Unknown"); spStatus = SpTagGetById(pCurProfEntry->profile, SpTagDeviceModelDesc, &tagValue); if (SpStatSuccess == spStatus) { length = sizeof (model2); SpTagGetString(&tagValue, &length, model2); SpTagFree(&tagValue); } /* Allocate memory for the description string */ length = strlen(manufacturer1) + strlen(model1) + strlen(manufacturer2) + strlen(model2) + 7; pDescStr = (KpTChar_p)allocBufferPtr(length+1); if (NULL == pDescStr) { return SpStatMemory; } /* Form the description string */ /* sprintf(pDescStr, "%s %s %s to %s %s %s", manufacturer1, model1, colorSpace1, manufacturer2, model2, colorSpace2); */ strcpy(pDescStr, manufacturer1); strcat(pDescStr, " "); strcat(pDescStr, model1); strcat(pDescStr, " to "); strcat(pDescStr, manufacturer2); strcat(pDescStr, " "); strcat(pDescStr, model2); /* Convert the string to a text description tag and add it to the profile */ spStatus = SpStringToTextDesc(pDescStr, &tagValue.Data.TextDesc); freeBufferPtr(pDescStr); if (SpStatSuccess != spStatus) { return spStatus; } tagValue.TagId = SpTagProfileDesc; tagValue.TagType = Sp_AT_TextDesc; spStatus = SpTagSet (pProfile, &tagValue); SpFreeTextDesc (&tagValue.Data.TextDesc); return spStatus; } /* SpProfileSetLinkDesc */