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

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

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

File size: 3.3 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 _GSM3MOBILESERVERSERVICE_
35#define _GSM3MOBILESERVERSERVICE_
36
37#include <GSM3MobileNetworkProvider.h>
38#include <GSM3MobileClientService.h>
39#include <Server.h>
40
41class GSM3MobileServerService : public Server
42{
43 private:
44
45 uint8_t _port; // Port
46 uint8_t mySocket; // Actual socket
47 uint8_t flags;
48 bool local1Remote0;
49
50 /** Internal utility, used in synchronous calls
51 @return operation result, 1 if success, 0 otherwise
52 */
53 int waitForAnswer();
54
55 public:
56
57 /** Constructor
58 @param port Port
59 @param synch True if the server acts synchronously
60 */
61 GSM3MobileServerService(uint8_t port, bool synch=true);
62
63 /** Get last command status
64 @return returns 0 if last command is still executing, 1 success, >1 error
65 */
66 int ready();
67
68 /** Initialize server
69 */
70 void begin();
71
72 /** Check if there is an incoming client request
73 @param synch If true, the returned client is synchronous or
74 blocking.
75 @return Client if successful, else error
76 */
77 GSM3MobileClientService available(bool synch=true);
78
79 // Just to keep in line with Ethernet.
80 // Write to every open socket...
81 //void write(uint8_t);
82 //void write(const uint8_t *buf, size_t size);
83
84 /** Begin write in socket
85 */
86 void beginWrite();
87
88 /** Write character in socket
89 @param c Character
90 @return size
91 */
92 size_t write(uint8_t c);
93
94 /** Write buffer in socket
95 @param buf Buffer
96 @return size
97 */
98 size_t write(const uint8_t *buf);
99
100 /** Write buffer in socket with size
101 @param buf Buffer
102 @param sz Buffer size
103 @return size
104 */
105 size_t write(const uint8_t *buf, size_t sz);
106
107 /** End write in socket
108 */
109 void endWrite();
110
111 /** Stop server
112 */
113 void stop();
114
115 // we take this function out as IPAddress is complex to bring to
116 // version 1.
117 // inline int connect(IPAddress ip, uint16_t port){return 0;};
118 // Returns 2 if there are no resources
119 //int getIP(char* LocalIP, int LocalIPlength);
120
121};
122
123
124#endif
Note: See TracBrowser for help on using the repository browser.