Mistake on this page?
Report an issue in GitHub or email us
UBLOX_AT_CellularContext.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 #ifndef UBLOX_AT_CELLULARCONTEXT_H_
18 #define UBLOX_AT_CELLULARCONTEXT_H_
19 
20 #include "AT_CellularContext.h"
21 #include "UBLOX_AT_CellularNetwork.h"
22 
23 namespace mbed {
24 
26 public:
27  UBLOX_AT_CellularContext(ATHandler &at, CellularDevice *device, const char *apn, bool cp_req = false, bool nonip_req = false);
28  virtual ~UBLOX_AT_CellularContext();
29 
30  virtual void do_connect();
31 #ifndef UBX_MDM_SARA_R41XM
32  virtual void do_disconnect();
33 #endif
35 
36  const char *get_apn(void);
37  const char *get_uname(void);
38  const char *get_pwd(void);
39  CellularContext::AuthenticationType get_auth(void);
40 
41  /** Convert nsapi_security_t to the modem security numbers.
42  *
43  * @param nsapi_security Security protocol.
44  * @return Modem security numbers.
45  */
46  int nsapi_security_to_modem_security(AuthenticationType nsapi_security);
47 
48  /** Get the next set of credentials from the database.
49  */
50  void get_next_credentials(char **config);
51 #ifdef UBX_MDM_SARA_R412M
52  CellularNetwork::RadioAccessTechnology read_radio_technology(void);
53 #endif
54 protected:
55  virtual NetworkStack *get_stack();
56 
57  /** Connect the on board IP stack of the modem.
58  *
59  * @return True if successful, otherwise false.
60  */
61 #ifndef UBX_MDM_SARA_R41XM
63 #endif
64 
65 private:
66 
67  /** Length of IMSI buffer.
68  */
69  static const int MAX_IMSI_LENGTH = 15;
70 
71  /** The type of authentication to use.
72  */
73  AuthenticationType _auth;
74 
75  /** Activate one of the on-board modem's connection profiles.
76  *
77  * @param apn The APN to use.
78  * @param username The user name to use.
79  * @param password The password to use.
80  * @param auth The authentication method to use
81  * (NOAUTH, PAP,
82  * CHAP or AUTOMATIC).
83  * @return True if successful, otherwise false.
84  */
85 #ifndef UBX_MDM_SARA_R41XM
86  bool activate_profile(const char *apn, const char *username, const char *password, AuthenticationType auth);
87 #endif
88 
89  /** Disconnect the on board IP stack of the modem.
90  *
91  * @return True if successful, otherwise false.
92  */
93  bool disconnect_modem_stack();
94 
95  /** Read IMSI of modem.
96  */
97  nsapi_error_t get_imsi(char *imsi);
98 };
99 
100 } /* namespace mbed */
101 
102 #endif // UBLOX_AT_CELLULARCONTEXT_H_
int nsapi_security_to_modem_security(AuthenticationType nsapi_security)
Convert nsapi_security_t to the modem security numbers.
NetworkStack class.
Definition: NetworkStack.h:42
nsapi_security
Enum of encryption types.
Definition: nsapi_types.h:165
Class CellularDevice.
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:140
void get_next_credentials(char **config)
Get the next set of credentials from the database.
nsapi_error_t define_context()
Connect the on board IP stack of the modem.
SocketAddress class.
Definition: SocketAddress.h:37
virtual void do_connect()
Activates PDP context or in PPP mode opens data channel.
Definition: ATHandler.h:46
virtual nsapi_error_t get_gateway(SocketAddress *addr)
Get the local gateway.
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.