[136] | 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 __GSM3_SHIELDV1SERVERPROVIDER__
|
---|
| 35 | #define __GSM3_SHIELDV1SERVERPROVIDER__
|
---|
| 36 |
|
---|
| 37 | #include <GSM3MobileServerProvider.h>
|
---|
| 38 | #include <GSM3ShieldV1BaseProvider.h>
|
---|
| 39 |
|
---|
| 40 | class GSM3ShieldV1ServerProvider : public GSM3MobileServerProvider, public GSM3ShieldV1BaseProvider
|
---|
| 41 | {
|
---|
| 42 | private:
|
---|
| 43 |
|
---|
| 44 | /** Continue to connect to server with TCP protocol function
|
---|
| 45 | */
|
---|
| 46 | void connectTCPServerContinue();
|
---|
| 47 |
|
---|
| 48 | /** Continue to get IP address function
|
---|
| 49 | */
|
---|
| 50 | //void getIPContinue();
|
---|
| 51 |
|
---|
| 52 | /** Parse QILOCIP response
|
---|
| 53 | @param LocalIP Buffer for save local IP address
|
---|
| 54 | @param LocalIPlength Buffer size
|
---|
| 55 | @param rsp Returns if expected response exists
|
---|
| 56 | @return true if command executed correctly
|
---|
| 57 | */
|
---|
| 58 | //bool parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp);
|
---|
| 59 |
|
---|
| 60 | /** Release socket
|
---|
| 61 | @param socket Socket
|
---|
| 62 | */
|
---|
| 63 | void releaseSocket(int socket);
|
---|
| 64 |
|
---|
| 65 | public:
|
---|
| 66 |
|
---|
| 67 | /** Constructor */
|
---|
| 68 | GSM3ShieldV1ServerProvider();
|
---|
| 69 |
|
---|
| 70 | /** minSocketAsServer
|
---|
| 71 | @return 0
|
---|
| 72 | */
|
---|
| 73 | int minSocketAsServer(){return 0;};
|
---|
| 74 |
|
---|
| 75 | /** maxSocketAsServer
|
---|
| 76 | @return 0
|
---|
| 77 | */
|
---|
| 78 | int maxSocketAsServer(){return 0;};
|
---|
| 79 |
|
---|
| 80 | /** Get modem status
|
---|
| 81 | @param s Socket
|
---|
| 82 | @return modem status (true if connected)
|
---|
| 83 | */
|
---|
| 84 | bool getSocketAsServerModemStatus(int s);
|
---|
| 85 |
|
---|
| 86 | /** Get new occupied socket as server
|
---|
| 87 | @return return -1 if no new socket has been occupied
|
---|
| 88 | */
|
---|
| 89 | int getNewOccupiedSocketAsServer();
|
---|
| 90 |
|
---|
| 91 | /** Connect server to TCP port
|
---|
| 92 | @param port TCP port
|
---|
| 93 | @return command error if exists
|
---|
| 94 | */
|
---|
| 95 | int connectTCPServer(int port);
|
---|
| 96 |
|
---|
| 97 | //int getIP(char* LocalIP, int LocalIPlength);
|
---|
| 98 | // int disconnectTCP(bool client1Server0, int id_socket);
|
---|
| 99 |
|
---|
| 100 | /** Get last command status
|
---|
| 101 | @return returns 0 if last command is still executing, 1 success, >1 error
|
---|
| 102 | */
|
---|
| 103 | int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
---|
| 104 |
|
---|
| 105 | /** Get socket status as server
|
---|
| 106 | @param socket Socket to get status
|
---|
| 107 | @return socket status
|
---|
| 108 | */
|
---|
| 109 | bool getStatusSocketAsServer(uint8_t socket);
|
---|
| 110 |
|
---|
| 111 | /** Manages modem response
|
---|
| 112 | @param from Initial byte of buffer
|
---|
| 113 | @param to Final byte of buffer
|
---|
| 114 | */
|
---|
| 115 | void manageResponse(byte from, byte to);
|
---|
| 116 |
|
---|
| 117 | /** Recognize unsolicited event
|
---|
| 118 | @param oldTail
|
---|
| 119 | @return true if successful
|
---|
| 120 | */
|
---|
| 121 | bool recognizeUnsolicitedEvent(byte oldTail);
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | };
|
---|
| 125 |
|
---|
| 126 | #endif
|
---|