Developer World
Spresense Arduino Library v3.2.0-77d75a4
LTEClient.h
Go to the documentation of this file.
1/*
2 * LTEClient.h - LTEClient include file for Spresense Arduino
3 * Copyright 2019 Sony Semiconductor Solutions Corporation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
32#ifndef _LTE_CLIENT_H_
33#define _LTE_CLIENT_H_
34
35#ifdef SUBCORE
36#error "LTEClient library is NOT supported by SubCore."
37#endif
38
46/****************************************************************************
47 * Included Files
48 ****************************************************************************/
49
50#include <Client.h>
51
52class IPAddress;
53
54/****************************************************************************
55 * class declaration
56 ****************************************************************************/
57
65class LTEClient : public Client
66{
67public:
72
77
93 int connect(IPAddress ip, uint16_t port);
94
111 int connect(const char *host, uint16_t port);
112
127 size_t write(uint8_t val);
128
145 size_t write(const uint8_t *buf, size_t size);
146
159
171 int read();
172
189 int read(uint8_t *buf, size_t size);
190
202 int peek();
203
211 void flush();
212
220 void stop();
221
233 uint8_t connected();
234
246 operator bool()
247 {
248 return connected();
249 };
250
262 int setTimeout(uint32_t milliseconds);
263
264private:
265 int _fd;
266 uint8_t *_buf;
267 uint8_t _connected;
268};
269
273#endif
[en] Create a client that can connect to a specific Internet IP address and port. [ja] 特定のインターネットIP...
Definition: LTEClient.h:66
int available()
Returns the number of bytes available for reading.
int peek()
Returns the next byte received from the server without removing it from the buffer.
~LTEClient()
Destruct LTEClient instance.
LTEClient()
Construct LTEClient instance.
int connect(const char *host, uint16_t port)
Connects to a specified host name and port.
uint8_t connected()
Whether or not the client is connected.
int setTimeout(uint32_t milliseconds)
Set the timeout when the client send or receive.
size_t write(const uint8_t *buf, size_t size)
Send series of bytes data to the server the client is connected to.
int connect(IPAddress ip, uint16_t port)
Connects to a specified IP address and port.
void stop()
Disconnect from the server.
int read(uint8_t *buf, size_t size)
Read series of bytes received from the server the client is connected to.
void flush()
Discards any bytes that have been written to the client.
int read()
Read the next byte received from the server the client is connected to.
size_t write(uint8_t val)
Send one byte data to the server the client is connected to.