IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 17, 2007, 5:14:09 PM (20 years ago)
Author:
Paul Price
Message:

Adding FPA.EXPOSURE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsStandard.c

    r11091 r11132  
    4242    psAbort(__func__, "Should never ever get here.\n");
    4343    return NAN;
     44}
     45
     46// FPA.FILTER
     47psMetadataItem *p_pmConceptParse_FPA_FILTER(const psMetadataItem *concept,
     48        const psMetadataItem *pattern,
     49        const psMetadata *cameraFormat,
     50        const pmFPA *fpa,
     51        const pmChip *chip,
     52        const pmCell *cell)
     53{
     54    assert(concept);
     55    assert(pattern);
     56    assert(fpa);
     57    assert(fpa->camera);
     58
     59    if (concept->type != PS_DATA_STRING) {
     60        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not STR\n",
     61                pattern->name, concept->type);
     62        return NULL;
     63    }
     64
     65    bool mdok;                          // Status of MD lookup
     66    psMetadata *filters = psMetadataLookupMetadata(&mdok, fpa->camera, "FILTER.ID");
     67    if (!mdok || !filters) {
     68        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FILTER.ID in camera configuration.\n");
     69        return NULL;
     70    }
     71
     72    const char *key = concept->data.str;        // The name to look up
     73    psString value = psMetadataLookupStr(&mdok, filters, key); // Value to use
     74    if (!mdok || !value || strlen(value) == 0) {
     75        psError(PS_ERR_UNEXPECTED_NULL, true,
     76                "Unable to find %s in FILTER.ID in camera configuration.\n", key);
     77        return NULL;
     78    }
     79
     80    return psMetadataItemAllocStr(pattern->name, pattern->comment, value);
     81}
     82
     83psMetadataItem *p_pmConceptFormat_FPA_FILTER(const psMetadataItem *concept,
     84        const psMetadata *cameraFormat,
     85        const pmFPA *fpa,
     86        const pmChip *chip,
     87        const pmCell *cell)
     88{
     89    assert(concept);
     90    assert(fpa);
     91    assert(fpa->camera);
     92
     93    if (concept->type != PS_DATA_STRING) {
     94        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not STR\n",
     95                concept->name, concept->type);
     96        return NULL;
     97    }
     98
     99    bool mdok;                          // Status of MD lookup
     100    psMetadata *filters = psMetadataLookupMetadata(&mdok, fpa->camera, "FILTER.ID");
     101    if (!mdok || !filters) {
     102        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FILTER.ID in camera configuration.\n");
     103        return NULL;
     104    }
     105
     106    psMetadataIterator *iter = psMetadataIteratorAlloc(filters, PS_LIST_HEAD, NULL); // Iterator for filters
     107    psMetadataItem *item;               // Item from iteration
     108    char *name = NULL;                  // The winning name
     109    while ((item = psMetadataGetAndIncrement(iter))) {
     110        if (item->type != PS_DATA_STRING) {
     111            psWarning("Type for %s (%x) in FILTER.ID in camera configuration is not STR\n",
     112                      item->name, item->type);
     113            continue;
     114        }
     115        if (strcmp(item->data.str, concept->data.str)) {
     116            name = item->name;
     117            break;
     118        }
     119    }
     120    if (!name) {
     121        psError(PS_ERR_UNEXPECTED_NULL, false,
     122                "Unable to find any filter matching %s in FILTER.ID in camera configuration.\n",
     123                concept->data.str);
     124        return NULL;
     125    }
     126
     127    return psMetadataItemAllocStr(concept->name, concept->comment, name);
    44128}
    45129
Note: See TracChangeset for help on using the changeset viewer.