Mistake on this page?
Report an issue in GitHub or email us
UBLOX_N2XX_CellularStack.h
1 /*
2  * Copyright (c) 2019, Arm Limited and affiliates.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef UBLOX_N2XX_CELLULARSTACK_H_
18 #define UBLOX_N2XX_CELLULARSTACK_H_
19 
20 #include <chrono>
21 
22 #include "AT_CellularStack.h"
23 #include "CellularUtil.h"
24 #include "mbed_wait_api.h"
25 #include "drivers/Timer.h"
26 
27 using namespace std::chrono;
28 
29 namespace mbed {
30 
32 
33 public:
34 
35  UBLOX_N2XX_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type, AT_CellularDevice &device);
36  virtual ~UBLOX_N2XX_CellularStack();
37 
38 protected:
39 
40  virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog);
41 
42  virtual nsapi_error_t socket_accept(nsapi_socket_t server,
43  nsapi_socket_t *handle, SocketAddress *address = 0);
44 
45 protected:
46 
47  /** Socket timeout value in milliseconds.
48  * Note: the sockets layer above will retry the
49  * call to the functions here when they return NSAPI_ERROR_WOULD_BLOCK
50  * and the user has set a larger timeout or full blocking.
51  */
52  static constexpr seconds SOCKET_TIMEOUT = 1s;
53 
54  /** The maximum number of bytes in a packet that can be write/read from
55  * the AT interface in one go.
56  */
57  static const int N2XX_MAX_PACKET_SIZE = 512;
58 
59  virtual nsapi_error_t create_socket_impl(CellularSocket *socket);
60 
61  virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address,
62  const void *data, nsapi_size_t size);
63 
64  virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
65  void *buffer, nsapi_size_t size);
66 
67  virtual nsapi_error_t socket_close_impl(int sock_id);
68 
69 private:
70 
71  // URC handlers
72  void NSONMI_URC();
73 };
74 
75 } // namespace mbed
76 
77 #endif // UBLOX_N2XX_CELLULARSTACK_H_
Class AT_CellularStack.
void * nsapi_socket_t
Opaque handle for network sockets.
Definition: nsapi_types.h:207
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:95
signed int nsapi_size_or_error_t
Type used to represent either a size or error passed through sockets.
Definition: nsapi_types.h:106
SocketAddress class.
Definition: SocketAddress.h:36
Class AT_CellularDevice.
unsigned int nsapi_size_t
Type used to represent the size of data passed through sockets.
Definition: nsapi_types.h:99
Definition: ATHandler.h:46
Class for sending AT commands and parsing AT responses.
Definition: ATHandler.h:70
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.