A Flexible Framework for Ambient Assisted Living Applications