source: rtos_arduino/trunk/arduino_lib/libraries/GSM/src/GSM3ShieldV1MultiServerProvider.h@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 3.6 KB
Line 
1/*
2This 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
11This library has been developed by Telefónica Digital - PDI -
12- Physical Internet Lab, as part as its collaboration with
13Arduino and the Open Hardware Community.
14
15September-December 2012
16
17This library is free software; you can redistribute it and/or
18modify it under the terms of the GNU Lesser General Public
19License as published by the Free Software Foundation; either
20version 2.1 of the License, or (at your option) any later version.
21
22This library is distributed in the hope that it will be useful,
23but WITHOUT ANY WARRANTY; without even the implied warranty of
24MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25Lesser General Public License for more details.
26
27You should have received a copy of the GNU Lesser General Public
28License along with this library; if not, write to the Free Software
29Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30
31The latest version of this library can always be found at
32https://github.com/BlueVia/Official-Arduino
33*/
34#ifndef __GSM3_SHIELDV1SERVERPROVIDER__
35#define __GSM3_SHIELDV1SERVERPROVIDER__
36
37#include <GSM3MobileServerProvider.h>
38#include <GSM3ShieldV1BaseProvider.h>
39
40class GSM3ShieldV1MultiServerProvider : public GSM3MobileServerProvider, public GSM3ShieldV1BaseProvider
41{
42 private:
43
44 // Used sockets
45 uint8_t socketsAsServer;
46 uint8_t socketsAccepted;
47
48 /** Continue to connect TCP server function
49 */
50 void connectTCPServerContinue();
51
52 /** Continue to get IP function
53 */
54 void getIPContinue();
55
56 /** Release socket
57 @param socket Socket
58 */
59 void releaseSocket(int socket);
60
61 /** Parse QILOCIP response
62 @param LocalIP Buffer for save local IP address
63 @param LocalIPlength Buffer size
64 @param rsp Returns if expected response exists
65 @return true if command executed correctly
66 */
67 bool parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp);
68
69 public:
70
71 /** Constructor */
72 GSM3ShieldV1MultiServerProvider();
73
74 /** minSocketAsServer
75 @return 0
76 */
77 int minSocketAsServer(){return 0;};
78
79 /** maxSocketAsServer
80 @return 0
81 */
82 int maxSocketAsServer(){return 4;};
83
84 /** Get modem status
85 @param s
86 @return modem status (true if connected)
87 */
88 bool getSocketAsServerModemStatus(int s);
89
90 /** Get new occupied socket as server
91 @return command error if exists
92 */
93 int getNewOccupiedSocketAsServer();
94
95 /** Connect server to TCP port
96 @param port TCP port
97 @return command error if exists
98 */
99 int connectTCPServer(int port);
100
101 /** Get server IP address
102 @param LocalIP Buffer for copy IP address
103 @param LocalIPlength Length of buffer
104 @return command error if exists
105 */
106 int getIP(char* LocalIP, int LocalIPlength);
107
108// int disconnectTCP(bool client1Server0, int id_socket);
109
110 /** Get last command status
111 @return returns 0 if last command is still executing, 1 success, >1 error
112 */
113 int ready(){return GSM3ShieldV1BaseProvider::ready();};
114
115 /** Get socket status as server
116 @param socket Socket to get status
117 @return socket status
118 */
119 bool getStatusSocketAsServer(uint8_t socket);
120
121 /** Manages modem response
122 @param from Initial byte of buffer
123 @param to Final byte of buffer
124 */
125 void manageResponse(byte from, byte to);
126
127 /** Recognize unsolicited event
128 @param oldTail
129 @return true if successful
130 */
131 bool recognizeUnsolicitedEvent(byte oldTail);
132
133
134};
135
136#endif
Note: See TracBrowser for help on using the repository browser.