Mistake on this page?
Report an issue in GitHub or email us
QUECTEL_M26_CellularStack.h
1 /*
2  * Copyright (c) 2018, 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 
18 #ifndef QUECTEL_M26_CELLULARSTACK_H_
19 #define QUECTEL_M26_CELLULARSTACK_H_
20 
21 #include "AT_CellularStack.h"
22 
23 using namespace std::chrono_literals;
24 
25 namespace mbed {
26 
27 #define M26_CREATE_SOCKET_TIMEOUT 75s
28 #define M26_SENT_BYTE_MAX 1460
29 #define M26_RECV_BYTE_MAX 1024
30 
32 public:
33  QUECTEL_M26_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type, AT_CellularDevice &device);
34  virtual ~QUECTEL_M26_CellularStack();
35 
36  /** Initialize
37  * Must be called immediately after constructor to initialize IP stack on the modem.
38  * @return NSAPI_ERROR_OK on success
39  */
40  nsapi_error_t socket_stack_init();
41 
42 protected: // NetworkStack
43 
44  virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog);
45 
46  virtual nsapi_error_t socket_accept(nsapi_socket_t server,
47  nsapi_socket_t *handle, SocketAddress *address = 0);
48 
49  virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address);
50 
51  virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address);
52 
53 protected: // AT_CellularStack
54 
55  virtual nsapi_error_t socket_close_impl(int sock_id);
56 
57  virtual nsapi_error_t create_socket_impl(CellularSocket *socket);
58 
59  virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address,
60  const void *data, nsapi_size_t size);
61 
62  virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
63  void *buffer, nsapi_size_t size);
64 
65 private:
66  // URC handlers
67  void urc_qiurc();
68  void socket_closed(int sock_id);
69  void socket_closed_0();
70  void socket_closed_1();
71  void socket_closed_2();
72  void socket_closed_3();
73  void socket_closed_4();
74  void socket_closed_5();
75 
76  void handle_open_socket_response(int &modem_connect_id, int &err);
77 };
78 } // namespace mbed
79 #endif /* QUECTEL_M26_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.