IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 28, 2008, 11:13:46 AM (18 years ago)
Author:
eugene
Message:

load FITSTYPES from external recipe file; merge into camera config

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfig.c

    r17264 r17489  
    15131513}
    15141514
     1515psMetadata *pmConfigFitsType (const pmConfig *config, const psMetadata *camera, const char *fitsType)
     1516{
     1517    bool mdok;
     1518
     1519    PS_ASSERT_PTR_NON_NULL(config, NULL);
     1520    PS_ASSERT_METADATA_NON_NULL(camera, NULL);
     1521    PS_ASSERT_STRING_NON_EMPTY(fitsType, NULL);
     1522
     1523    psMetadataItem *item = psMetadataLookup(camera, "FITSTYPES"); // Item with the file rule of interest
     1524    if (!item) {
     1525        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find FITSTYPES in the camera configuration.");
     1526        return NULL;
     1527    }
     1528
     1529    if (!metadataItemReadFile(item, "FITS Types")) {
     1530        psError(PM_ERR_CONFIG, false, "Unable to read file rules for camera.");
     1531        return NULL;
     1532    }
     1533
     1534    assert(item->type == PS_DATA_METADATA);
     1535    psMetadata *fitstypes = item->data.md; // FITS Types from the camera configuration
     1536
     1537    // select the name from the FITSTYPES
     1538    psMetadata *scheme = psMetadataLookupMetadata(&mdok, fitstypes, fitsType);
     1539    if (!scheme) {
     1540        psWarning("Unable to find specified FITS Type %s in camera configuration.", fitsType);
     1541        return NULL;
     1542    }
     1543
     1544    return scheme;
     1545}
Note: See TracChangeset for help on using the changeset viewer.