Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dave Griffiths
mongoose-2000
Commits
cdff9bef
Commit
cdff9bef
authored
Nov 28, 2013
by
Dave Griffiths
Browse files
download whole db works
parent
776ae2e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
13 deletions
+35
-13
android/assets/starwisp.scm
android/assets/starwisp.scm
+12
-5
android/src/foam/mongoose/NetworkManager.java
android/src/foam/mongoose/NetworkManager.java
+23
-8
No files found.
android/assets/starwisp.scm
View file @
cdff9bef
...
@@ -1688,7 +1688,12 @@
...
@@ -1688,7 +1688,12 @@
(
string-append
url
"fn=entity-csv&table=stream&type="
e
)
(
string-append
url
"fn=entity-csv&table=stream&type="
e
)
(
string-append
"/sdcard/mongoose/"
e
".csv"
)))
(
string-append
"/sdcard/mongoose/"
e
".csv"
)))
r
))
r
))
'
()
(
list
(
debug
(
string-append
"Downloading whole db"
))
(
http-download
"getting-db"
"http://192.168.2.1:8888/mongoose.db"
(
string-append
"/sdcard/mongoose/mongoose.db"
)))
entity-types
)))
entity-types
)))
(
mbutton2
"sync-export"
"Export"
(
mbutton2
"sync-export"
"Export"
(
lambda
()
(
lambda
()
...
@@ -1697,10 +1702,12 @@
...
@@ -1697,10 +1702,12 @@
(
send-mail
(
send-mail
""
""
"From Mongoose2000"
"Please find attached your mongoose data"
"From Mongoose2000"
"Please find attached your mongoose data"
(
map
(
cons
(
lambda
(
e
)
"/sdcard/mongoose/mongoose.db"
(
string-append
"/sdcard/mongoose/"
e
".csv"
))
(
map
entity-types
))))))
(
lambda
(
e
)
(
string-append
"/sdcard/mongoose/"
e
".csv"
))
entity-types
)))))))
(
spacer
10
)
(
spacer
10
)
(
mtitle
""
"Debug"
)
(
mtitle
""
"Debug"
)
(
scroll-view-vert
(
scroll-view-vert
...
...
android/src/foam/mongoose/NetworkManager.java
View file @
cdff9bef
...
@@ -23,6 +23,7 @@ import java.io.IOException;
...
@@ -23,6 +23,7 @@ import java.io.IOException;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
...
@@ -157,18 +158,32 @@ public class NetworkManager {
...
@@ -157,18 +158,32 @@ public class NetworkManager {
InputStream
in
=
m
.
m_Stream
;
InputStream
in
=
m
.
m_Stream
;
BufferedReader
reader
=
null
;
BufferedReader
reader
=
null
;
try
{
try
{
reader
=
new
BufferedReader
(
new
InputStreamReader
(
in
));
String
line
=
""
;
String
all
=
""
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
all
+=
line
+
"\n"
;
}
Log
.
i
(
"starwisp"
,
"got data for "
+
m
.
m_CallbackName
+
"["
+
all
+
"]"
);
if
(
m
.
m_Type
.
equals
(
"download"
))
{
if
(
m
.
m_Type
.
equals
(
"download"
))
{
m_Builder
.
SaveData
(
m
.
m_CallbackName
,
all
.
getBytes
());
ByteArrayOutputStream
byteBuffer
=
new
ByteArrayOutputStream
();
// this is storage overwritten on each iteration with bytes
int
bufferSize
=
1024
;
byte
[]
buffer
=
new
byte
[
bufferSize
];
// we need to know how may bytes were read to write them to the byteBuffer
int
len
=
0
;
while
((
len
=
in
.
read
(
buffer
))
!=
-
1
)
{
byteBuffer
.
write
(
buffer
,
0
,
len
);
}
m_Builder
.
SaveData
(
m
.
m_CallbackName
,
byteBuffer
.
toByteArray
());
}
else
{
}
else
{
// results in evaluating data read from via http - fix if used from net
// results in evaluating data read from via http - fix if used from net
reader
=
new
BufferedReader
(
new
InputStreamReader
(
in
));
String
line
=
""
;
String
all
=
""
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
all
+=
line
+
"\n"
;
}
Log
.
i
(
"starwisp"
,
"got data for "
+
m
.
m_CallbackName
+
"["
+
all
+
"]"
);
m_Builder
.
DialogCallback
(
m_Context
,
m_Context
.
m_Name
,
m
.
m_CallbackName
,
all
);
m_Builder
.
DialogCallback
(
m_Context
,
m_Context
.
m_Name
,
m
.
m_CallbackName
,
all
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment