![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Catie fork
Dependencies: SDFileSystem X_NUCLEO_IKS01A1
Fork of ATT_AWS_IoT_demo by
WNCInterface/WNCSocket/WNCEndpoint.h@29:537df716ba0b, 2017-04-05 (annotated)
- Committer:
- peyo
- Date:
- Wed Apr 05 16:05:41 2017 +0000
- Revision:
- 29:537df716ba0b
- Parent:
- 15:6f2798e45099
Use IKS01A1 sensors
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 | #include "WNCSocket.h" |
ampembeng | 15:6f2798e45099 | 26 | |
ampembeng | 15:6f2798e45099 | 27 | #ifndef WNCENDPOINT_H |
ampembeng | 15:6f2798e45099 | 28 | #define WNCENDPOINT_H |
ampembeng | 15:6f2798e45099 | 29 | |
ampembeng | 15:6f2798e45099 | 30 | struct EndPointAddr { |
ampembeng | 15:6f2798e45099 | 31 | char IP[16]; |
ampembeng | 15:6f2798e45099 | 32 | unsigned int port; |
ampembeng | 15:6f2798e45099 | 33 | }; |
ampembeng | 15:6f2798e45099 | 34 | |
ampembeng | 15:6f2798e45099 | 35 | class WNCUDPSocket; |
ampembeng | 15:6f2798e45099 | 36 | |
ampembeng | 15:6f2798e45099 | 37 | class WNCEndpoint { |
ampembeng | 15:6f2798e45099 | 38 | friend class WNCUDPSocket; |
ampembeng | 15:6f2798e45099 | 39 | |
ampembeng | 15:6f2798e45099 | 40 | public: |
ampembeng | 15:6f2798e45099 | 41 | WNCEndpoint(void); |
ampembeng | 15:6f2798e45099 | 42 | ~WNCEndpoint(void); |
ampembeng | 15:6f2798e45099 | 43 | |
ampembeng | 15:6f2798e45099 | 44 | /** Reset the address of the endpoint by clearning the internal endpoint IP address |
ampembeng | 15:6f2798e45099 | 45 | \param none |
ampembeng | 15:6f2798e45099 | 46 | \return none. |
ampembeng | 15:6f2798e45099 | 47 | */ |
ampembeng | 15:6f2798e45099 | 48 | void reset_address(void); |
ampembeng | 15:6f2798e45099 | 49 | |
ampembeng | 15:6f2798e45099 | 50 | /** Set the address of the endpoint |
ampembeng | 15:6f2798e45099 | 51 | \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS). |
ampembeng | 15:6f2798e45099 | 52 | \param port The endpoint port |
ampembeng | 15:6f2798e45099 | 53 | \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). |
ampembeng | 15:6f2798e45099 | 54 | */ |
ampembeng | 15:6f2798e45099 | 55 | int set_address(const char* host, const int port); |
ampembeng | 15:6f2798e45099 | 56 | |
ampembeng | 15:6f2798e45099 | 57 | /** Get the IP address of the endpoint |
ampembeng | 15:6f2798e45099 | 58 | \return The IP address of the endpoint. |
ampembeng | 15:6f2798e45099 | 59 | */ |
ampembeng | 15:6f2798e45099 | 60 | char* get_address(void); |
ampembeng | 15:6f2798e45099 | 61 | |
ampembeng | 15:6f2798e45099 | 62 | /** Get the port of the endpoint |
ampembeng | 15:6f2798e45099 | 63 | \return The port of the endpoint |
ampembeng | 15:6f2798e45099 | 64 | */ |
ampembeng | 15:6f2798e45099 | 65 | int get_port(void); |
ampembeng | 15:6f2798e45099 | 66 | |
ampembeng | 15:6f2798e45099 | 67 | private: |
ampembeng | 15:6f2798e45099 | 68 | EndPointAddr _epAddr; |
ampembeng | 15:6f2798e45099 | 69 | }; |
ampembeng | 15:6f2798e45099 | 70 | |
ampembeng | 15:6f2798e45099 | 71 | #endif |
ampembeng | 15:6f2798e45099 | 72 |