Delta / Mbed 2 deprecated BLE_WIFIControl

Dependencies:   BLE_API WIFI_API_32kRAM mbed nRF51822

Fork of NNN40_WiFi by Delta

Committer:
Marcomissyou
Date:
Thu Feb 05 07:55:58 2015 +0000
Revision:
0:25ffe5869e35
First  commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Marcomissyou 0:25ffe5869e35 1 /* Copyright (C) 2012 mbed.org, MIT License
Marcomissyou 0:25ffe5869e35 2 *
Marcomissyou 0:25ffe5869e35 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Marcomissyou 0:25ffe5869e35 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
Marcomissyou 0:25ffe5869e35 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
Marcomissyou 0:25ffe5869e35 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
Marcomissyou 0:25ffe5869e35 7 * furnished to do so, subject to the following conditions:
Marcomissyou 0:25ffe5869e35 8 *
Marcomissyou 0:25ffe5869e35 9 * The above copyright notice and this permission notice shall be included in all copies or
Marcomissyou 0:25ffe5869e35 10 * substantial portions of the Software.
Marcomissyou 0:25ffe5869e35 11 *
Marcomissyou 0:25ffe5869e35 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Marcomissyou 0:25ffe5869e35 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Marcomissyou 0:25ffe5869e35 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Marcomissyou 0:25ffe5869e35 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Marcomissyou 0:25ffe5869e35 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Marcomissyou 0:25ffe5869e35 17 */
Marcomissyou 0:25ffe5869e35 18 #ifndef ENDPOINT_H
Marcomissyou 0:25ffe5869e35 19 #define ENDPOINT_H
Marcomissyou 0:25ffe5869e35 20
Marcomissyou 0:25ffe5869e35 21 //following are added by Tsungta
Marcomissyou 0:25ffe5869e35 22 #include "stdint.h"
Marcomissyou 0:25ffe5869e35 23 /* For compatibility with BSD code */
Marcomissyou 0:25ffe5869e35 24 struct in_addr {
Marcomissyou 0:25ffe5869e35 25 uint32_t s_addr;
Marcomissyou 0:25ffe5869e35 26 };
Marcomissyou 0:25ffe5869e35 27
Marcomissyou 0:25ffe5869e35 28 struct sockaddr_in {
Marcomissyou 0:25ffe5869e35 29 uint8_t sin_len;
Marcomissyou 0:25ffe5869e35 30 uint8_t sin_family;
Marcomissyou 0:25ffe5869e35 31 uint16_t sin_port;
Marcomissyou 0:25ffe5869e35 32 struct in_addr sin_addr;
Marcomissyou 0:25ffe5869e35 33 char sin_zero[8];
Marcomissyou 0:25ffe5869e35 34 };
Marcomissyou 0:25ffe5869e35 35 //Tsungta
Marcomissyou 0:25ffe5869e35 36 class UDPSocket;
Marcomissyou 0:25ffe5869e35 37
Marcomissyou 0:25ffe5869e35 38 /*
Marcomissyou 0:25ffe5869e35 39 IP Endpoint (address, port)
Marcomissyou 0:25ffe5869e35 40 */
Marcomissyou 0:25ffe5869e35 41 class Endpoint {
Marcomissyou 0:25ffe5869e35 42 friend class UDPSocket;
Marcomissyou 0:25ffe5869e35 43
Marcomissyou 0:25ffe5869e35 44 private:
Marcomissyou 0:25ffe5869e35 45 char UDP_host[15];
Marcomissyou 0:25ffe5869e35 46 int UDP_port;
Marcomissyou 0:25ffe5869e35 47
Marcomissyou 0:25ffe5869e35 48 public:
Marcomissyou 0:25ffe5869e35 49 /* IP Endpoint (address, port)
Marcomissyou 0:25ffe5869e35 50 */
Marcomissyou 0:25ffe5869e35 51 Endpoint(void);
Marcomissyou 0:25ffe5869e35 52
Marcomissyou 0:25ffe5869e35 53 ~Endpoint(void);
Marcomissyou 0:25ffe5869e35 54
Marcomissyou 0:25ffe5869e35 55 /* Reset the address of this endpoint
Marcomissyou 0:25ffe5869e35 56 */
Marcomissyou 0:25ffe5869e35 57 void reset_address(void);
Marcomissyou 0:25ffe5869e35 58
Marcomissyou 0:25ffe5869e35 59 /* Set the address of this endpoint
Marcomissyou 0:25ffe5869e35 60 \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS).
Marcomissyou 0:25ffe5869e35 61 \param port The endpoint port
Marcomissyou 0:25ffe5869e35 62 \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS).
Marcomissyou 0:25ffe5869e35 63 */
Marcomissyou 0:25ffe5869e35 64 int set_address(const char* host, const int port);
Marcomissyou 0:25ffe5869e35 65
Marcomissyou 0:25ffe5869e35 66 /* Get the IP address of this endpoint
Marcomissyou 0:25ffe5869e35 67 \return The IP address of this endpoint.
Marcomissyou 0:25ffe5869e35 68 */
Marcomissyou 0:25ffe5869e35 69 char* get_address(void);
Marcomissyou 0:25ffe5869e35 70
Marcomissyou 0:25ffe5869e35 71 /* Get the port of this endpoint
Marcomissyou 0:25ffe5869e35 72 \return The port of this endpoint
Marcomissyou 0:25ffe5869e35 73 */
Marcomissyou 0:25ffe5869e35 74 int get_port(void);
Marcomissyou 0:25ffe5869e35 75
Marcomissyou 0:25ffe5869e35 76 protected:
Marcomissyou 0:25ffe5869e35 77 char _ipAddress[17];
Marcomissyou 0:25ffe5869e35 78 struct sockaddr_in _remoteHost;
Marcomissyou 0:25ffe5869e35 79
Marcomissyou 0:25ffe5869e35 80 };
Marcomissyou 0:25ffe5869e35 81
Marcomissyou 0:25ffe5869e35 82
Marcomissyou 0:25ffe5869e35 83
Marcomissyou 0:25ffe5869e35 84 #endif