Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b943c494
Commit
b943c494
authored
Jun 08, 2014
by
none
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decode errors in list mode
parent
4d85f0b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
10 deletions
+43
-10
QGCUASFileManager.cc
src/uas/QGCUASFileManager.cc
+42
-10
QGCUASFileManager.h
src/uas/QGCUASFileManager.h
+1
-0
No files found.
src/uas/QGCUASFileManager.cc
View file @
b943c494
...
...
@@ -83,26 +83,25 @@ void QGCUASFileManager::receiveMessage(LinkInterface* link, mavlink_message_t me
return
;
}
emit
statusMessage
(
"msg"
);
qDebug
()
<<
"FTP GOT MESSAGE"
;
mavlink_encapsulated_data_t
data
;
mavlink_msg_encapsulated_data_decode
(
&
message
,
&
data
);
const
RequestHeader
*
hdr
=
(
const
RequestHeader
*
)
&
data
.
data
[
0
];
unsigned
seqnr
=
data
.
seqnr
;
// XXX VALIDATE MESSAGE
switch
(
_current_operation
)
{
case
kCOIdle
:
// we should not be seeing anything here.. shut the other guy up
emit
statusMessage
(
"resetting file transfer session"
)
;
qDebug
()
<<
"FTP resetting file transfer session"
;
sendReset
();
break
;
case
kCOList
:
if
(
hdr
->
opcode
==
kRspAck
)
{
listDecode
(
&
hdr
->
data
[
0
],
hdr
->
size
);
}
else
{
emit
statusMessage
(
"unexpected opcode in List mode"
);
}
else
if
(
hdr
->
opcode
==
kRspNak
)
{
emit
statusMessage
(
QString
(
"error: "
).
append
(
errorString
(
hdr
->
data
[
0
]))
);
}
break
;
...
...
@@ -139,12 +138,17 @@ void QGCUASFileManager::listDecode(const uint8_t *data, unsigned len)
// get the length of the name
unsigned
nlen
=
strnlen
((
const
char
*
)
data
+
offset
,
len
-
offset
);
if
(
nlen
==
0
)
{
if
(
nlen
<
2
)
{
break
;
}
QString
s
((
const
char
*
)
data
+
offset
+
1
);
if
(
data
[
0
]
==
'D'
)
{
s
.
append
(
'/'
);
}
// put it in the view
emit
statusMessage
(
QString
((
const
char
*
)
data
+
offset
)
);
emit
statusMessage
(
s
);
// account for the name + NUL
offset
+=
nlen
+
1
;
...
...
@@ -200,8 +204,6 @@ void QGCUASFileManager::sendList()
mavlink_msg_encapsulated_data_pack
(
250
,
0
,
&
message
,
_encdata_seq
,
(
uint8_t
*
)
&
hdr
);
// XXX 250 is a magic length
emit
statusMessage
(
"sending List request..."
);
_mav
->
sendMessage
(
message
);
}
...
...
@@ -225,3 +227,33 @@ void QGCUASFileManager::downloadPath(const QString &from, const QString &to)
emit
statusMessage
(
QString
(
"Downloaded: %1 to directory %2"
).
arg
(
filename
).
arg
(
to
));
}
QString
QGCUASFileManager
::
errorString
(
uint8_t
errorCode
)
{
switch
(
errorCode
)
{
case
kErrNone
:
return
QString
(
"no error"
);
case
kErrNoRequest
:
return
QString
(
"bad request"
);
case
kErrNoSession
:
return
QString
(
"bad session"
);
case
kErrSequence
:
return
QString
(
"bad sequence number"
);
case
kErrNotDir
:
return
QString
(
"not a directory"
);
case
kErrNotFile
:
return
QString
(
"not a file"
);
case
kErrEOF
:
return
QString
(
"read beyond end of file"
);
case
kErrNotAppend
:
return
QString
(
"write not at end of file"
);
case
kErrTooBig
:
return
QString
(
"file too big"
);
case
kErrIO
:
return
QString
(
"device I/O error"
);
case
kErrPerm
:
return
QString
(
"permission denied"
);
default:
return
QString
(
"bad error code"
);
}
}
src/uas/QGCUASFileManager.h
View file @
b943c494
...
...
@@ -89,6 +89,7 @@ protected:
void
listDecode
(
const
uint8_t
*
data
,
unsigned
len
);
static
quint32
crc32
(
const
uint8_t
*
src
,
unsigned
len
,
unsigned
state
);
static
QString
errorString
(
uint8_t
errorCode
);
};
...
...
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