Murata Type YD Wi-Fi driver
Dependents: easy-connect-type-yd
SNICInterface/Socket/Endpoint.cpp@0:35a2186cf186, 2017-07-12 (annotated)
- Committer:
- MACRUM
- Date:
- Wed Jul 12 10:49:10 2017 +0000
- Revision:
- 0:35a2186cf186
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:35a2186cf186 | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
MACRUM | 0:35a2186cf186 | 2 | * |
MACRUM | 0:35a2186cf186 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
MACRUM | 0:35a2186cf186 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
MACRUM | 0:35a2186cf186 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
MACRUM | 0:35a2186cf186 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
MACRUM | 0:35a2186cf186 | 7 | * furnished to do so, subject to the following conditions: |
MACRUM | 0:35a2186cf186 | 8 | * |
MACRUM | 0:35a2186cf186 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
MACRUM | 0:35a2186cf186 | 10 | * substantial portions of the Software. |
MACRUM | 0:35a2186cf186 | 11 | * |
MACRUM | 0:35a2186cf186 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
MACRUM | 0:35a2186cf186 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
MACRUM | 0:35a2186cf186 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
MACRUM | 0:35a2186cf186 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
MACRUM | 0:35a2186cf186 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
MACRUM | 0:35a2186cf186 | 17 | */ |
MACRUM | 0:35a2186cf186 | 18 | /* Copyright (C) 2014 Murata Manufacturing Co.,Ltd., MIT License |
MACRUM | 0:35a2186cf186 | 19 | * port to the muRata, SWITCH SCIENCE Wi-FI module TypeYD SNIC-UART. |
MACRUM | 0:35a2186cf186 | 20 | */ |
MACRUM | 0:35a2186cf186 | 21 | #include "SNICInterface/Socket/SNIC_Socket.h" |
MACRUM | 0:35a2186cf186 | 22 | #include "SNICInterface/Socket/Endpoint.h" |
MACRUM | 0:35a2186cf186 | 23 | #include <cstring> |
MACRUM | 0:35a2186cf186 | 24 | #include <cstdio> |
MACRUM | 0:35a2186cf186 | 25 | |
MACRUM | 0:35a2186cf186 | 26 | Endpoint::Endpoint() |
MACRUM | 0:35a2186cf186 | 27 | { |
MACRUM | 0:35a2186cf186 | 28 | reset_address(); |
MACRUM | 0:35a2186cf186 | 29 | } |
MACRUM | 0:35a2186cf186 | 30 | |
MACRUM | 0:35a2186cf186 | 31 | Endpoint::~Endpoint() |
MACRUM | 0:35a2186cf186 | 32 | { |
MACRUM | 0:35a2186cf186 | 33 | } |
MACRUM | 0:35a2186cf186 | 34 | |
MACRUM | 0:35a2186cf186 | 35 | void Endpoint::reset_address(void) |
MACRUM | 0:35a2186cf186 | 36 | { |
MACRUM | 0:35a2186cf186 | 37 | mIpAddress[0] = '\0'; |
MACRUM | 0:35a2186cf186 | 38 | } |
MACRUM | 0:35a2186cf186 | 39 | |
MACRUM | 0:35a2186cf186 | 40 | int Endpoint::set_address(const char* host_p, const int port) |
MACRUM | 0:35a2186cf186 | 41 | { |
MACRUM | 0:35a2186cf186 | 42 | reset_address(); |
MACRUM | 0:35a2186cf186 | 43 | |
MACRUM | 0:35a2186cf186 | 44 | strcpy( mIpAddress, host_p ); |
MACRUM | 0:35a2186cf186 | 45 | mPort = port; |
MACRUM | 0:35a2186cf186 | 46 | |
MACRUM | 0:35a2186cf186 | 47 | return 0; |
MACRUM | 0:35a2186cf186 | 48 | } |
MACRUM | 0:35a2186cf186 | 49 | |
MACRUM | 0:35a2186cf186 | 50 | char* Endpoint::get_address() |
MACRUM | 0:35a2186cf186 | 51 | { |
MACRUM | 0:35a2186cf186 | 52 | return mIpAddress; |
MACRUM | 0:35a2186cf186 | 53 | } |
MACRUM | 0:35a2186cf186 | 54 | |
MACRUM | 0:35a2186cf186 | 55 | int Endpoint::get_port() |
MACRUM | 0:35a2186cf186 | 56 | { |
MACRUM | 0:35a2186cf186 | 57 | return mPort; |
MACRUM | 0:35a2186cf186 | 58 | } |
MACRUM | 0:35a2186cf186 | 59 |