Framework for opportunistic sensing based on cloudlets. The framework is composed of a set of distributed and local algorithms that perform an in-network processing to decide which devices are the best to perform a sensing task based on physical distance, communication distance (hops), and semantic similarity between the requested service and the offered one.