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

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

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

File size: 3.8 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 _GSM3MOBILENETWORKPROVIDER_
35#define _GSM3MOBILENETWORKPROVIDER_
36
37#include <GSM3MobileAccessProvider.h>
38#include <inttypes.h>
39#include <stddef.h>
40#include <IPAddress.h>
41
42class GSM3MobileNetworkProvider
43{
44 private:
45
46 /** Restart hardware
47 @return 1 if successful
48 */
49 int HWrestart();
50
51 uint16_t socketsAsServer; // Server socket
52
53 /** Get modem status
54 @param s Socket
55 @return modem status (true if connected)
56 */
57 virtual inline bool getSocketAsServerModemStatus(int s){return false;};
58
59 public:
60
61 /** minSocketAsServer
62 @return 0
63 */
64 virtual inline int minSocketAsServer(){return 0;};
65
66 /** maxSocketAsServer
67 @return 0
68 */
69 virtual inline int maxSocketAsServer(){return 0;};
70
71 /** Get last command status
72 @return returns 0 if last command is still executing, 1 success, >1 error
73 */
74 virtual int ready()=0;
75
76 /** Constructor */
77 GSM3MobileNetworkProvider();
78
79 /** Get network status
80 @return network status
81 */
82 virtual inline GSM3_NetworkStatus_t getStatus(){return ERROR;};
83
84 /** Get socket client status
85 @param socket Socket
86 @return 1 if connected, 0 otherwise
87 */
88 bool getStatusSocketClient(uint8_t socket);
89
90 /** Close a AT command
91 @param code Close code
92 */
93 virtual inline void closeCommand(int code){};
94
95 /** Establish a TCP connection
96 @param port Port
97 @param localIP IP address
98 @param localIPlength IP address size in characters
99 @return command error if exists
100 */
101 virtual inline int connectTCPServer(int port, char* localIP, int localIPlength){return 0;};
102
103 /** Get local IP address
104 @param LocalIP Buffer for save IP address
105 @param LocalIPlength Buffer size
106 */
107 virtual inline int getIP(char* LocalIP, int LocalIPlength){return 0;};
108
109 /** Get new occupied socket
110 @return -1 if no new socket has been occupied
111 */
112 int getNewOccupiedSocketAsServer();
113
114 /** Get socket status as server
115 @param socket Socket to get status
116 @return socket status
117 */
118 bool getStatusSocketAsServer(uint8_t socket);
119
120 /** Close a socket
121 @param client1Server0 1 if modem acts as client, 0 if acts as server
122 @param id_socket Local socket number
123 @return 0 if command running, 1 if success, otherwise error
124 */
125 int disconnectTCP(bool client1Server0, int idsocket){return 1;};
126
127 /** Release socket
128 @param socket Socket
129 */
130 void releaseSocket(int socket){};
131
132};
133
134extern GSM3MobileNetworkProvider* theProvider;
135
136#endif
Note: See TracBrowser for help on using the repository browser.