forked from arduino-libraries/Arduino_ConnectionHandler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArduino_CellularConnectionHandler.h
62 lines (40 loc) · 1.95 KB
/
Arduino_CellularConnectionHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
This file is part of the Arduino_ConnectionHandler library.
Copyright (c) 2024 Arduino SA
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef ARDUINO_CELLULAR_CONNECTION_HANDLER_H_
#define ARDUINO_CELLULAR_CONNECTION_HANDLER_H_
/******************************************************************************
INCLUDE
******************************************************************************/
#include "Arduino_ConnectionHandler.h"
#ifdef BOARD_HAS_CELLULAR /* Only compile if the board has Cellular */
/******************************************************************************
CLASS DECLARATION
******************************************************************************/
class CellularConnectionHandler : public ConnectionHandler
{
public:
CellularConnectionHandler(const char * pin, const char * apn, const char * login, const char * pass, bool const keep_alive = true);
virtual unsigned long getTime() override;
virtual Client & getClient() override { return _gsm_client; };
virtual UDP & getUDP() override { } __attribute__((error("CellularConnectionHandler has no UDP support")));
protected:
virtual NetworkConnectionState update_handleInit () override;
virtual NetworkConnectionState update_handleConnecting () override;
virtual NetworkConnectionState update_handleConnected () override;
virtual NetworkConnectionState update_handleDisconnecting() override;
virtual NetworkConnectionState update_handleDisconnected () override;
private:
const char * _pin;
const char * _apn;
const char * _login;
const char * _pass;
ArduinoCellular _cellular;
TinyGsmClient _gsm_client = _cellular.getNetworkClient();
};
#endif /* #ifdef BOARD_HAS_CELLULAR */
#endif /* #ifndef ARDUINO_CELLULAR_CONNECTION_HANDLER_H_ */