Application-aware resource management in wireless and visual sensor networks