11 USB.println(
"3G init");
14 _3G.set_APN(
"gprs.swisscom.ch",
"",
"");
16 USB.println(
"APN INFOS:");
28 char request_str[200];
31 USB.println(F(
"Entering 3G SendData"));
33 USB.println(F(
"turned 3G module on"));
34 if ((answer == 1) || (answer == -3))
36 USB.println(
"3G module ready...");
38 USB.println(F(
"Setting PIN code..."));
39 if (_3G.setPIN(
simPin) == 1)
41 USB.println(F(
"PIN code accepted"));
45 USB.println(F(
"PIN code incorrect"));
49 answer = _3G.check(180);
52 USB.println(F(
"3G module connected to the network..."));
53 USB.print(F(
"Getting URL with GET method..."));
56 sprintf(request_str,
"GET /LogData.php?name=%s&battery=%u&pitch1=%d&roll1=%d&pitch2=%d&roll2=%d&pitch3=%d&roll3=%d&pot=%d&temp1=%d&temp2=%d&temp3=%d HTTP/1.1\r\nHost: %s\r\nContent-Length: 0\r\n\r\n", sensorName, data->
batteryLevel,data->
sensor1.
pitch,data->
sensor1.
roll,data->
sensor2.
pitch,data->
sensor2.
roll,data->
sensor3.
pitch,data->
sensor3.
roll,data->
extension,data->
sensTemp1,data->
sensTemp2,data->
sensTemp3,
httpStreamAddress);
57 USB.println(request_str);
62 USB.println(F(
"Done"));
64 USB.println(_3G.buffer_3G);
66 else if (answer < -14)
68 USB.print(F(
"Failed. Error code: "));
69 USB.println(answer, DEC);
70 USB.print(F(
"CME error code: "));
71 USB.println(_3G.CME_CMS_code, DEC);
76 USB.print(F(
"Failed. Error code: "));
77 USB.println(answer, DEC);
83 USB.println(F(
"3G module cannot connect to the network..."));
90 USB.println(F(
"3G module not started"));
109 char request_str[200];
112 USB.println(F(
"Entering 3G SendData"));
114 USB.println(F(
"turned 3G module on"));
115 if ((answer == 1) || (answer == -3))
117 USB.println(
"3G module ready...");
119 USB.println(F(
"Setting PIN code..."));
120 if (_3G.setPIN(
simPin) == 1)
122 USB.println(F(
"PIN code accepted"));
126 USB.println(F(
"PIN code incorrect"));
129 answer = _3G.check(180);
132 USB.println(F(
"3G module connected to the network..."));
134 for(uint8_t i = 0;i<size; i++)
136 if(data[i].sensorNodeId != 0)
138 USB.print(F(
"Getting URL with GET method..."));
140 sprintf (sensorName,
"SensorID%d", data[i].sensorNodeId);
141 sprintf(request_str,
"GET /LogData.php?name=%s&battery=%u&pitch1=%d&roll1=%d&pitch2=%d&roll2=%d&pitch3=%d&roll3=%d&pot=%d&temp1=%d&temp2=%d&temp3=%d HTTP/1.1\r\nHost: %s\r\nContent-Length: 0\r\n\r\n", sensorName, data[i].batteryLevel,data[i].sensor1.pitch,data[i].
sensor1.
roll,data[i].
sensor2.
pitch,data[i].
sensor2.
roll,data[i].
sensor3.
pitch,data[i].
sensor3.
roll,data[i].
extension,data[i].
sensTemp1,data[i].
sensTemp2,data[i].
sensTemp3,
httpStreamAddress);
142 USB.println(request_str);
147 USB.println(F(
"Done"));
149 USB.println(_3G.buffer_3G);
151 else if (answer < -14)
153 USB.print(F(
"Failed. Error code: "));
154 USB.println(answer, DEC);
155 USB.print(F(
"CME error code: "));
156 USB.println(_3G.CME_CMS_code, DEC);
161 USB.print(F(
"Failed. Error code: "));
162 USB.println(answer, DEC);
170 USB.println(F(
"3G module cannot connect to the network..."));
177 USB.println(F(
"3G module not started"));
192 USB.println(F(
"Entering 3G CheckConnection"));
194 USB.println(F(
"turned 3G module on"));
195 if ((answer == 1) || (answer == -3))
197 USB.println(
"3G module ready...");
199 USB.println(F(
"Setting PIN code..."));
200 if (_3G.setPIN(
simPin) == 1)
202 USB.println(F(
"PIN code accepted"));
206 USB.println(F(
"PIN code incorrect"));
211 answer = _3G.check(180);
214 USB.println(F(
"3G module connected to the network..."));
219 USB.println(F(
"3G module cannot connect to the network..."));
uint8_t sendData(Sensors::structSensors *sensors)
This method sends all the sensor information from the struct to the webserver.
const char * httpStreamAddress
FXLS8471Q::structPitchRoll sensor3
uint8_t checkConnection()
This method checks if a connection to the 3G network can be established.
FXLS8471Q::structPitchRoll sensor1
void init()
This method initializes the operator parameters that are necessary for 3G connection.
FXLS8471Q::structPitchRoll sensor2