An approach towards adaptivity in wireless sensor networks