takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UBLOX_AT_CellularNetwork.h Source File

UBLOX_AT_CellularNetwork.h

00001 /*
00002  * Copyright (c) 2018, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef UBLOX_AT_CELLULAR_NETWORK_H_
00019 #define UBLOX_AT_CELLULAR_NETWORK_H_
00020 
00021 #include "AT_CellularNetwork.h"
00022 #include "APN_db.h"
00023 
00024 namespace mbed
00025 {
00026 
00027 class UBLOX_AT_CellularNetwork : public AT_CellularNetwork
00028 {
00029 public:
00030     UBLOX_AT_CellularNetwork(ATHandler &atHandler);
00031     virtual ~UBLOX_AT_CellularNetwork();
00032 
00033     virtual nsapi_error_t connect();
00034 
00035     virtual const char *get_gateway();
00036 
00037 protected:
00038     virtual NetworkStack *get_stack();
00039 
00040     virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
00041 
00042     virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
00043 
00044     virtual RegistrationMode has_registration(RegistrationType rat);
00045 
00046 private:
00047 
00048     /** Length of IMSI buffer.
00049      */
00050     static const int MAX_IMSI_LENGTH = 15;
00051 
00052     /** The type of authentication to use.
00053      */
00054     nsapi_security_t _auth;
00055 
00056     /** Connect the on board IP stack of the modem.
00057      *
00058      * @return      True if successful, otherwise false.
00059      */
00060     nsapi_error_t open_data_channel();
00061 
00062     /** Activate one of the on-board modem's connection profiles.
00063      *
00064      * @param apn      The APN to use.
00065      * @param username The user name to use.
00066      * @param password The password to use.
00067      * @param auth     The authentication method to use
00068      *                 (NSAPI_SECURITY_NONE, NSAPI_SECURITY_PAP,
00069      *                 NSAPI_SECURITY_CHAP or NSAPI_SECURITY_UNKNOWN).
00070      * @return         True if successful, otherwise false.
00071      */
00072     bool activate_profile(const char* apn, const char* username, const char* password);
00073 
00074     /** Convert nsapi_security_t to the modem security numbers.
00075      *
00076      * @param nsapi_security      Security protocol.
00077      * @return                    Modem security numbers.
00078      */
00079     int nsapi_security_to_modem_security(nsapi_security_t nsapi_security);
00080 
00081     /** Disconnect the on board IP stack of the modem.
00082      *
00083      * @return      True if successful, otherwise false.
00084      */
00085     bool disconnect_modem_stack();
00086 
00087     /** Read IMSI of modem.
00088      */
00089     nsapi_error_t get_imsi(char* imsi);
00090 
00091     /** Get the next set of credentials from the database.
00092      */
00093     void get_next_credentials(char ** config);
00094 };
00095 
00096 } // namespace mbed
00097 
00098 #endif // UBLOX_AT_CELLULAR_NETWORK_H_