Developer World
Spresense Arduino Library v3.2.0-77d75a4
LTECore.h
Go to the documentation of this file.
1/*
2 * LTECore.h - LTECore include file for Spresense Arduino
3 * Copyright 2019 Sony Semiconductor Solutions Corporation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
28#ifndef __SPRESENSE_LTECORE_H__
29#define __SPRESENSE_LTECORE_H__
30
31#ifdef SUBCORE
32#error "LTE library is NOT supported by SubCore."
33#endif
34
42/****************************************************************************
43 * Included Files
44 ****************************************************************************/
45
46#include <stdbool.h>
47#include <stdint.h>
48#include <pthread.h>
49
50#include <LTEDefinition.h>
51
52/****************************************************************************
53 * Pre-processor Definitions
54 ****************************************************************************/
55
56#define LTE_NET_PINCODE_MAXLEN (9)
57
58/****************************************************************************
59 * class declaration
60 ****************************************************************************/
61
73class LTECore {
74
75public:
76
77 ~LTECore();
78
79 static LTECore getInstance();
80 void setStatus(LTEModemStatus status)
81 {
82 _networkStatus = status;
83 }
84
85 inline LTEModemStatus getStatus()
86 {
87 return _networkStatus;
88 }
89
90 inline void setSessionID(uint8_t id)
91 {
92 _sessionID = id;
93 }
94
95 LTEModemStatus begin(bool restart);
96 void shutdown();
97 LTEModemStatus startSearchNetwork(char* pinCode, bool synchronous);
98 LTEModemStatus connectNetwork(const char *apn, const char *userName, const char *password, LTENetworkAuthType authType, LTENetworkIPType ipType, bool synchronous, bool cancelable = true);
99 LTEModemStatus disconnectNetwork();
100 void signalModemReset();
101 void printErrorInfo();
102 void recovery();
103
104private:
105 static LTECore* _instance;
106 LTEModemStatus _networkStatus;
107 uint8_t _sessionID;
108 char _modemPinCode[LTE_NET_PINCODE_MAXLEN];
109
110 struct {
111 pthread_cond_t cond;
112 pthread_mutex_t mutex;
113 }_resetCondition;
114
115 struct {
116 char name[LTE_NET_APN_MAXLEN];
117 char userName[LTE_NET_USER_MAXLEN];
118 char password[LTE_NET_PASSWORD_MAXLEN];
119 LTENetworkAuthType authType;
120 LTENetworkIPType ipType;
121 }_apn;
122
123 LTECore();
124
125};
126
127/* LTECore singleton instance.
128 * Do not reference this instance directly from the sketch.
129 */
130extern LTECore theLTECore;
131
134#endif // __SPRESENSE_LTECORE_H__
Definition used in LTE library.
[en] Core class of LTE library. This is internal class. [ja] LTEライブラリのCoreクラス。内部利用Class。
Definition: LTECore.h:73
LTENetworkAuthType
[en] Authentication type. [ja] 認証形式
Definition: LTEDefinition.h:98
LTEModemStatus
[en] Status code of the modem. [ja] モデムのステータスコード
Definition: LTEDefinition.h:70
LTENetworkIPType
[en] Internet protocol type. [ja] インターネット・プロトコル形式
Definition: LTEDefinition.h:85