Beispiel #1
0
void MagicFolderCache::startElement(XML_CSTR name, const XMLAttributes& atts)
{
	if( IN_STATE( PS_FOLDER ) )
	{
		if( MATCH("MagicFolder") )
		{
			_depth++;
			
			// Push this folder path onto the path stack...
			_pathStack = newStringStackItem(_pathStack, atts.getValue(_T("name")));
			
			// Store a folder object which will hold configuration etc.
			_current = new Folder(_pathStack->val.c_str(), _T(""));
			_map->insert(MagicFolderCache::FolderMap::value_type(_pathStack->val, _current));
		}
		else if( MATCH("File") )
		{
			STATE(PS_FILE);
			processFile(atts);
		}
		else
		{
			processUserData(name, atts);
		}
	}
	else if( IN_STATE( PS_FILE ) || IN_STATE( PS_USERDATA ) )
	{
		processUserData(name, atts);
	}
}
/**
 * Function os called periodically of the application is enabled in the system_state
 *
 */
void app_loop() {
		
	if (IN_STATE(TO_SEND) && !(IN_STATE(WAIT_FOR_POWER_ON))) {
		SetOutput();
	} else {
		
		uint8_t objectValue;
		
		/*** Switching Object ***/
		if (TestAndCopyObject (OBJECT_SWITCH , &objectValue, 0)) {
			HandleSwitchingObject(objectValue);
		}
	
		/*** Dimming Objects ***/
		if (TestAndCopyObject (OBJECT_DIM_RED_HUE , &objectValue, 0)) {
			HandleDimmingObject(objectValue, RED_HUE);
		}
		if (TestAndCopyObject (OBJECT_DIM_GREEN_SAT , &objectValue, 0)) {
			HandleDimmingObject(objectValue, GREEN_SAT);
		}
		if (TestAndCopyObject (OBJECT_DIM_BLUE_VAL , &objectValue, 0)) {
			HandleDimmingObject(objectValue, BLUE_VAL);
		}
		
		/*** Brightness Objects ***/
		if (TestAndCopyObject(OBJECT_BRIGHTNESS_RED_HUE, &objectValue, 1)) {
			HandleBrightnessObject(objectValue, RED_HUE);
		}			
		if (TestAndCopyObject(OBJECT_BRIGHTNESS_GREEN_SAT, &objectValue, 1)) {
			HandleBrightnessObject(objectValue, GREEN_SAT);
		}
		if (TestAndCopyObject(OBJECT_BRIGHTNESS_BLUE_VAL, &objectValue, 1)) {
			HandleBrightnessObject(objectValue, BLUE_VAL);
		}
		
		/*** Dim each LED individually (Object blocking function ch.1) ***/
		if (TestAndCopyObject (OBJECT_DIM_INDIVIDUALLY , &objectValue, 0)) {
			HandleDimIndividuallyObject(objectValue);
		}
		
		/***                                                           ***/
		CheckDimmingTimer();
		CheckPowerOnTimer();
		CheckSwitchingStatus();
		CheckPwmTimer();	
		
	}
}
Beispiel #3
0
void MagicFolderCache::endElement(XML_CSTR name)
{
	if( IN_STATE(PS_FOLDER) )
	{
		if( MATCH("MagicFolder") )
		{
			if(_depth == 0)
			{
				_parser->SetParseState(_parent);
				
				// Get rid of the last path stack element.
				PNASSERT(_pathStack->previous == NULL);
				delete _pathStack;
				_pathStack = NULL;
			}
			else
			{
				SStringStack* stackOld = _pathStack;
				
				// Update the path stack...
				_pathStack = _pathStack->previous;
				delete stackOld;
				_depth--;
			}
		}
	}
	else if( IN_STATE(PS_FILE) )
	{
		STATE(PS_FOLDER);
	}
	else if( IN_STATE(PS_USERDATA) )
	{
		if(lastNode)
			lastNode = lastNode->GetParent();
		udNestingLevel--;
		if(udNestingLevel == 0)
			STATE(udBase);
	}
}