-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWirefree.cpp
More file actions
74 lines (57 loc) · 1.8 KB
/
Wirefree.cpp
File metadata and controls
74 lines (57 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
Wirefree.cpp - interface class to talk with DIYSandbox Arduino devices
Copyright (C) 2011 DIYSandbox LLC
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "Wirefree.h"
#include "gs.h"
#include <WProgram.h>
uint8_t Wirefree::_state[MAX_SOCK_NUM] = {
0, 0, 0, 0 };
uint16_t Wirefree::_server_port[MAX_SOCK_NUM] = {
0, 0, 0, 0 };
void Wirefree::begin(uint8_t *ip, WIFI_PROFILE* w_prof)
{
uint8_t gateway[4];
gateway[0] = ip[0];
gateway[1] = ip[1];
gateway[2] = ip[2];
gateway[3] = 1;
begin(ip, gateway, w_prof);
}
void Wirefree::begin(uint8_t *ip, uint8_t *gateway, WIFI_PROFILE* w_prof)
{
uint8_t subnet[] = { 255, 255, 255, 0 };
begin(ip, gateway, subnet, w_prof);
}
void Wirefree::begin(uint8_t *ip, uint8_t *gateway, uint8_t *subnet, WIFI_PROFILE* w_prof)
{
//GS.setIPAddress(ip);
//GS.setGatewayIp(gateway);
//GS.setSubnetMask(subnet);
// initialize device
if (!GS.init()) {
return;
}
// configure params
GS.configure((GS_PROFILE*)w_prof);
// initiate connection
while (!GS.connect());
// DEBUG
GS.listen(80);
}
void Wirefree::process()
{
GS.process();
}
Wirefree Wireless;