Added mutex for multiple SPI devices on the same SPI bus
Fork of cc3000_hostdriver_mbedsocket by
Socket/TCPSocketServer.h@47:cc9a2501e29f, 2014-10-16 (annotated)
- Committer:
- vpcola
- Date:
- Thu Oct 16 13:39:08 2014 +0000
- Revision:
- 47:cc9a2501e29f
- Parent:
- 5:245ac5b73132
Added mutex if used in rtos
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 5:245ac5b73132 | 1 | /* Copyright (C) 2013 mbed.org, MIT License |
Kojto | 0:615c697c33b0 | 2 | * |
Kojto | 0:615c697c33b0 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
Kojto | 0:615c697c33b0 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
Kojto | 0:615c697c33b0 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
Kojto | 0:615c697c33b0 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
Kojto | 0:615c697c33b0 | 7 | * furnished to do so, subject to the following conditions: |
Kojto | 0:615c697c33b0 | 8 | * |
Kojto | 0:615c697c33b0 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
Kojto | 0:615c697c33b0 | 10 | * substantial portions of the Software. |
Kojto | 0:615c697c33b0 | 11 | * |
Kojto | 0:615c697c33b0 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
Kojto | 0:615c697c33b0 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
Kojto | 0:615c697c33b0 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
Kojto | 0:615c697c33b0 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Kojto | 0:615c697c33b0 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Kojto | 0:615c697c33b0 | 17 | */ |
Kojto | 0:615c697c33b0 | 18 | #ifndef TCPSOCKETSERVER_H |
Kojto | 0:615c697c33b0 | 19 | #define TCPSOCKETSERVER_H |
Kojto | 0:615c697c33b0 | 20 | |
Kojto | 0:615c697c33b0 | 21 | #include "Socket/Socket.h" |
Kojto | 0:615c697c33b0 | 22 | #include "TCPSocketConnection.h" |
Kojto | 0:615c697c33b0 | 23 | |
Kojto | 0:615c697c33b0 | 24 | /** TCP Server. |
Kojto | 0:615c697c33b0 | 25 | */ |
Kojto | 0:615c697c33b0 | 26 | class TCPSocketServer : public Socket { |
Kojto | 0:615c697c33b0 | 27 | public: |
Kojto | 0:615c697c33b0 | 28 | /** Instantiate a TCP Server. |
Kojto | 0:615c697c33b0 | 29 | */ |
Kojto | 0:615c697c33b0 | 30 | TCPSocketServer(); |
Kojto | 5:245ac5b73132 | 31 | |
Kojto | 0:615c697c33b0 | 32 | /** Bind a socket to a specific port. |
Kojto | 0:615c697c33b0 | 33 | \param port The port to listen for incoming connections on. |
Kojto | 0:615c697c33b0 | 34 | \return 0 on success, -1 on failure. |
Kojto | 0:615c697c33b0 | 35 | */ |
Kojto | 0:615c697c33b0 | 36 | int bind(int port); |
Kojto | 5:245ac5b73132 | 37 | |
Kojto | 0:615c697c33b0 | 38 | /** Start listening for incoming connections. |
Kojto | 0:615c697c33b0 | 39 | \param backlog number of pending connections that can be queued up at any |
Kojto | 0:615c697c33b0 | 40 | one time [Default: 1]. |
Kojto | 0:615c697c33b0 | 41 | \return 0 on success, -1 on failure. |
Kojto | 0:615c697c33b0 | 42 | */ |
Kojto | 0:615c697c33b0 | 43 | int listen(int backlog=1); |
Kojto | 5:245ac5b73132 | 44 | |
Kojto | 0:615c697c33b0 | 45 | /** Accept a new connection. |
Kojto | 0:615c697c33b0 | 46 | \param connection A TCPSocketConnection instance that will handle the incoming connection. |
Kojto | 0:615c697c33b0 | 47 | \return 0 on success, -1 on failure. |
Kojto | 0:615c697c33b0 | 48 | */ |
Kojto | 0:615c697c33b0 | 49 | int accept(TCPSocketConnection& connection); |
Kojto | 0:615c697c33b0 | 50 | }; |
Kojto | 0:615c697c33b0 | 51 | |
Kojto | 0:615c697c33b0 | 52 | #endif |