Exploiting temporal and spatial correlation in wireless sensor networks