## 2 Related Works  
There have been various works addressing high-level WSN middle-wares but to the best of our knowledge, there is no WMSN middleware in the literature. The current WSN middle-ware programming approaches can be classified into low-level programming models and high-level programming models [6]. Middle-wares like Mate [7, 8], Impala [9] and Agilla [3, 10] which use a low-level programming model, take a platform-centric view and focus on abstracting hardware and allowing flexible control of nodes. High-level programming models like TinyDB [4], MiLAN [11], Cougar [12] and Kairos [13] take an application-centric view instead of the platform-centric view and address how easily application logics can be programmed. High-level programming models are further divided into two types: group-level abstraction and network-level abstraction. Group-level abstractions provide a set of programming primitives to handle a group of nodes as a single entity while network-level abstractions, also known as macro-programming, treat the whole network as a single abstract machine. intelligently move or clone themselves into the desired locations based on network changes. This method is more suitable than the flooding mechanisms that Mate uses for the same purpose (issues relevant with the incorporation of mobile agents in WSNs and WMSNs have been thoroughly investigated in research works such as [15-18]). Impala [9] is a middleware designed for the ZebraNet project [19] and its goal is to enable application modularity, adaptability to dynamic environments, and separability. Its modular design allows easy and efficient on-the-fly reprogramming via wireless channel. However, Impala is designed to run only on pocket PC handheld and its nature is not suitable for devices with limited resources. As we mentioned earlier, Cougar [12] and TinyDB [4] fall within the category of high-level abstractions for sensor network programming. They are designed for use by relatively simple data collection applications such as environmental monitoring applications. They allow users to issue queries in a declarative SQL-like language. Both Cougar and TinyDB are concerned with power conservation and providing query processing strategies that aim to conserve resources but, TinyDB is more sophisticated than Cougar [20]. TinyDB can calculate the frequency of sampling that is required to extend the battery life of a node, and also uses a routing structure called a semantic routing tree to help sensor nodes accurately determine when queries need to be routed to their children in the routing tree. Although sensor database systems are easy to use, a key limitation of these systems is the assumption that sensor nodes are largely homogeneous and therefore they are not suitable for heterogeneous sensor networks. Different research teams have recently developed macro-programming languages and service-oriented approaches for sensor networks. Kairos [13] employs a macro-programming approach to manage sensors by enabling developers to translate global program behavior to local node behavior and provides programming abstractions form anipulating individual nodes, accessing their neighbors, and acquiring their data. Kairos focuses on providing a small set of constructs, containing only abstractions for nodes, one-hop neighbors, and remote data access and it is language independent so that it can be implemented as an extension to existing programming languages. MiLAN [11] middleware takes a different approach to the previously discussed solutions in that it builds on existing networking and service discovery protocols using a plug-in mechanism to integrate arbitrary protocols. It provides a data service that supports QoS. Applications submit a query and specify their sensing and QoS requirements to the middleware in terms of graphs describing sensor quality of service and state-based variable requirements.