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
2b0fff52
Commit
2b0fff52
authored
Jan 12, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mini-protocols must only communicate over single link
parent
01f26954
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
38 deletions
+68
-38
ParameterLoader.cc
src/FactSystem/ParameterLoader.cc
+14
-14
MissionManager.cc
src/MissionManager/MissionManager.cc
+11
-7
MissionManager.h
src/MissionManager/MissionManager.h
+2
-0
LogDownloadController.cc
src/ViewWidgets/LogDownloadController.cc
+3
-3
FileManager.cc
src/uas/FileManager.cc
+34
-11
FileManager.h
src/uas/FileManager.h
+3
-2
UAS.cc
src/uas/UAS.cc
+1
-1
No files found.
src/FactSystem/ParameterLoader.cc
View file @
2b0fff52
...
...
@@ -45,15 +45,15 @@ QGC_LOGGING_CATEGORY(ParameterLoaderVerboseLog, "ParameterLoaderVerboseLog")
Fact
ParameterLoader
::
_defaultFact
;
ParameterLoader
::
ParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
)
:
QObject
(
parent
),
_autopilot
(
autopilot
),
_vehicle
(
vehicle
),
_mavlink
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()),
_parametersReady
(
false
),
_initialLoadComplete
(
false
),
_defaultComponentId
(
FactSystem
::
defaultComponentId
),
_totalParamCount
(
0
)
ParameterLoader
::
ParameterLoader
(
AutoPilotPlugin
*
autopilot
,
Vehicle
*
vehicle
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_autopilot
(
autopilot
)
,
_vehicle
(
vehicle
)
,
_mavlink
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
())
,
_parametersReady
(
false
)
,
_initialLoadComplete
(
false
)
,
_defaultComponentId
(
FactSystem
::
defaultComponentId
)
,
_totalParamCount
(
0
)
{
Q_ASSERT
(
_autopilot
);
Q_ASSERT
(
_vehicle
);
...
...
@@ -321,7 +321,7 @@ void ParameterLoader::refreshAllParameters(void)
mavlink_message_t
msg
;
mavlink_msg_param_request_list_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
_vehicle
->
id
(),
MAV_COMP_ID_ALL
);
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
qCDebug
(
ParameterLoaderLog
)
<<
"Request to refresh all parameters"
;
}
...
...
@@ -522,7 +522,7 @@ void ParameterLoader::_tryCacheLookup()
mavlink_message_t
msg
;
mavlink_msg_param_request_read_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
_vehicle
->
id
(),
MAV_COMP_ID_ALL
,
"_HASH_CHECK"
,
-
1
);
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
}
void
ParameterLoader
::
_readParameterRaw
(
int
componentId
,
const
QString
&
paramName
,
int
paramIndex
)
...
...
@@ -538,7 +538,7 @@ void ParameterLoader::_readParameterRaw(int componentId, const QString& paramNam
componentId
,
// Target component id
fixedParamName
,
// Named parameter being requested
paramIndex
);
// Parameter index being requested, -1 for named
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
}
void
ParameterLoader
::
_writeParameterRaw
(
int
componentId
,
const
QString
&
paramName
,
const
QVariant
&
value
)
...
...
@@ -591,7 +591,7 @@ void ParameterLoader::_writeParameterRaw(int componentId, const QString& paramNa
mavlink_message_t
msg
;
mavlink_msg_param_set_encode
(
_mavlink
->
getSystemId
(),
_mavlink
->
getComponentId
(),
&
msg
,
&
p
);
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
}
void
ParameterLoader
::
_writeLocalParamCache
()
...
...
@@ -663,7 +663,7 @@ void ParameterLoader::_saveToEEPROM(void)
if
(
_vehicle
->
firmwarePlugin
()
->
isCapable
(
FirmwarePlugin
::
MavCmdPreflightStorageCapability
))
{
mavlink_message_t
msg
;
mavlink_msg_command_long_pack
(
_mavlink
->
getSystemId
(),
_mavlink
->
getComponentId
(),
&
msg
,
_vehicle
->
id
(),
0
,
MAV_CMD_PREFLIGHT_STORAGE
,
1
,
1
,
-
1
,
-
1
,
-
1
,
0
,
0
,
0
);
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
qCDebug
(
ParameterLoaderLog
)
<<
"_saveToEEPROM"
;
}
else
{
qCDebug
(
ParameterLoaderLog
)
<<
"_saveToEEPROM skipped due to FirmwarePlugin::isCapable"
;
...
...
src/MissionManager/MissionManager.cc
View file @
2b0fff52
...
...
@@ -34,6 +34,7 @@ QGC_LOGGING_CATEGORY(MissionManagerLog, "MissionManagerLog")
MissionManager
::
MissionManager
(
Vehicle
*
vehicle
)
:
_vehicle
(
vehicle
)
,
_dedicatedLink
(
NULL
)
,
_ackTimeoutTimer
(
NULL
)
,
_retryAck
(
AckNone
)
,
_readTransactionInProgress
(
false
)
...
...
@@ -98,7 +99,8 @@ void MissionManager::writeMissionItems(const QmlObjectListModel& missionItems)
mavlink_msg_mission_count_encode
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getSystemId
(),
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getComponentId
(),
&
message
,
&
missionCount
);
_vehicle
->
sendMessage
(
message
);
_dedicatedLink
=
_vehicle
->
priorityLink
();
_vehicle
->
sendMessageOnLink
(
_dedicatedLink
,
message
);
_startAckTimeout
(
AckMissionRequest
);
emit
inProgressChanged
(
true
);
}
...
...
@@ -120,7 +122,8 @@ void MissionManager::requestMissionItems(void)
mavlink_msg_mission_request_list_encode
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getSystemId
(),
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getComponentId
(),
&
message
,
&
request
);
_vehicle
->
sendMessage
(
message
);
_dedicatedLink
=
_vehicle
->
priorityLink
();
_vehicle
->
sendMessageOnLink
(
_dedicatedLink
,
message
);
_startAckTimeout
(
AckMissionCount
);
emit
inProgressChanged
(
true
);
}
...
...
@@ -180,10 +183,11 @@ void MissionManager::_readTransactionComplete(void)
mavlink_msg_mission_ack_encode
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getSystemId
(),
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getComponentId
(),
&
message
,
&
missionAck
);
_vehicle
->
sendMessage
(
message
);
_vehicle
->
sendMessage
OnLink
(
_dedicatedLink
,
message
);
emit
newMissionItemsAvailable
();
// FIXME: Hack to get master changed, remove before push
_finishTransaction
(
true
);
emit
newMissionItemsAvailable
();
}
void
MissionManager
::
_handleMissionCount
(
const
mavlink_message_t
&
message
)
...
...
@@ -228,7 +232,7 @@ void MissionManager::_requestNextMissionItem(void)
mavlink_msg_mission_request_encode
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getSystemId
(),
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getComponentId
(),
&
message
,
&
missionRequest
);
_vehicle
->
sendMessage
(
message
);
_vehicle
->
sendMessage
OnLink
(
_dedicatedLink
,
message
);
_startAckTimeout
(
AckMissionItem
);
}
...
...
@@ -330,7 +334,7 @@ void MissionManager::_handleMissionRequest(const mavlink_message_t& message)
mavlink_msg_mission_item_encode
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getSystemId
(),
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getComponentId
(),
&
messageOut
,
&
missionItem
);
_vehicle
->
sendMessage
(
messageOut
);
_vehicle
->
sendMessage
OnLink
(
_dedicatedLink
,
messageOut
);
_startAckTimeout
(
AckMissionRequest
);
}
...
...
src/MissionManager/MissionManager.h
View file @
2b0fff52
...
...
@@ -33,6 +33,7 @@
#include "QmlObjectListModel.h"
#include "QGCMAVLink.h"
#include "QGCLoggingCategory.h"
#include "LinkInterface.h"
class
Vehicle
;
...
...
@@ -116,6 +117,7 @@ private:
private:
Vehicle
*
_vehicle
;
LinkInterface
*
_dedicatedLink
;
QTimer
*
_ackTimeoutTimer
;
AckType_t
_retryAck
;
...
...
src/ViewWidgets/LogDownloadController.cc
View file @
2b0fff52
...
...
@@ -390,7 +390,7 @@ LogDownloadController::_requestLogData(uint8_t id, uint32_t offset, uint32_t cou
&
msg
,
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
()
->
id
(),
MAV_COMP_ID_ALL
,
id
,
offset
,
count
);
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
}
}
...
...
@@ -419,7 +419,7 @@ LogDownloadController::_requestLogList(uint32_t start, uint32_t end)
MAV_COMP_ID_ALL
,
start
,
end
);
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
//-- Wait 2 seconds before bitching about not getting anything
_timer
.
start
(
2000
);
}
...
...
@@ -556,7 +556,7 @@ LogDownloadController::eraseAll(void)
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
()
->
getComponentId
(),
&
msg
,
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
()
->
id
(),
MAV_COMP_ID_ALL
);
_vehicle
->
sendMessage
(
msg
);
_vehicle
->
sendMessage
OnLink
(
_vehicle
->
priorityLink
(),
msg
);
refresh
();
}
}
...
...
src/uas/FileManager.cc
View file @
2b0fff52
...
...
@@ -34,13 +34,14 @@
QGC_LOGGING_CATEGORY
(
FileManagerLog
,
"FileManagerLog"
)
FileManager
::
FileManager
(
QObject
*
parent
,
Vehicle
*
vehicle
)
:
QObject
(
parent
),
_currentOperation
(
kCOIdle
),
_vehicle
(
vehicle
),
_lastOutgoingSeqNumber
(
0
),
_activeSession
(
0
),
_systemIdQGC
(
0
)
FileManager
::
FileManager
(
QObject
*
parent
,
Vehicle
*
vehicle
)
:
QObject
(
parent
)
,
_currentOperation
(
kCOIdle
)
,
_vehicle
(
vehicle
)
,
_dedicatedLink
(
NULL
)
,
_lastOutgoingSeqNumber
(
0
)
,
_activeSession
(
0
)
,
_systemIdQGC
(
0
)
{
connect
(
&
_ackTimer
,
&
QTimer
::
timeout
,
this
,
&
FileManager
::
_ackTimeout
);
...
...
@@ -308,10 +309,8 @@ void FileManager::_writeFileDatablock(void)
_sendRequest
(
&
request
);
}
void
FileManager
::
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
)
void
FileManager
::
receiveMessage
(
mavlink_message_t
message
)
{
Q_UNUSED
(
link
);
// receiveMessage is signalled will all mavlink messages so we need to filter everything else out but ours.
if
(
message
.
msgid
!=
MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL
)
{
return
;
...
...
@@ -444,6 +443,12 @@ void FileManager::listDirectory(const QString& dirPath)
return
;
}
_dedicatedLink
=
_vehicle
->
priorityLink
();
if
(
!
_dedicatedLink
)
{
_emitErrorMessage
(
tr
(
"Command not sent. No Vehicle links."
));
return
;
}
// initialise the lister
_listPath
=
dirPath
;
_listOffset
=
0
;
...
...
@@ -482,6 +487,12 @@ void FileManager::downloadPath(const QString& from, const QDir& downloadDir)
return
;
}
_dedicatedLink
=
_vehicle
->
priorityLink
();
if
(
!
_dedicatedLink
)
{
_emitErrorMessage
(
tr
(
"Command not sent. No Vehicle links."
));
return
;
}
qCDebug
(
FileManagerLog
)
<<
"downloadPath from:"
<<
from
<<
"to:"
<<
downloadDir
;
_downloadWorker
(
from
,
downloadDir
,
true
/* read file */
);
}
...
...
@@ -493,6 +504,12 @@ void FileManager::streamPath(const QString& from, const QDir& downloadDir)
return
;
}
_dedicatedLink
=
_vehicle
->
priorityLink
();
if
(
!
_dedicatedLink
)
{
_emitErrorMessage
(
tr
(
"Command not sent. No Vehicle links."
));
return
;
}
qCDebug
(
FileManagerLog
)
<<
"streamPath from:"
<<
from
<<
"to:"
<<
downloadDir
;
_downloadWorker
(
from
,
downloadDir
,
false
/* stream file */
);
}
...
...
@@ -537,6 +554,12 @@ void FileManager::uploadPath(const QString& toPath, const QFileInfo& uploadFile)
return
;
}
_dedicatedLink
=
_vehicle
->
priorityLink
();
if
(
!
_dedicatedLink
)
{
_emitErrorMessage
(
tr
(
"Command not sent. No Vehicle links."
));
return
;
}
if
(
toPath
.
isEmpty
())
{
return
;
}
...
...
@@ -731,5 +754,5 @@ void FileManager::_sendRequest(Request* request)
0
,
// Target component
(
uint8_t
*
)
request
);
// Payload
_vehicle
->
sendMessage
(
message
);
_vehicle
->
sendMessage
OnLink
(
_dedicatedLink
,
message
);
}
src/uas/FileManager.h
View file @
2b0fff52
...
...
@@ -87,7 +87,7 @@ signals:
void
commandProgress
(
int
value
);
public
slots
:
void
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
receiveMessage
(
mavlink_message_t
message
);
private
slots
:
void
_ackTimeout
(
void
);
...
...
@@ -204,6 +204,7 @@ private:
QTimer
_ackTimer
;
///< Used to signal a timeout waiting for an ack
Vehicle
*
_vehicle
;
LinkInterface
*
_dedicatedLink
;
///< Link to use for communication
uint16_t
_lastOutgoingSeqNumber
;
///< Sequence number sent in last outgoing packet
...
...
src/uas/UAS.cc
View file @
2b0fff52
...
...
@@ -185,7 +185,7 @@ UAS::UAS(MAVLinkProtocol* protocol, Vehicle* vehicle, FirmwarePluginManager * fi
}
#ifndef __mobile__
connect
(
mavlink
,
&
MAVLinkProtocol
::
m
essageReceived
,
&
fileManager
,
&
FileManager
::
receiveMessage
);
connect
(
_vehicle
,
&
Vehicle
::
mavlinkM
essageReceived
,
&
fileManager
,
&
FileManager
::
receiveMessage
);
#endif
color
=
UASInterface
::
getNextColor
();
...
...
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