![](/media/cache/profiles/dcee66ccb49a492ae42c446c0cc01b3a.jpg.50x50_q85.jpg)
Axeda Ready Demo for Freescale FRDM-KL46Z as accident alert system
Dependencies: FRDM_MMA8451Q KL46Z-USBHost MAG3110 SocketModem TSI mbed FATFileSystem
Fork of AxedaGo-Freescal_FRDM-KL46Z by
SocketModem/Socket/Socket.h@2:2f9019c5a9fc, 2014-07-02 (annotated)
- Committer:
- AxedaCorp
- Date:
- Wed Jul 02 19:57:37 2014 +0000
- Revision:
- 2:2f9019c5a9fc
- Parent:
- 0:65004368569c
ip switch
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AxedaCorp | 0:65004368569c | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
AxedaCorp | 0:65004368569c | 2 | * |
AxedaCorp | 0:65004368569c | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
AxedaCorp | 0:65004368569c | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
AxedaCorp | 0:65004368569c | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
AxedaCorp | 0:65004368569c | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
AxedaCorp | 0:65004368569c | 7 | * furnished to do so, subject to the following conditions: |
AxedaCorp | 0:65004368569c | 8 | * |
AxedaCorp | 0:65004368569c | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
AxedaCorp | 0:65004368569c | 10 | * substantial portions of the Software. |
AxedaCorp | 0:65004368569c | 11 | * |
AxedaCorp | 0:65004368569c | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
AxedaCorp | 0:65004368569c | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
AxedaCorp | 0:65004368569c | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
AxedaCorp | 0:65004368569c | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
AxedaCorp | 0:65004368569c | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
AxedaCorp | 0:65004368569c | 17 | */ |
AxedaCorp | 0:65004368569c | 18 | #ifndef SOCKET_H_ |
AxedaCorp | 0:65004368569c | 19 | #define SOCKET_H_ |
AxedaCorp | 0:65004368569c | 20 | |
AxedaCorp | 0:65004368569c | 21 | #include "IPStack.h" |
AxedaCorp | 0:65004368569c | 22 | |
AxedaCorp | 0:65004368569c | 23 | /** Socket file descriptor and select wrapper |
AxedaCorp | 0:65004368569c | 24 | */ |
AxedaCorp | 0:65004368569c | 25 | class Socket { |
AxedaCorp | 0:65004368569c | 26 | public: |
AxedaCorp | 0:65004368569c | 27 | /** Socket |
AxedaCorp | 0:65004368569c | 28 | */ |
AxedaCorp | 0:65004368569c | 29 | Socket(); |
AxedaCorp | 0:65004368569c | 30 | |
AxedaCorp | 0:65004368569c | 31 | /** Set blocking or non-blocking mode of the socket and a timeout on |
AxedaCorp | 0:65004368569c | 32 | blocking socket operations |
AxedaCorp | 0:65004368569c | 33 | \param blocking true for blocking mode, false for non-blocking mode. |
AxedaCorp | 0:65004368569c | 34 | \param timeout timeout in ms [Default: (1500)ms]. |
AxedaCorp | 0:65004368569c | 35 | */ |
AxedaCorp | 0:65004368569c | 36 | void set_blocking(bool blocking, unsigned int timeout=1500); |
AxedaCorp | 0:65004368569c | 37 | |
AxedaCorp | 0:65004368569c | 38 | /** Close the socket file descriptor |
AxedaCorp | 0:65004368569c | 39 | */ |
AxedaCorp | 0:65004368569c | 40 | int close(); |
AxedaCorp | 0:65004368569c | 41 | |
AxedaCorp | 0:65004368569c | 42 | ~Socket(); |
AxedaCorp | 0:65004368569c | 43 | |
AxedaCorp | 0:65004368569c | 44 | protected: |
AxedaCorp | 0:65004368569c | 45 | bool _blocking; |
AxedaCorp | 0:65004368569c | 46 | int _timeout; |
AxedaCorp | 0:65004368569c | 47 | mts::IPStack * ip; |
AxedaCorp | 0:65004368569c | 48 | }; |
AxedaCorp | 0:65004368569c | 49 | |
AxedaCorp | 0:65004368569c | 50 | |
AxedaCorp | 0:65004368569c | 51 | #endif /* SOCKET_H_ */ |