## 7 Conclusions  
In this paper we present our original library for TinyOS, which we call TinyCoAP. We illustrate its design principles and describe its implementation. Furthermore, we compare it to the CoAP implementation distributed with TinyOS, called CoapBlip. The difference between the design of TinyCoAP and CoapBlip is also explained. Both solutions implement the recent defined CoAP protocol. This protocol aims at embedding RESTful Web services into WSNs. Besides CoAP, we also considered solutions based on the HTTP protocol.  
All the solutions considered in this paper are discussed and evaluated in a real TinyOS based 6 LoWPAN network. We measure the amount of memory occupied at compile time, the latency experienced by a client when retrieving information from a server, and the energy consumed when replying to the client. We also evaluated the performance of a server under high workloads. Finally, we evaluate the average goodput obtained in an 802.15.4 link under a Rayleigh fading model. In particular, the purpose of this test is to evaluate the reliability mechanism provided by CoAP. In our tests, we use HTTP with three different solutions for the transport layer. We consider the use of UDP, TCP and persistent TCP connections. We refer to each of these solutions as HTTP/TCP, HTTP persistent and HTTP/UDP.  
HTTP/UDP is only able to reply to a simple HTTP message without implementing any logic behind it. The purpose of this implementation is to show a lower bound of the performance and to demonstrate how that of TinyCoAP and other solutions are close to it. HTTP/UDP has the best performance in terms of latency and energy. Although TinyCoAP is a more complex implementation, its performance is very similar to that of HTTP/UDP. This proves that its design is able to minimize the impact on the constrained resource of WSNs nodes while achieving good performance.  
TinyCoAP provides the best performance in the rest of the considered parameters. In particular, TinyCoAP shows a significant improvement in performance compared with CoapBlip. The performance of CoapBlip is limited by the adoption of dynamic RAM memory allocation and the use of an external C library. Thanks to a design compliant to the TinyOS programming model and to the static allocation of memory, TinyCoAP solves the problems encountered in CoapBlip, thereby allowing CoAP to realize its full potential. TinyCoAP allows applications to work with a higher payload size than that achieved by CoapBlip or HTTP. This enables TinyCoAP to work with data aggregation, software update of nodes or video and audio applications that generate a high amount of data. Regarding HTTP, the performance obtained by HTTP persistent is an improvement on that provided by the traditional use of HTTP/TCP, which in any case is worse than that obtained by TinyCoAP.  
In conclusion, TinyCoAP offers a lightweight, complete and flexible CoAP-based solution for implementing the Web communication paradigm in TinyOS based WSNs. TinyCoAP solves the problems experienced in CoapBlip, and is able to enhance performance significantly and to minimize the resource consumption. Part of our future work will focus on the design of a CoAP-HTTP proxy. In addition, we also plan to study mechanisms for managing CoAP client subscriptions to the resources offered by a server.  
This work has been partially supported by the Spanish Government's Ministerio de Economia y Competitividad trough project TEC2012-32531, MICINN trough project TEC2009-11453, FEDER, the Catalan Government (Commissionat per a Universitat I Recerca del DIUE) and the European Social Budget.  
The authors declare no conflict of interest.