posilani dat
Dependencies: FatFileSystemCpp mbed PowerControl USBHostLite
WiflyInterface/Socket/Socket.h@7:805c16a071d0, 2015-04-20 (annotated)
- Committer:
- jkaderka
- Date:
- Mon Apr 20 18:14:54 2015 +0000
- Revision:
- 7:805c16a071d0
WiflyInterface converted to folder to avoid updating the oficial library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jkaderka | 7:805c16a071d0 | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
jkaderka | 7:805c16a071d0 | 2 | * |
jkaderka | 7:805c16a071d0 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
jkaderka | 7:805c16a071d0 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
jkaderka | 7:805c16a071d0 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
jkaderka | 7:805c16a071d0 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
jkaderka | 7:805c16a071d0 | 7 | * furnished to do so, subject to the following conditions: |
jkaderka | 7:805c16a071d0 | 8 | * |
jkaderka | 7:805c16a071d0 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
jkaderka | 7:805c16a071d0 | 10 | * substantial portions of the Software. |
jkaderka | 7:805c16a071d0 | 11 | * |
jkaderka | 7:805c16a071d0 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
jkaderka | 7:805c16a071d0 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
jkaderka | 7:805c16a071d0 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
jkaderka | 7:805c16a071d0 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
jkaderka | 7:805c16a071d0 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
jkaderka | 7:805c16a071d0 | 17 | */ |
jkaderka | 7:805c16a071d0 | 18 | #ifndef SOCKET_H_ |
jkaderka | 7:805c16a071d0 | 19 | #define SOCKET_H_ |
jkaderka | 7:805c16a071d0 | 20 | |
jkaderka | 7:805c16a071d0 | 21 | #include "Wifly.h" |
jkaderka | 7:805c16a071d0 | 22 | |
jkaderka | 7:805c16a071d0 | 23 | /** Socket file descriptor and select wrapper |
jkaderka | 7:805c16a071d0 | 24 | */ |
jkaderka | 7:805c16a071d0 | 25 | class Socket { |
jkaderka | 7:805c16a071d0 | 26 | public: |
jkaderka | 7:805c16a071d0 | 27 | /** Socket |
jkaderka | 7:805c16a071d0 | 28 | */ |
jkaderka | 7:805c16a071d0 | 29 | Socket(); |
jkaderka | 7:805c16a071d0 | 30 | |
jkaderka | 7:805c16a071d0 | 31 | /** Set blocking or non-blocking mode of the socket and a timeout on |
jkaderka | 7:805c16a071d0 | 32 | blocking socket operations |
jkaderka | 7:805c16a071d0 | 33 | \param blocking true for blocking mode, false for non-blocking mode. |
jkaderka | 7:805c16a071d0 | 34 | \param timeout timeout in ms [Default: (1500)ms]. |
jkaderka | 7:805c16a071d0 | 35 | */ |
jkaderka | 7:805c16a071d0 | 36 | void set_blocking(bool blocking, unsigned int timeout=1500); |
jkaderka | 7:805c16a071d0 | 37 | |
jkaderka | 7:805c16a071d0 | 38 | /** Close the socket file descriptor |
jkaderka | 7:805c16a071d0 | 39 | */ |
jkaderka | 7:805c16a071d0 | 40 | int close(); |
jkaderka | 7:805c16a071d0 | 41 | |
jkaderka | 7:805c16a071d0 | 42 | ~Socket(); |
jkaderka | 7:805c16a071d0 | 43 | |
jkaderka | 7:805c16a071d0 | 44 | protected: |
jkaderka | 7:805c16a071d0 | 45 | bool _blocking; |
jkaderka | 7:805c16a071d0 | 46 | int _timeout; |
jkaderka | 7:805c16a071d0 | 47 | Wifly * wifi; |
jkaderka | 7:805c16a071d0 | 48 | }; |
jkaderka | 7:805c16a071d0 | 49 | |
jkaderka | 7:805c16a071d0 | 50 | |
jkaderka | 7:805c16a071d0 | 51 | #endif /* SOCKET_H_ */ |