mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-1122 OP-1125 uavtalk - more OPReview-593 related cleanups
This commit is contained in:
parent
50a0a4f512
commit
15c4392ed5
@ -671,11 +671,19 @@ uint32_t UAVTalkGetPacketObjId(UAVTalkConnection connectionHandle)
|
|||||||
UAVTalkConnectionData *connection;
|
UAVTalkConnectionData *connection;
|
||||||
|
|
||||||
CHECKCONHANDLE(connectionHandle, connection, return 0);
|
CHECKCONHANDLE(connectionHandle, connection, return 0);
|
||||||
|
|
||||||
return connection->iproc.objId;
|
return connection->iproc.objId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive an object. This function process objects received through the telemetry stream.
|
* Receive an object. This function process objects received through the telemetry stream.
|
||||||
|
*
|
||||||
|
* Parser errors are considered as transmission errors and are not NACKed.
|
||||||
|
* Some senders (GCS) can timeout and retry if the message is not answered by an ack or nack.
|
||||||
|
*
|
||||||
|
* Object handling errors are considered as application errors and are NACked.
|
||||||
|
* In that case we want to nack as there is no point in the sender retrying to send invalid objects.
|
||||||
|
*
|
||||||
* \param[in] connection UAVTalkConnection to be used
|
* \param[in] connection UAVTalkConnection to be used
|
||||||
* \param[in] type Type of received message (UAVTALK_TYPE_OBJ, UAVTALK_TYPE_OBJ_REQ, UAVTALK_TYPE_OBJ_ACK, UAVTALK_TYPE_ACK, UAVTALK_TYPE_NACK)
|
* \param[in] type Type of received message (UAVTALK_TYPE_OBJ, UAVTALK_TYPE_OBJ_REQ, UAVTALK_TYPE_OBJ_ACK, UAVTALK_TYPE_ACK, UAVTALK_TYPE_NACK)
|
||||||
* \param[in] objId ID of the object to work on
|
* \param[in] objId ID of the object to work on
|
||||||
@ -714,9 +722,9 @@ static int32_t receiveObject(UAVTalkConnectionData *connection,
|
|||||||
if (obj && (instId != UAVOBJ_ALL_INSTANCES)) {
|
if (obj && (instId != UAVOBJ_ALL_INSTANCES)) {
|
||||||
// Unpack object, if the instance does not exist it will be created!
|
// Unpack object, if the instance does not exist it will be created!
|
||||||
if (UAVObjUnpack(obj, instId, data)) {
|
if (UAVObjUnpack(obj, instId, data)) {
|
||||||
// Check if an ack is pending OBJ_ACK below
|
// Check if this object acks a pending OBJ_REQ message
|
||||||
// TODO is it necessary to do that check?
|
// any OBJ message can ack a pending OBJ_REQ message
|
||||||
// TODO if yes, why is the same check not done for OBJ_ACK below?
|
// even one that was not sent in response to the OBJ_REQ message
|
||||||
updateAck(connection, obj, instId);
|
updateAck(connection, obj, instId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -750,6 +758,7 @@ static int32_t receiveObject(UAVTalkConnectionData *connection,
|
|||||||
// Check if requested object exists
|
// Check if requested object exists
|
||||||
if (obj && ((instId == UAVOBJ_ALL_INSTANCES) || instId < UAVObjGetNumInstances(obj))) {
|
if (obj && ((instId == UAVOBJ_ALL_INSTANCES) || instId < UAVObjGetNumInstances(obj))) {
|
||||||
// Object found, transmit it
|
// Object found, transmit it
|
||||||
|
// This OBJ message will also ack this request
|
||||||
sendObject(connection, UAVTALK_TYPE_OBJ, objId, instId, obj);
|
sendObject(connection, UAVTALK_TYPE_OBJ, objId, instId, obj);
|
||||||
} else {
|
} else {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
@ -462,6 +462,13 @@ bool UAVTalk::processInputByte(quint8 rxbyte)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive an object. This function process objects received through the telemetry stream.
|
* Receive an object. This function process objects received through the telemetry stream.
|
||||||
|
*
|
||||||
|
* Parser errors are considered as transmission errors and are not NACKed.
|
||||||
|
* Some senders (GCS) can timeout and retry if the message is not answered by an ack or nack.
|
||||||
|
*
|
||||||
|
* Object handling errors are considered as application errors and are NACked.
|
||||||
|
* In that case we want to nack as there is no point in the sender retrying to send invalid objects.
|
||||||
|
*
|
||||||
* \param[in] type Type of received message (TYPE_OBJ, TYPE_OBJ_REQ, TYPE_OBJ_ACK, TYPE_ACK, TYPE_NACK)
|
* \param[in] type Type of received message (TYPE_OBJ, TYPE_OBJ_REQ, TYPE_OBJ_ACK, TYPE_ACK, TYPE_NACK)
|
||||||
* \param[in] obj Handle of the received object
|
* \param[in] obj Handle of the received object
|
||||||
* \param[in] instId The instance ID of UAVOBJ_ALL_INSTANCES for all instances.
|
* \param[in] instId The instance ID of UAVOBJ_ALL_INSTANCES for all instances.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user