Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UBLOX_N2XX.h Source File

UBLOX_N2XX.h

00001 /*
00002  * Copyright (c) 2019, 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_N2XX_H_
00019 #define UBLOX_N2XX_H_
00020 
00021 #ifdef TARGET_FF_ARDUINO
00022 #ifndef MBED_CONF_UBLOX_N2XX_TX
00023 #define MBED_CONF_UBLOX_N2XX_TX D1
00024 #endif
00025 #ifndef MBED_CONF_UBLOX_N2XX_RX
00026 #define MBED_CONF_UBLOX_N2XX_RX D0
00027 #endif
00028 #endif /* TARGET_FF_ARDUINO */
00029 
00030 #include "mbed.h"
00031 #include "CellularLog.h"
00032 #include "AT_CellularDevice.h"
00033 #include "AT_CellularNetwork.h"
00034 #include "UBLOX_N2XX_CellularSMS.h"
00035 #include "UBLOX_N2XX_CellularContext.h"
00036 
00037 namespace mbed {
00038 
00039 class UBLOX_N2XX : public AT_CellularDevice {
00040 
00041 public:
00042 
00043     UBLOX_N2XX(FileHandle *fh);
00044     virtual ~UBLOX_N2XX();
00045 
00046     virtual nsapi_error_t init();
00047     virtual nsapi_error_t get_sim_state(SimState &state);
00048     virtual nsapi_error_t set_pin(const char *sim_pin);
00049 
00050 
00051 protected: // AT_CellularDevice
00052 
00053     virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn, bool cp_req = false, bool nonip_req = false);
00054 #if MBED_CONF_CELLULAR_USE_SMS
00055     virtual AT_CellularSMS *open_sms_impl(ATHandler &at);
00056 #endif // MBED_CONF_CELLULAR_USE_SMS
00057     virtual void set_at_urcs_impl();
00058 
00059 public: // NetworkInterface
00060 
00061     void handle_urc(FileHandle *fh);
00062 
00063 private:
00064 
00065     static const int MAX_SIM_RESPONSE_LENGTH = 25;
00066 
00067     // URC handlers
00068     void NPIN_URC();
00069 
00070     char simstr[MAX_SIM_RESPONSE_LENGTH];
00071 };
00072 
00073 } // namespace mbed
00074 
00075 #endif // UBLOX_N2XX_H_