Easyuino  1.2.0
GSMServiceSecure.h
1 /*
2 MIT License
3 
4 Copyright (c) 2017 André Pires
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 /*
25 GSMServiceSecure.h
26 */
27 #ifndef _EASYUINO_GSM_SERVICE_SECURE_h
28 #define _EASYUINO_GSM_SERVICE_SECURE_h
29 
30 #include "Utilities.h"
31 #include "GSMService.h"
32 #include "SMS.h"
33 
35 #define MAX_NUMBER_OF_ALLOWED_NUMBERS 3
36 
37 namespace Easyuino {
38 
44  class GSMServiceSecure : public GSMService {
45 
46  private:
48  unsigned long _allowedNumbers[MAX_NUMBER_OF_ALLOWED_NUMBERS];
49 
50  public:
57  GSMServiceSecure(IN uint8_t txPin, IN uint8_t rxPin, IN uint8_t powerPin, IN Stream &outputStream);
58 
64  GSMServiceSecure(IN uint8_t txPin, IN uint8_t rxPin, IN uint8_t powerPin);
65 
68 
69 #pragma region Controller Numbers Management
70 
75  GSMRequestStatus addAllowedNumber(IN unsigned long phoneNumberToAdd);
76 
82  GSMRequestStatus isAllowed(IN unsigned long phoneNumber, OUT bool& allowed);
83 
88  GSMRequestStatus removeAllowedNumber(IN unsigned long phoneNumberToRemove);
89 
93  GSMRequestStatus clearAllowedNumbers();
94 
95 #pragma endregion
96 
97 #pragma region SMS Management
98 
99  GSMRequestStatus availableSMS(OUT SMS &message, OUT bool &smsRead);
100 
101 #pragma endregion
102 
103  };
104 
105 };
106 
107 #endif
GSMRequestStatus availableSMS(OUT SMS &message, OUT bool &smsRead)
Check if there is a new received SMS.
Represents a SMS object used to send and receive it from the GSMService API.
Definition: SMS.h:38
GSMRequestStatus removeAllowedNumber(IN unsigned long phoneNumberToRemove)
Remove the given number from the allowed numbers list (If exists there)
GSMRequestStatus clearAllowedNumbers()
Clear the list for allowed phone numbers ENABLING any number to Call and send SMS to the service and ...
GSMServiceSecure(IN uint8_t txPin, IN uint8_t rxPin, IN uint8_t powerPin, IN Stream &outputStream)
Constructor.
GSMRequestStatus isAllowed(IN unsigned long phoneNumber, OUT bool &allowed)
Verify if the phone number is in the list of allowed numbers.
Definition: Button.h:38
GSMService API allows to interact with GSM boards in order to perform calls, sms management etc...
Definition: GSMService.h:74
GSMServiceSecure extends the GSMService API allowing user to add phone numbers to accept calls and SM...
Definition: GSMServiceSecure.h:44
~GSMServiceSecure()
Destructor.
GSMRequestStatus addAllowedNumber(IN unsigned long phoneNumberToAdd)
Add the phone number to the allowed numbers IF it doesn't exist yet.