Context-oriented programming for adaptive wireless sensor network software