PIR sensor 2

Fork of PIRSensorWithTwitter by ajeet prajapati

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Endpoint.h Source File

Endpoint.h

00001 /*
00002  * Copyright (C) 2013 gsfan, MIT License
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00005  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00006  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00007  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00008  * furnished to do so, subject to the following conditions:
00009  *
00010  * The above copyright notice and this permission notice shall be included in all copies or
00011  * substantial portions of the Software.
00012  *
00013  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00014  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00015  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00016  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00017  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00018  */
00019 /* Copyright (C) 2014 Wiznet, MIT License
00020  *  port to the Wiznet Module WizFi250
00021  */
00022 /* Copyright (C) 2017 Wiznet, MIT License
00023  *  port to the Wiznet Module WizFi310
00024  */
00025 
00026 #ifndef ENDPOINT_H
00027 #define ENDPOINT_H
00028 
00029 #include "WizFi310.h"
00030 
00031 class UDPSocket;
00032 
00033 /**
00034 IP Endpoint (address, port)
00035 */
00036 class Endpoint {
00037     friend class UDPSocket;
00038 
00039 public:
00040     /** IP Endpoint (address, port)
00041      */
00042     Endpoint(void);
00043 
00044     ~Endpoint(void);
00045 
00046     /** Reset the address of this endpoint
00047      */
00048     void reset_address(void);
00049 
00050     /** Set the address of this endpoint
00051     \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS).
00052     \param port The endpoint port
00053     \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
00054      */
00055     int  set_address(const char* host, const int port);
00056 
00057     /** Get the IP address of this endpoint
00058     \return The IP address of this endpoint.
00059      */
00060     char* get_address(void);
00061 
00062     /** Get the port of this endpoint
00063     \return The port of this endpoint
00064      */
00065     int get_port(void);
00066 
00067 protected:
00068     char _ipAddress[16];
00069     int _port;
00070     WizFi310 * _ewizfi310;
00071 };
00072 
00073 #endif