V.06 11/3

Dependencies:   FT6206 SDFileSystem SPI_TFT_ILI9341 TFT_fonts

Fork of ATT_AWS_IoT_demo by attiot

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WNCSocket.h Source File

WNCSocket.h

00001 /* =====================================================================
00002    Copyright © 2016, Avnet (R)
00003 
00004    Contributors:
00005      * James M Flynn, www.em.avnet.com 
00006  
00007    Licensed under the Apache License, Version 2.0 (the "License"); 
00008    you may not use this file except in compliance with the License.
00009    You may obtain a copy of the License at
00010 
00011     http://www.apache.org/licenses/LICENSE-2.0
00012 
00013    Unless required by applicable law or agreed to in writing, 
00014    software distributed under the License is distributed on an 
00015    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
00016    either express or implied. See the License for the specific 
00017    language governing permissions and limitations under the License.
00018 
00019     @file          WNCInterface.cpp
00020     @version       1.0
00021     @date          Sept 2016
00022 
00023 ======================================================================== */
00024 
00025 
00026 #include <stddef.h>
00027 #include "WNCInterface.h"
00028 
00029 #ifndef WNCSOCKET_H_
00030 #define WNCSOCKET_H_
00031 
00032 #define SOCK_STREAM     1  //A TCP Socket type
00033 #define SOCK_DGRAM      2  //a UDP Socket type
00034 
00035 /** Socket file descriptor and select wrapper */
00036 class WNCSocket {
00037   
00038 public:
00039     WNCSocket();
00040     ~WNCSocket();
00041 
00042     int init(int timeout=1500);
00043 
00044     int connect(char *url, int type, int port);
00045     int disconnect();
00046     void set_blocking(bool blocking, unsigned int timeout); //not used
00047     
00048 private:
00049     int _sock_type;                     //contains the type of socket this is
00050     unsigned int _timeout;              //default timeout for all socket transactions
00051 };
00052 
00053 
00054 #endif /* WNCSOCKET_H_ */
00055