Mbed OS Reference
Loading...
Searching...
No Matches
GEMALTO_CINTERION_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 GEMALTO_CINTERION_CELLULAR_STACK_H_
19#define GEMALTO_CINTERION_CELLULAR_STACK_H_
20
21#include "AT_CellularStack.h"
22
23namespace mbed {
24
26public:
27 GEMALTO_CINTERION_CellularStack(ATHandler &atHandler, const char *apn, const char *username,
28 const char *password, int cid, nsapi_ip_stack_t stack_type, AT_CellularDevice &device);
30
31 /** Initialize
32 * Must be called immediately after constructor to initialize IP stack on the modem.
33 * @return NSAPI_ERROR_OK on success
34 */
36
37protected:
38
39 virtual nsapi_error_t socket_close_impl(int sock_id);
40
42
44 const void *data, nsapi_size_t size);
45
47 void *buffer, nsapi_size_t size);
48
50
51private:
52 // socket URC handlers as per Cinterion AT manuals
53 void urc_sis();
54 void urc_sisw();
55 void sisw_urc_handler(int sock_id, int urc_code);
56 void urc_sisr();
57 void sisr_urc_handler(int sock_id, int urc_code);
58
59 // sockets need a connection profile, one profile is enough to support single stack sockets
60 nsapi_error_t create_connection_profile(int connection_profile_id);
61 void close_connection_profile(int connection_profile_id);
62
63 // socket open need to be deferred until sendto due to BGS2 does not support UDP server endpoint
64 nsapi_error_t socket_open_defer(CellularSocket *socket, const SocketAddress *address = NULL);
65
66 // connection profile configuration needs Access Point Name, User Name and Password
67 const char *_apn;
68 const char *_user;
69 const char *_password;
70};
71
72} // namespace mbed
73
74#endif /* GEMALTO_CINTERION_CELLULAR_STACK_H_ */
SocketAddress class.
Definition: SocketAddress.h:37
Class AT_CellularDevice.
Class AT_CellularStack.
Class for sending AT commands and parsing AT responses.
Definition: ATHandler.h:68
virtual nsapi_error_t create_socket_impl(CellularSocket *socket)
Implements modem specific AT command set for creating socket.
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address)
Connects TCP socket to a remote host.
virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address, void *buffer, nsapi_size_t size)
Implements modem specific AT command set for receiving data.
nsapi_error_t socket_stack_init()
Initialize Must be called immediately after constructor to initialize IP stack on the modem.
virtual nsapi_error_t socket_close_impl(int sock_id)
Implements modem specific AT command set for socket closing.
virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address, const void *data, nsapi_size_t size)
Implements modem specific AT command set for sending data.
signed int nsapi_size_or_error_t
Type used to represent either a size or error passed through sockets.
Definition: nsapi_types.h:153
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:142
void * nsapi_socket_t
Opaque handle for network sockets.
Definition: nsapi_types.h:254
unsigned int nsapi_size_t
Type used to represent the size of data passed through sockets.
Definition: nsapi_types.h:146