AWS IoT demonstration using the Avnet Shield (AT&T LTE) and the FRDM-K64F target board.
Dependencies: K64F_FATFileSystem
Fork of mbed-os-example-tls-tls-client by
WNCInterface/WNCSocket/WNCSocket.h@15:6f2798e45099, 2016-12-01 (annotated)
- Committer:
- ampembeng
- Date:
- Thu Dec 01 18:05:38 2016 +0000
- Revision:
- 15:6f2798e45099
Initial commit. Demo works with both the FRDM wired Ethernet and the Avnet Shield wireless modem.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ampembeng | 15:6f2798e45099 | 1 | /* ===================================================================== |
ampembeng | 15:6f2798e45099 | 2 | Copyright © 2016, Avnet (R) |
ampembeng | 15:6f2798e45099 | 3 | |
ampembeng | 15:6f2798e45099 | 4 | Contributors: |
ampembeng | 15:6f2798e45099 | 5 | * James M Flynn, www.em.avnet.com |
ampembeng | 15:6f2798e45099 | 6 | |
ampembeng | 15:6f2798e45099 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
ampembeng | 15:6f2798e45099 | 8 | you may not use this file except in compliance with the License. |
ampembeng | 15:6f2798e45099 | 9 | You may obtain a copy of the License at |
ampembeng | 15:6f2798e45099 | 10 | |
ampembeng | 15:6f2798e45099 | 11 | http://www.apache.org/licenses/LICENSE-2.0 |
ampembeng | 15:6f2798e45099 | 12 | |
ampembeng | 15:6f2798e45099 | 13 | Unless required by applicable law or agreed to in writing, |
ampembeng | 15:6f2798e45099 | 14 | software distributed under the License is distributed on an |
ampembeng | 15:6f2798e45099 | 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
ampembeng | 15:6f2798e45099 | 16 | either express or implied. See the License for the specific |
ampembeng | 15:6f2798e45099 | 17 | language governing permissions and limitations under the License. |
ampembeng | 15:6f2798e45099 | 18 | |
ampembeng | 15:6f2798e45099 | 19 | @file WNCInterface.cpp |
ampembeng | 15:6f2798e45099 | 20 | @version 1.0 |
ampembeng | 15:6f2798e45099 | 21 | @date Sept 2016 |
ampembeng | 15:6f2798e45099 | 22 | |
ampembeng | 15:6f2798e45099 | 23 | ======================================================================== */ |
ampembeng | 15:6f2798e45099 | 24 | |
ampembeng | 15:6f2798e45099 | 25 | |
ampembeng | 15:6f2798e45099 | 26 | #include <stddef.h> |
ampembeng | 15:6f2798e45099 | 27 | #include "WNCInterface.h" |
ampembeng | 15:6f2798e45099 | 28 | |
ampembeng | 15:6f2798e45099 | 29 | #ifndef WNCSOCKET_H_ |
ampembeng | 15:6f2798e45099 | 30 | #define WNCSOCKET_H_ |
ampembeng | 15:6f2798e45099 | 31 | |
ampembeng | 15:6f2798e45099 | 32 | #define SOCK_STREAM 1 //A TCP Socket type |
ampembeng | 15:6f2798e45099 | 33 | #define SOCK_DGRAM 2 //a UDP Socket type |
ampembeng | 15:6f2798e45099 | 34 | |
ampembeng | 15:6f2798e45099 | 35 | /** Socket file descriptor and select wrapper */ |
ampembeng | 15:6f2798e45099 | 36 | class WNCSocket { |
ampembeng | 15:6f2798e45099 | 37 | |
ampembeng | 15:6f2798e45099 | 38 | public: |
ampembeng | 15:6f2798e45099 | 39 | WNCSocket(); |
ampembeng | 15:6f2798e45099 | 40 | ~WNCSocket(); |
ampembeng | 15:6f2798e45099 | 41 | |
ampembeng | 15:6f2798e45099 | 42 | int init(int timeout=1500); |
ampembeng | 15:6f2798e45099 | 43 | |
ampembeng | 15:6f2798e45099 | 44 | int connect(char *url, int type, int port); |
ampembeng | 15:6f2798e45099 | 45 | int disconnect(); |
ampembeng | 15:6f2798e45099 | 46 | void set_blocking(bool blocking, unsigned int timeout); //not used |
ampembeng | 15:6f2798e45099 | 47 | |
ampembeng | 15:6f2798e45099 | 48 | private: |
ampembeng | 15:6f2798e45099 | 49 | int _sock_type; //contains the type of socket this is |
ampembeng | 15:6f2798e45099 | 50 | unsigned int _timeout; //default timeout for all socket transactions |
ampembeng | 15:6f2798e45099 | 51 | }; |
ampembeng | 15:6f2798e45099 | 52 | |
ampembeng | 15:6f2798e45099 | 53 | |
ampembeng | 15:6f2798e45099 | 54 | #endif /* WNCSOCKET_H_ */ |
ampembeng | 15:6f2798e45099 | 55 |