[175] | 1 | /*
|
---|
| 2 | This file is part of the GSM3 communications library for Arduino
|
---|
| 3 | -- Multi-transport communications platform
|
---|
| 4 | -- Fully asynchronous
|
---|
| 5 | -- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
---|
| 6 | -- Voice calls
|
---|
| 7 | -- SMS
|
---|
| 8 | -- TCP/IP connections
|
---|
| 9 | -- HTTP basic clients
|
---|
| 10 |
|
---|
| 11 | This library has been developed by Telefónica Digital - PDI -
|
---|
| 12 | - Physical Internet Lab, as part as its collaboration with
|
---|
| 13 | Arduino and the Open Hardware Community.
|
---|
| 14 |
|
---|
| 15 | September-December 2012
|
---|
| 16 |
|
---|
| 17 | This library is free software; you can redistribute it and/or
|
---|
| 18 | modify it under the terms of the GNU Lesser General Public
|
---|
| 19 | License as published by the Free Software Foundation; either
|
---|
| 20 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 21 |
|
---|
| 22 | This library is distributed in the hope that it will be useful,
|
---|
| 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 25 | Lesser General Public License for more details.
|
---|
| 26 |
|
---|
| 27 | You should have received a copy of the GNU Lesser General Public
|
---|
| 28 | License along with this library; if not, write to the Free Software
|
---|
| 29 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
| 30 |
|
---|
| 31 | The latest version of this library can always be found at
|
---|
| 32 | https://github.com/BlueVia/Official-Arduino
|
---|
| 33 | */
|
---|
| 34 | #ifndef _GSM3SHIELDV1PINMANAGEMENT_
|
---|
| 35 | #define _GSM3SHIELDV1PINMANAGEMENT_
|
---|
| 36 |
|
---|
| 37 | #include <GSM3ShieldV1AccessProvider.h>
|
---|
| 38 | #include <GSM3ShieldV1DirectModemProvider.h>
|
---|
| 39 |
|
---|
| 40 | class GSM3ShieldV1PinManagement
|
---|
| 41 | {
|
---|
| 42 |
|
---|
| 43 | private:
|
---|
| 44 |
|
---|
| 45 | GSM3ShieldV1AccessProvider gsm; // GSM access required for network register with PIN code
|
---|
| 46 | GSM3ShieldV1DirectModemProvider modemAccess;
|
---|
| 47 | bool pin_used; // determines if pin lock is activated
|
---|
| 48 |
|
---|
| 49 | public:
|
---|
| 50 |
|
---|
| 51 | /** Constructor */
|
---|
| 52 | GSM3ShieldV1PinManagement();
|
---|
| 53 |
|
---|
| 54 | /** Check modem response and restart it
|
---|
| 55 | */
|
---|
| 56 | void begin();
|
---|
| 57 |
|
---|
| 58 | /** Check if PIN lock or PUK lock is activated
|
---|
| 59 | @return 0 if PIN lock is off, 1 if PIN lock is on, -1 if PUK lock is on, -2 if error exists
|
---|
| 60 | */
|
---|
| 61 | int isPIN();
|
---|
| 62 |
|
---|
| 63 | /** Check if PIN code is correct and valid
|
---|
| 64 | @param pin PIN code
|
---|
| 65 | @return 0 if is correct, -1 if is incorrect
|
---|
| 66 | */
|
---|
| 67 | int checkPIN(String pin);
|
---|
| 68 |
|
---|
| 69 | /** Check if PUK code is correct and establish new PIN code
|
---|
| 70 | @param puk PUK code
|
---|
| 71 | @param pin New PIN code
|
---|
| 72 | @return 0 if successful, otherwise return -1
|
---|
| 73 | */
|
---|
| 74 | int checkPUK(String puk, String pin);
|
---|
| 75 |
|
---|
| 76 | /** Change PIN code
|
---|
| 77 | @param old Old PIN code
|
---|
| 78 | @param pin New PIN code
|
---|
| 79 | */
|
---|
| 80 | void changePIN(String old, String pin);
|
---|
| 81 |
|
---|
| 82 | /** Change PIN lock status
|
---|
| 83 | @param pin PIN code
|
---|
| 84 | */
|
---|
| 85 | void switchPIN(String pin);
|
---|
| 86 |
|
---|
| 87 | /** Check if modem was registered in GSM/GPRS network
|
---|
| 88 | @return 0 if modem was registered, 1 if modem was registered in roaming, -1 if error exists
|
---|
| 89 | */
|
---|
| 90 | int checkReg();
|
---|
| 91 |
|
---|
| 92 | /** Return if PIN lock is used
|
---|
| 93 | @return true if PIN lock is used, otherwise, return false
|
---|
| 94 | */
|
---|
| 95 | bool getPINUsed();
|
---|
| 96 |
|
---|
| 97 | /** Set PIN lock status
|
---|
| 98 | @param used New PIN lock status
|
---|
| 99 | */
|
---|
| 100 | void setPINUsed(bool used);
|
---|
| 101 | };
|
---|
| 102 |
|
---|
| 103 | #endif
|
---|