A flexible home gateway system for telecare of patients affected by chronic heart failure