## 5 Implementation Details
### The Key Components of Middleware and Their Relations
The agent that is responsible for tracking service, as well as sending a video stream to its client also detects the direction of the target and finds the node that the target is going toward its field of view and clones itself on that node. Using this technique, the tracking agent can precisely track its target. Suppose that the target of tracking agent arrives to an area that is under monitoring of TCO using its second service. As we mentioned, the TCO's second service is a high quality service and it locks the intermediate nodes in order to preserve its QoS. The tracking agent needs to clone itself to a node that is locked by the TCO service. Although SOMM does not provide any facilities for priority based resource management in the network, it is possible to solve the contention problem between the TCO service and the police tracking service using SOMM primitives. To solve this problem, all we need is an agreement on a predefined tuple template between the TCO service and tracking service. This tuple template is for notifying the TCO service that the police needs its node. When the tracking agent reaches a node that is under control of the TCO service, it puts a tuple with the predefined template in tuple space of that node. When the TCO service detects the mentioned tuple, it informs its client that the node is under control of the police and stops sending data. After the tracking agent finished its work and released that node, the TCO service on that node can resume its work. ## 7 Conclusions and Future Works

This paper has presented the so-called SOMM middleware, a service oriented middleware which is developed to support the programmers of GWMSNs applications. The main goal of SOMM was to enable the development of modifiable and scalable applications for GWMSNs. SOMM uses mobile agents as the entities which provide services to network clients and also the concept of code repository as a place to store different agents. In a network which uses SOMM, multiple agents are executed at the same time. This way the network can handle multiple clients simultaneously. Although our initial investigations clearly demonstrate the usefulness of SOMM to support a wide range of GWMSN applications, we also plan to extensively evaluate both qualitatively and quantitatively the advantages brought by SOMM to the application developers, e.g., in terms of code complexity and inter-service dependencies. Also for the reason that the programming using byte-code is a tedious task, we plan to develop a high level language for SOMM to further simplify the task of programming for GWMSNs. ## Acknowledgments

This research has been done by financial support of Shahid Beheshti University research chancellor under Contract No. : 600/915-90/6/14. ## References

* (1) [PERSON]; [PERSON]; [PERSON] A survey on wireless multimedia sensor networks. _Comput. Netw._**2006**, _51_, 921-960. * (2) [PERSON]; [PERSON] Service-oriented sensor-actuator networks: Promises, challenges, and the road ahead. _Comput. Commun._**2007**, _30_, 2627-2648. * (3) [PERSON]; [PERSON]; [PERSON] Agilla: A mobile agent middleware for self-adaptive wireless sensor networks. _ACM TAAS_**2009**, \(4\), doi:10.1145/1552297.1552299. * (4) [PERSON]; [PERSON]; [PERSON]; [PERSON] TinyDB: An Acquisitional query processing system for sensor networks. _ACM TODS_**2005**, _30_, 122-173. * [5] [PERSON]; [PERSON] Middleware: Middleware challenges and approaches for wireless sensor networks. _IEEE Distrib. Syst. Online_**2006**, \(7\), 1. * [6] [PERSON]; [PERSON] Programming models for sensor networks: A survey. _ACM Trans. Sens. Netw._**2008**, \(4\), 1-29. * [7] [PERSON]; [PERSON] Mate: A Tiny Virtual Machine for Sensor Networks. In _Proceedings of the International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-X)_, San Jose, CA, USA, 5-9 October 2002; pp. 85-95. * [8] [PERSON]; [PERSON]; [PERSON] Bridging the Gap: Programming Sensor Networks with Application Specific Virtual Machines.