예제 #1
0
void amplifier_i::configure(const CF::Properties& props) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration)
{
    static int init = 0;

    std::cout << "Component -AMPLIFIER" << std::endl;
    std::cout << " Props length = " << props.length() << std::endl;

    if (init == 0) {
        if ( props.length() <= 0 ) {
            std::cout << "amplifier: configure called with invalid props.length() - " << props.length() << std::endl;
            return;
        }
        propertySet.length(props.length());
        for (unsigned int i=0; i < props.length(); i++) {
            propertySet[i].id = CORBA::string_dup(props[i].id);
            propertySet[i].value = props[i].value;
        }
        init++;
    }

    for (unsigned int i=0; i < props.length(); i++) {
        if (strcmp(props[i].id, "DCE:06b88d4f-dd38-44e6-bc49-82db0eba5bc6") == 0) {
            CORBA::Float simple_temp;
            props[i].value >>= simple_temp;
            simple_0_value = simple_temp;
            for (unsigned int j=0; j < propertySet.length(); j++ ) {
                if ( strcmp(propertySet[j].id, props[i].id) == 0 ) {
                    propertySet[j].value = props[i].value;
                    break;
                }
            }
        }

        else if (strcmp(props[i].id, "DCE:df91b1a8-9c83-44b4-bf2c-0dbeacb2b6f4") == 0) {
예제 #2
0
void Channel_i::configure(const CF::Properties& props)
throw (CORBA::SystemException,
       CF::PropertySet::InvalidConfiguration,
       CF::PropertySet::PartialConfiguration)
{
    static int init = 0;
    DEBUG(3, Channel, "configure() invoked")

    if (init == 0) {
        if ( props.length() <= 0 ) {
            std::cout << "Channel: configure called with invalid props.length() - " << props.length() << std::endl;
            return;
        }

        propertySet.length(props.length());
        for (unsigned int i=0; i < props.length(); i++) {
            std::cout << "Property Id : " << props[i].id << std::endl;
            propertySet[i].id = CORBA::string_dup(props[i].id);
            propertySet[i].value = props[i].value;
        }
        init = 1;
    }
    for (unsigned int i=0; i < props.length(); i++) {
        if (strcmp(props[i].id, "DCE:1d91b55a-2fcb-4d2d-ad7b-1ee58c32cad8") == 0) {
            //The number of samples per symbol
            CORBA::Short simple_temp;
            props[i].value >>= simple_temp;
            Ns = simple_temp;
            for (unsigned int j=0; j < propertySet.length(); j++ ) {
                if ( strcmp(propertySet[j].id, props[i].id) == 0 ) {
                    propertySet[j].value = props[i].value;
                    break;
                }
            }
        } else if (strcmp(props[i].id, "DCE:eddc66ce-8a82-11dd-ae05-0016769e497b") == 0) {
예제 #3
0
void SPDImplementation::parseUsesDevices(TiXmlElement *elem)
{
    DEBUG(4, SPDImplementation, "In parseUsesDevices.");

    TiXmlElement *uses = elem->FirstChildElement("usesdevice");

    for (; uses; uses = uses->NextSiblingElement("usesdevice")) {
        const char *id = uses->Attribute("id");
        const char *type = uses->Attribute("type");

        CF::Properties props;
        unsigned int i(0);

        TiXmlElement *prop = uses->FirstChildElement("propertyref");
        for (; prop; prop = prop->NextSiblingElement("propertyref")) {
            const char *refid = prop->Attribute("refid");
            const char *value = prop->Attribute("value");
            props.length(i+1);
            props[i].id = CORBA::string_dup (refid);
            props[i].value <<= value;
            i++;
        }

        usesDevice.push_back(new SPDUsesDevice (id, type, props));
    }
}
bool AllocationManager_impl::allocateDevice(const CF::Properties& requestedProperties, ossie::DeviceNode& node, CF::Properties& allocatedProperties, const std::vector<std::string>& processorDeps, const std::vector<ossie::SPD::NameVersionPair>& osDeps)
{
    if (!ossie::corba::objectExists(node.device)) {
        LOG_WARN(AllocationManager_impl, "Not using device for uses_device allocation " << node.identifier << " because it no longer exists");
        return false;
    }
    try {
        if (node.device->usageState() == CF::Device::BUSY) {
            return false;
        }
    } catch ( ... ) {
        // bad device reference or device in an unusable state
        LOG_WARN(AllocationManager_impl, "Unable to verify state of device " << node.identifier);
        return false;
    }

    LOG_TRACE(AllocationManager_impl, "Allocating against device " << node.identifier);

    // Determine whether or not the device in question has the required matching properties
    CF::Properties allocProps;
    if (!checkDeviceMatching(node.prf, allocProps, requestedProperties, processorDeps, osDeps)) {
        LOG_TRACE(AllocationManager_impl, "Matching failed");
        return false;
    }

    // If there are no external properties to allocate, the allocation is
    // already successful
    if (allocProps.length() == 0) {
        LOG_TRACE(AllocationManager_impl, "Allocation requires no capacity from device");
        return true;
    }

    // If there are duplicates in the allocation sequence, break up the allocation into multiple calls
    std::vector<CF::Properties> allocations;
    partitionProperties(allocProps, allocations);

    LOG_TRACE(AllocationManager_impl, "Allocating " << allocProps.length() << " properties ("
              << allocations.size() << " calls)");
    try {
        if (!this->completeAllocations(node.device, allocations)) {
            LOG_TRACE(AllocationManager_impl, "Device lacks sufficient capacity");
            return false;
        }
    } catch (const CF::Device::InvalidCapacity& e) {
        LOG_TRACE(AllocationManager_impl, "Device reported invalid capacity");
        return false;
    } catch (const CF::Device::InsufficientCapacity& e) {
        LOG_TRACE(AllocationManager_impl, "Device reported insufficient capacity");
        return false;
    }

    // Transfer ownership of the allocated properties to the caller
    ossie::corba::move(allocatedProperties, allocProps);
    LOG_TRACE(AllocationManager_impl, "Allocation successful");
    return true;
}
void TestCppsoftpkgDeps::testMemberCallbacks (CF::Properties& testValues)
{
    // Set up notification to call `this->propertyChanged()` when any of the
    // test values are changed via `configure()`.
    LOG_DEBUG(TestCppsoftpkgDeps, "Setting up " << testValues.length() << " member function callback(s)");
    for (CORBA::ULong ii = 0; ii < testValues.length(); ++ii) {
        const std::string id = static_cast<const char*>(testValues[ii].id);
        setPropertyChangeListener(id, this, &TestCppsoftpkgDeps::propertyChanged);
    }
    
    testCallbacks(testValues);
}
CORBA::ULongLong FileManager_impl::getCombinedProperty (const char* propId)
{
    CORBA::ULongLong totalSize = 0;
    for (MountList::iterator mount = mountedFileSystems.begin(); mount != mountedFileSystems.end(); ++mount) {
        CF::Properties props;
        props.length(1);
        props[0].id = propId;
        mount->fs->query(props);
        CORBA::ULongLong fsSize;
        props[0].value >>= fsSize;
        totalSize += fsSize;
    }

    return totalSize;
}
예제 #7
0
void AudioTestSource_i::configure (const CF::Properties& configProperties)
    throw (CF::PropertySet::PartialConfiguration,
           CF::PropertySet::InvalidConfiguration,
           CORBA::SystemException)
{
    CF::Properties validProperties;
    CF::Properties invalidProperties;
    validate(configProperties, validProperties, invalidProperties);

    if (invalidProperties.length() > 0) {
        throw CF::PropertySet::InvalidConfiguration("Properties failed validation.  See log for details.", invalidProperties);
    }

    PropertySet_impl::configure(configProperties);
}
static time_t getModTime (const CF::Properties& properties)
{
    CORBA::ULongLong modTime = 0;
    for (CORBA::ULong ii = 0; ii < properties.length(); ++ii) {
        if (strcmp(properties[ii].id, "MODIFIED_TIME") == 0) {
            properties[ii].value >>= modTime;
        }
    }
예제 #9
0
void AudioTestSource_i::validate(CF::Properties property, CF::Properties& validProps, CF::Properties& invalidProps)
{
    for (CORBA::ULong ii = 0; ii < property.length (); ++ii) {
        std::string id((const char*)property[ii].id);
        // Certian properties cannot be set while the component is running
        if (_started) {
            if (id == "sample-rate") {
            	LOG_WARN(AudioTestSource_i, "'sample-rate' cannot be changed while component is running.")
                CORBA::ULong count = invalidProps.length();
                invalidProps.length(count + 1);
                invalidProps[count].id = property[ii].id;
                invalidProps[count].value = property[ii].value;
            } else if (id == "is-live") {
            	LOG_WARN(AudioTestSource_i, "'is-live' cannot be changed while component is running.")
            	CORBA::ULong count = invalidProps.length();
				invalidProps.length(count + 1);
				invalidProps[count].id = property[ii].id;
				invalidProps[count].value = property[ii].value;
            } else if (id == "stream_id") {
            	LOG_WARN(AudioTestSource_i, "'is-stream_id' cannot be changed while component is running.")
            	CORBA::ULong count = invalidProps.length();
				invalidProps.length(count + 1);
				invalidProps[count].id = property[ii].id;
				invalidProps[count].value = property[ii].value;
            }
        }
    }

}
예제 #10
0
void AutomaticGainControl_i::query(CF::Properties & configProperties)
throw (CORBA::SystemException, CF::UnknownProperties)
{
    if (configProperties.length () == 0) {
        configProperties.length (propertySet.length ());
        for (unsigned int i = 0; i < propertySet.length (); i++) {
            configProperties[i].id = CORBA::string_dup (propertySet[i].id);
            configProperties[i].value = propertySet[i].value;
        }
        return ;
    } else {
        for (unsigned int i = 0; i < configProperties.length(); i++) {
            for (unsigned int j=0; j < propertySet.length(); j++) {
                if ( strcmp(configProperties[i].id, propertySet[j].id) == 0 ) {
                    configProperties[i].value = propertySet[j].value;
                }
            }
        }
    }
}
예제 #11
0
void AutomaticGainControl_i::configure(const CF::Properties& props) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration)
{
    static int init = 0;

    CORBA::Float simple_temp;

    DEBUG(3, AutomaticGainControl, "configure() invoked")

    DEBUG(3, AutomaticGainControl, "props length : " << props.length())

    if (init == 0) {
        if ( props.length() <= 0 ) {
            std::cout << "AutomaticGainControl: configure called with invalid props.length() - " << props.length() << std::endl;
            return;
        }

        propertySet.length(props.length());
        for (unsigned int i=0; i < props.length(); i++) {
            propertySet[i].id = CORBA::string_dup(props[i].id);
            propertySet[i].value = props[i].value;
        }
        init++;
    }

    for (unsigned int i=0; i < props.length(); i++) {
        std::cout << "Property Id : " << props[i].id << std::endl;
        if (strcmp(props[i].id, "DCE:aaf97fa0-d184-4d88-9954-3a1334c73d6d") == 0) {
            // energy_lo
            props[i].value >>= simple_temp;
            omni_mutex_lock oml(accessPrivateData);
            energy_lo = simple_temp;
            // Update value of this property in propertySet also
            for (unsigned int j=0; j < propertySet.length(); j++ ) {
                if ( strcmp(propertySet[j].id, props[i].id) == 0 ) {
                    propertySet[j].value = props[i].value;
                    break;
                }
            }
            DEBUG(3, AutomaticGainControl, "prop (energy_lo): " << simple_temp)

        } else if (strcmp(props[i].id, "DCE:346e17c9-6678-483a-bffb-1909c64bddc0") == 0) {
예제 #12
0
void writeBytestoFile_i::query( CF::Properties & configProperties ) throw (CORBA::SystemException, CF::UnknownProperties)
{
	if( configProperties.length() == 0 )
	{
		configProperties.length( propertySet.length() );
		for( int i = 0; i < propertySet.length(); i++ )
		{
			configProperties[i].id = CORBA::string_dup( propertySet[i].id );
			configProperties[i].value = propertySet[i].value;
		}
		return;
	} else {
		for( int i = 0; i < configProperties.length(); i++ ) {
			for( int j = 0; j < propertySet.length(); j++ ) {
				if( strcmp(configProperties[i].id, propertySet[j].id) == 0 ) {
					configProperties[i].value = propertySet[j].value;
				}
			}
		}
	} // end if-else
}
void AllocationManager_impl::partitionProperties(const CF::Properties& properties, std::vector<CF::Properties>& outProps)
{
    std::set<std::string> identifiers;
    size_t start = 0;
    for (size_t index = 0; index < properties.length(); ++index) {
        const std::string propertyID(properties[index].id);
        if (identifiers.count(propertyID) > 0) {
            // Duplicate property, partition at this point
            outProps.push_back(ossie::corba::slice(properties, start, index));

            start = index;
            identifiers.clear();
        }
        identifiers.insert(propertyID);
    }

    // Copy remaining partition
    if (start < properties.length()) {
        outProps.push_back(ossie::corba::slice(properties, start));
    }
}
예제 #14
0
void
PropertySet_impl::configure (const CF::Properties & configProperties)
throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration,
CF::PropertySet::PartialConfiguration)
{
    if (propertySet.length () == 0)
    {
        propertySet.length (configProperties.length ());

        for (unsigned int i = 0; i < configProperties.length (); i++)
        {
            propertySet[i].id = CORBA::string_dup (configProperties[i].id);

            propertySet[i].value = configProperties[i].value;

            CORBA::Short len = -1;

            propertySet[i].value >>= len;
        }

        return;
    }
bool AllocationManager_impl::checkDeviceMatching(ossie::Properties& prf, CF::Properties& externalProperties, const CF::Properties& dependencyProperties, const std::vector<std::string>& processorDeps, const std::vector<ossie::SPD::NameVersionPair>& osDeps)
{
    // Check for a matching processor, which only happens in deployment
    if (!processorDeps.empty()) {
        if (!ossie::checkProcessor(processorDeps, prf.getAllocationProperties())) {
            LOG_TRACE(AllocationManager_impl, "Device did not match requested processor");
            return false;
        } else {
            LOG_TRACE(AllocationManager_impl, "Matched processor name");
        }
    }

    // Likewise, check for OS name/version
    if (!osDeps.empty()) {
        if (!ossie::checkOs(osDeps, prf.getAllocationProperties())) {
            LOG_TRACE(AllocationManager_impl, "Device did not match requested OS name/version");
            return false;
        } else {
            LOG_TRACE(AllocationManager_impl, "Matched OS name/version");
        }
    }

    int matches = 0;

    for (unsigned int index = 0; index < dependencyProperties.length(); ++index) {
        const CF::DataType& dependency = dependencyProperties[index];
        const std::string propId(dependency.id);
        const ossie::Property* property = prf.getAllocationProperty(propId);

        if (!property) {
            LOG_TRACE(AllocationManager_impl, "Device has no property " << propId);
            return false;
        } else if (property->isExternal()) {
            // Collect properties with an action of "external" for a later
            // allocateCapacity() call
            LOG_TRACE(AllocationManager_impl, "Adding external property " << propId);
            ossie::corba::push_back(externalProperties, ossie::convertDataTypeToPropertyType(dependency, property));
        } else {
            // Evaluate matching properties right now
            if (!checkMatchingProperty(property, dependency)) {
                return false;
            } else {
                ++matches;
            }
        }
    }

    LOG_TRACE(AllocationManager_impl, "Matched " << matches << " properties");
    return true;
}
예제 #16
0
void
amplifier_i::query (CF::Properties & configProperties)
throw (CORBA::SystemException, CF::UnknownProperties)
{
// for queries of zero length, return all id/value pairs in propertySet
    if (configProperties.length () == 0) {
        configProperties.length (propertySet.length ());
        for (unsigned int i = 0; i < propertySet.length (); i++) {
            configProperties[i].id = CORBA::string_dup (propertySet[i].id);
            configProperties[i].value = propertySet[i].value;
        }

        return ;
    } else {
        for (unsigned int i = 0; i < configProperties.length(); i++) {
            for (unsigned int j=0; j < propertySet.length(); j++) {
                if ( strcmp(configProperties[i].id, propertySet[j].id) == 0 ) {
                    configProperties[i].value = propertySet[j].value;
                }
            }
        }
    }
}
/* execute *****************************************************************
    - executes a process on the device
************************************************************************* */
CF::ExecutableDevice::ProcessID_Type ExecutableDevice_impl::execute (
    const char* name, 
    const CF::Properties& options, 
    const CF::Properties& parameters) 
        throw (CORBA::SystemException, 
                CF::Device::InvalidState, 
                CF::ExecutableDevice::InvalidFunction, 
                CF::ExecutableDevice::InvalidParameters, 
                CF::ExecutableDevice::InvalidOptions, 
                CF::InvalidFileName, 
                CF::ExecutableDevice::ExecuteFail)
{
    CORBA::TypeCode_var tc;                       // CORBA type code
    const char* tempStr;                          // temporary character string
    CF::ExecutableDevice::ProcessID_Type PID;     // process ID
    int size = 2 * parameters.length () + 2;      // length of the POSIX argv arguments
    char** argv = new char *[size];               // POSIX arguments
    CORBA::ULong stackSize, priority;             // CORBA unsigned longs for options storage

    // verify device is in the correct state
    if (!isUnlocked () || isDisabled ()) {
        DEBUG(5, ExecutableDevice_impl, "Cannot execute. System is either LOCKED, SHUTTING DOWN or DISABLED.")
        throw (CF::Device::InvalidState("Cannot execute. System is either LOCKED, SHUTTING DOWN or DISABLED."));
    }

    priority = 0;                                 // this is the default value for the priority (it's actually meaningless in this version)
    stackSize = 4096;                             // this is the default value for the stacksize (it's actually meaningless in this version)

    {
    // verify valid options, both STACK_SIZE_ID and PRIORITY_ID must have unsigned-long types
    CF::Properties invalidOptions;
    invalidOptions.length(0);

    for (unsigned i = 0; i < options.length (); i++) {
        tc = options[i].value.type ();

        // extract priority and stack size from the options list
        if (strcmp (options[i].id, CF::ExecutableDevice::PRIORITY_ID)) {
            if (tc->kind () == CORBA::tk_ulong) {
                options[i].value >>= priority; 
            } else {
                LOG_ERROR(ExecutableDevice_impl, "Incorrect type provided for option PRIORITY");
                invalidOptions.length(invalidOptions.length() + 1);
                invalidOptions[invalidOptions.length() - 1] = options[i];
            }
        } else if (strcmp (options[i].id, CF::ExecutableDevice::STACK_SIZE_ID)) {
void FileManager_impl::query (CF::Properties& fileSysProperties)
    throw (CORBA::SystemException, CF::FileSystem::UnknownFileSystemProperties)
{
    TRACE_ENTER(FileManager_impl);

    CF::Properties unknownProps;

    // Lock the mount table shared to allow others to access the file system,
    // but prevent changes to the mount table itself.
    boost::shared_lock<boost::shared_mutex> lock(mountsLock);
    if (fileSysProperties.length () == 0) {
        LOG_TRACE(FileManager_impl, "Query all properties (SIZE, AVAILABLE_SPACE)");
        fileSysProperties.length(2);
        fileSysProperties[0].id = CORBA::string_dup("SIZE");
        CORBA::ULongLong size = getSize();
        size += getCombinedProperty(CF::FileSystem::SIZE);
        fileSysProperties[0].value <<= size;
        fileSysProperties[1].id = CORBA::string_dup("AVAILABLE_SPACE");
        CORBA::ULongLong available = getAvailableSpace();
        available += getCombinedProperty(CF::FileSystem::AVAILABLE_SPACE);
        fileSysProperties[1].value <<= available;
    } else {
        for (CORBA::ULong index = 0; index < fileSysProperties.length(); ++index) {
            if (strcmp (fileSysProperties[index].id, CF::FileSystem::SIZE) == 0) {
                CORBA::ULongLong size = getSize();
                size += getCombinedProperty(CF::FileSystem::SIZE);
                fileSysProperties[index].value <<= size;
            } else if (strcmp(fileSysProperties[index].id, CF::FileSystem::AVAILABLE_SPACE) == 0) {
                CORBA::ULongLong available = getAvailableSpace();
                available += getCombinedProperty(CF::FileSystem::AVAILABLE_SPACE);
                fileSysProperties[index].value <<= available;
            } else {
                CORBA::ULong count = unknownProps.length();
                unknownProps.length(count+1);
                unknownProps[count] = fileSysProperties[index];
            }
        }
    }

    if (unknownProps.length() > 0) {
        throw CF::FileSystem::UnknownFileSystemProperties(unknownProps);
    }

    TRACE_EXIT(FileManager_impl)
}
void TestCppsoftpkgDeps::testCallbacks (CF::Properties& testValues)
{
    // Check whether the property change callbacks are executed for the properties
    // given in 'testValues'. The values in 'testValues' are updated to a boolean
    // that indicates if a callback occurred.

    // Reset the results to prevent false positives.
    testCallbackResults.clear();
    LOG_DEBUG(TestCppsoftpkgDeps, "Calling configure with test values");
    configure(testValues);
    for (CORBA::ULong ii = 0; ii < testValues.length(); ++ii) {
        const std::string id = static_cast<const char*>(testValues[ii].id);
        if (testCallbackResults.count(id)) {
            LOG_DEBUG(TestCppsoftpkgDeps, "Callback was triggered for property " << id);
            testValues[ii].value <<= true;
        } else {
            LOG_DEBUG(TestCppsoftpkgDeps, "Callback was NOT triggered for property " << id);
            testValues[ii].value <<= false;
        }
    }
}
void AmFmPmBasebandDemod_i::configure(const CF::Properties & props) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration)
{
	debugOut("configure() entry");
    AmFmPmBasebandDemod_base::configure(props);
    for (CORBA::ULong i=0; i< props.length(); ++i) {
    	const std::string id = (const char*) props[i].id;
    	PropertyInterface* property = getPropertyFromId(id);
    	if (property->id=="squelch") {
    		squelchThreshold = std::pow(10.0,squelch / 10);
    	}
    	else if (property->id=="freqDeviation" || property->id=="phaseDeviation") {
    		DemodParamsChanged = true;
    	}
    }
    if(debug)
    {
    	std::cout <<"AmFmPmBasebandDemod_i::configure() - freqDeviation    = "<<freqDeviation<<std::endl;
    	std::cout <<"AmFmPmBasebandDemod_i::configure() - phaseDeviation   = "<<phaseDeviation<<std::endl;
    	std::cout <<"AmFmPmBasebandDemod_i::configure() - squelch          = "<<squelch<<std::endl;
    	std::cout <<"AmFmPmBasebandDemod_i::configure() - squelchThreshold = "<<squelchThreshold<<std::endl;
    	std::cout <<"AmFmPmBasebandDemod_i::configure() - debug            = "<<debug<<std::endl;
    }
}
예제 #21
0
void fastfilter_i::configure (const CF::Properties& configProperties)
	throw (CF::PropertySet::PartialConfiguration,
           CF::PropertySet::InvalidConfiguration, CORBA::SystemException)
{
	if (started())
	{
		size_t filtProps=0;
		for (unsigned int index = 0; index < configProperties.length(); ++index)
		{
			if (strcmp(configProperties[index].id,"realFilterCoefficients")==0)
				filtProps++;
			else if (strcmp(configProperties[index].id,"complexFilterCoefficients")==0)
				filtProps++;
			else if (strcmp(configProperties[index].id,"filterProps")==0)
				filtProps++;
		}
		if (filtProps > 1)
		{
			LOG_ERROR(fastfilter_i,"cannot configure multiple combinations of real coefficients cx coefficients and filterProps simultaneously");
			throw CF::PropertySet::InvalidConfiguration("cannot configure multiple combinations of real coefficients cx coefficients and filterProps simultaneously", configProperties);
		}
	}
	fastfilter_base::configure(configProperties);
}