Ecore_Timer cyclic recall libxml Parser – wearable Gear S3 Tizen 2.3.2

Ecore_Timer cyclic recall libxml Parser – wearable Gear S3 Tizen 2.3.2

BY 22 Sep 2017 Native Application Development

Hello everyone,

how is it possible to parse a XML file cyclical with the libxml Parser in a service App ( app for wearable, Gear S3 with Tizen 2.3.2)?

The service app shall cyclical parse an xml file and inform the user if the content of the xml file has changed.

I know that ecore_timer_add function can be used to invoke functions cyclical, but this only works if the function to be called by the ecore_timer is an Eina_Bool function.

I also know that the alarm API can be used to launch an application, e.g. I could set an Alarm in the UI-application to launch the service app frequently. 

But both of these options couldn´t help me so far, because:

1. If the service gets constantly new launched, all data is lost, and I can´t compare if the information from the XML file changed from the previous File parsing. 

2.  And the libxml Parser is a void function, so I can´t think of a possibility to use Ecore_Timer

void getParsedData(xmlNode * a_node, appdata_s *ad) {
	xmlNode *cur_node = NULL;
	xmlChar *value = NULL;
	for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
		if (!strcmp((const char*) cur_node->name, "tag"))
			ad->value_type = 1;
		if (!strcmp((const char*) cur_node->name, "price"))
			ad->value_type = 2;
		if (!strcmp((const char*) cur_node->name, "text")) {
			if (ad->value_type == 1) {
				value = cur_node->content;
				strcat(ad->buffer, "Name : ");
				strcat(ad->buffer, (char*) value);
				strcat(ad->buffer, "<br/>");
				dlog_print(DLOG_DEBUG, "GG", "%s\n", ad->buffer);
				ad->value_type = 0;
			} else if (ad->value_type == 2) {
				value = cur_node->content;
				strcat(ad->buffer, "  Price : ");
				strcat(ad->buffer, (char*) value);
				strcat(ad->buffer, "<br/>");
				ad->value_type = 0;
			}
			
		}
		getParsedData(cur_node->children, ad);
	}
}

 

 

 

Written by