Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 111 lines (93 sloc) 3.024 kb
9b13393 @harlequin-tech Fixed a bug in the getsTerm() function where the terminating character
authored
1 /*-
2 * Copyright (c) 2012 Darran Hunt (darran [at] hunt dot net dot nz)
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
16 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
17 * THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 /*
27 * @file WiFly RN-XV ftp methods
28 */
29
30 #include "WiFlyHQ.h"
31
32 /** Restore the default ftp settings. These
33 * are the settings needed to upgrade the firmware.
34 * Is this needed? Why not just use factory defaults?
35 */
36 boolean WiFly::setFtpDefaults(void)
37 {
38 setFtpAddress("208.109.78.34");
39 setFtpDirectory("public");
40 setFtpUser("roving");
41 setFtpPassword("Pass123");
42 setFtpFilename("wifly-EZX.img");
43 setFtpTimer(10000);
44 setFtpPort(21);
45 setFtpMode(0);
46
47 return true;
48 }
49
50 boolean WiFly::setFtpAddress(const char *addr)
51 {
52 return setopt(PSTR("set ftp address"), addr);
53 }
54
55 boolean WiFly::setFtpPort(uint16_t port)
56 {
57 return setopt(PSTR("set ftp remote"),port);
58 }
59
60 boolean WiFly::setFtpDirectory(const char *dir)
61 {
62 return setopt(PSTR("set ftp dir"), dir);
63 }
64
65 boolean WiFly::setFtpUser(const char *user)
66 {
67 return setopt(PSTR("set ftp user"), user);
68 }
69
70 boolean WiFly::setFtpPassword(const char *password)
71 {
72 return setopt(PSTR("set ftp password"), password);
73 }
74
75 boolean WiFly::setFtpFilename(const char *filename)
76 {
77 return setopt(PSTR("set ftp filename"), filename);
78 }
79
80 boolean WiFly::setFtpTimer(uint16_t msecs)
81 {
82 return setopt(PSTR("set ftp timer"), msecs / 125);
83 }
84
85 boolean WiFly::setFtpMode(uint8_t mode)
86 {
87 return setopt(PSTR("set ftp mode"), mode, HEX);
88 }
89
90 boolean WiFly::ftpGet(
91 const char *addr,
92 const char *dir,
93 const char *user,
94 const char *password,
95 const char *filename)
96 {
97 setFtpAddress(addr);
98 setFtpDirectory(dir);
99 setFtpUser(user);
100 setFtpPassword(password);
101
102 send_P(PSTR("ftp get "));
103 println(filename);
104
105 /* Wait for *OPEN* */
106 /* XXX TBD */
107
108 return true;
109 }
110
Something went wrong with that request. Please try again.