V.06 11/3
Dependencies: FT6206 SDFileSystem SPI_TFT_ILI9341 TFT_fonts
Fork of ATT_AWS_IoT_demo by
WNCUDPSocket.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 #ifndef WNCUDPSOCKET_H 00027 #define WNCUDPSOCKET_H 00028 00029 #include "WNCSocket.h" 00030 #include "WNCEndpoint.h" 00031 00032 /** 00033 UDP WNCSocket 00034 */ 00035 class WNCUDPSocket : public WNCSocket, public WNCInterface { 00036 00037 public: 00038 WNCUDPSocket(); 00039 ~WNCUDPSocket(); 00040 00041 int init(void); 00042 00043 /** sendTo - send data to the remote host. 00044 \param remote, a pointer to the endpoint (class) 00045 \param packet, pointer to the buffer to send to the host. 00046 \param length The length of the buffer to send. 00047 \return the number of written bytes on success (>=0) or -1 on failure 00048 */ 00049 int sendTo(WNCEndpoint &remote, char *packet, int length); 00050 00051 /** receiveFrom - receive data from the remote host. 00052 \param remote, a pointer to the endpoint (class) 00053 \param packet, The buffer in which to store the data received from the host. 00054 \param length The maximum length of the buffer. 00055 \return the number of received bytes on success (>=0) or -1 on failure 00056 */ 00057 int receiveFrom(WNCEndpoint &remote, char *buffer, int length); 00058 00059 /** Set blocking or non-blocking mode of the socket and a timeout 00060 \param blocking true for blocking mode, false for non-blocking mode. 00061 \return none. 00062 */ 00063 void set_blocking (bool blocking, unsigned int timeout=1500); 00064 00065 /** Close the socket 00066 \param none 00067 \return 0 if closed successfully, -1 on failure 00068 */ 00069 int close(void); 00070 00071 private: 00072 bool _is_blocking; 00073 unsigned int _btimeout; 00074 }; 00075 00076 #endif 00077 00078
Generated on Tue Jul 12 2022 14:16:20 by 1.7.2