void SocketServer::configure( Xml config ) {
	SocketListener::getProtocol().create( config );

	auth = config.getBooleanProperty( "auth" );
	String direction = config.getProperty( "direction" );
	wayIn = direction.equals( "in" ) || direction.equals( "duplex" );
	wayOut = direction.equals( "out" ) || direction.equals( "duplex" );

	if( wayIn )
		topicIn = config.getProperty( "topic-in" );
	if( wayOut )
		topicOut = config.getProperty( "topic-out" );

	contentType = config.getProperty( "msgtype" , "text" );
	if( contentType.equals( "text" ) )
		SocketListener::setMsgType( Message::MsgType_Text );
	else
	if( contentType.equals( "xmlcall" ) )
		SocketListener::setMsgType( Message::MsgType_XmlCall );
	else
		SocketListener::setMsgType( Message::MsgType_Xml );

	port = atoi( config.getProperty( "port" ) );

	// make instance
	Object::setInstance( SocketListener::getName() );
	attachLogger();
}
void SensorFileSysWalker::configureSensor( Xml config ) {
	String focusDir = config.getProperty( "focusDir" , "" );
	if( !focusDir.isEmpty() ) {
		curDisk = focusDir.getMid( 0 , 1 );
		curDir = focusDir;
		curFocusType = FOCUS_DIR;
		logger.logInfo( String( "configureSensor: " ) + "sensor=" + getClass() + " configured with focusDir=" + focusDir );
	}
}
示例#3
0
void HtmHelper::showAcceptWithoutPrediction( int layerPos , int h , int v , HtmSequence *cs , HtmSequence *csa , int action )
{
	Xml xml = logger.getLogSettings();
	String s = xml.getProperty( "showAcceptActions" , "" );
	char l_buf[ 10 ];
	sprintf( l_buf , "%d" , action );
	if( strstr( s , l_buf ) == NULL )
		return;

	int layer = xml.getIntProperty( "showLayer" , -1 );
	if( layer >= 0 && layer != layerPos )
		return;

	String area = String( "l" ) + layerPos + "-h" + h + "-v" + v;
	logger.logDebug( area + ": action=" + action );
	showSequence( "current" , cs );
	showSequence( "stored" , csa );
}
示例#4
0
void ScenarioPlayer::playSignal( Xml cmd ) {
    // find target connector
    MindService *ms = MindService::getService();

    String name = cmd.getAttribute( "name" );
    String component = cmd.getProperty( "component" );
    String connector = cmd.getProperty( "connector" );

    MindRegion *region = ms -> getMindRegion( component );
    ASSERTMSG( region != NULL , "unknown region=" + component );

    NeuroLinkTarget *target = region -> getNeuroLinkTarget( connector );
    if( connector == NULL )
        return;

    NeuroSignal *signal = new NeuroSignal();
    static int z = 0;
    signal -> setId( String( "TM" ) + (++z) );
    logger.logInfo( "send signal name=" + name + " to component=" + component + ", connector=" + connector + ", signal id=" + signal -> getId() + " ..." );
    NeuroSignalSet *set = target -> execute( NULL , signal );
    if( set == NULL ) {
        logger.logDebug( signal -> getId() + ": there are no derived signals from signal id=" + signal -> getId() );
        return;
    }

    // define IDs
    ClassList<NeuroSignal>& signals = set -> getSignals();
    for( int k = 0; k < signals.count(); k++ ) {
        NeuroSignal *signalExecuted = signals.get( k );
        signalExecuted -> setId( signal -> getId() + ".S" + (k+1) );
    }

    // follow links
    MindArea *area = region -> getArea();
    area -> followLinks( signal -> getId() , region , set );
    set -> destroy();
}