mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-548 Removes create option from UAVTalkReceiveObject and creates a new function UAVTalkReceiveObjectNoCreate.
This commit is contained in:
parent
4e6077ca2a
commit
b18ff22142
@ -553,7 +553,7 @@ static void ProcessTelemetryStream(UAVTalkConnection inConnectionHandle, UAVTalk
|
||||
case OPLINKSETTINGS_OBJID:
|
||||
case MetaObjectId(OPLINKSTATUS_OBJID):
|
||||
case MetaObjectId(OPLINKSETTINGS_OBJID):
|
||||
UAVTalkReceiveObject(inConnectionHandle, true);
|
||||
UAVTalkReceiveObject(inConnectionHandle);
|
||||
break;
|
||||
case OBJECTPERSISTENCE_OBJID:
|
||||
case MetaObjectId(OBJECTPERSISTENCE_OBJID):
|
||||
@ -566,7 +566,7 @@ static void ProcessTelemetryStream(UAVTalkConnection inConnectionHandle, UAVTalk
|
||||
// Second ack/nack will not match an open transaction or will apply to wrong transaction
|
||||
// Question : how does GCS handle receiving the same object twice
|
||||
// The OBJECTPERSISTENCE logic can be broken too if for example OPLM nacks and then REVO acks...
|
||||
UAVTalkReceiveObject(inConnectionHandle, true);
|
||||
UAVTalkReceiveObject(inConnectionHandle);
|
||||
// relay packet to remote modem
|
||||
UAVTalkRelayPacket(inConnectionHandle, outConnectionHandle);
|
||||
break;
|
||||
@ -611,7 +611,7 @@ static void ProcessRadioStream(UAVTalkConnection inConnectionHandle, UAVTalkConn
|
||||
case OPLINKRECEIVER_OBJID:
|
||||
case MetaObjectId(OPLINKRECEIVER_OBJID):
|
||||
// Receive object locally
|
||||
UAVTalkReceiveObject(inConnectionHandle, true);
|
||||
UAVTalkReceiveObject(inConnectionHandle);
|
||||
// Also send the packet to the telemetry point.
|
||||
UAVTalkRelayPacket(inConnectionHandle, outConnectionHandle);
|
||||
break;
|
||||
|
@ -511,6 +511,7 @@ unlock_exit:
|
||||
* \param[in] obj The object handle
|
||||
* \param[in] instId The instance ID
|
||||
* \param[in] dataIn The byte array
|
||||
* \param[in] create Create the object if it does not already exist.
|
||||
* \return 0 if success or -1 if failure
|
||||
*/
|
||||
int32_t UAVObjUnpack(UAVObjHandle obj_handle, uint16_t instId, const uint8_t *dataIn, bool create)
|
||||
|
@ -60,7 +60,8 @@ int32_t UAVTalkSendObjectRequest(UAVTalkConnection connection, UAVObjHandle obj,
|
||||
UAVTalkRxState UAVTalkProcessInputStream(UAVTalkConnection connectionHandle, uint8_t *rxbuffer, uint8_t length);
|
||||
UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connectionHandle, uint8_t *rxbuffer, uint8_t length, uint8_t *position);
|
||||
int32_t UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle);
|
||||
int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle, bool create);
|
||||
int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle);
|
||||
int32_t UAVTalkReceiveObjectNoCreate(UAVTalkConnection connectionHandle);
|
||||
void UAVTalkGetStats(UAVTalkConnection connection, UAVTalkStats *stats, bool reset);
|
||||
void UAVTalkAddStats(UAVTalkConnection connection, UAVTalkStats *stats, bool reset);
|
||||
void UAVTalkResetStats(UAVTalkConnection connection);
|
||||
|
@ -444,7 +444,7 @@ UAVTalkRxState UAVTalkProcessInputStream(UAVTalkConnection connectionHandle, uin
|
||||
while (position < length) {
|
||||
state = UAVTalkProcessInputStreamQuiet(connectionHandle, rxbuffer, length, &position);
|
||||
if (state == UAVTALK_STATE_COMPLETE) {
|
||||
UAVTalkReceiveObject(connectionHandle, true);
|
||||
UAVTalkReceiveObject(connectionHandle);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
@ -546,7 +546,7 @@ int32_t UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnecti
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle, bool create)
|
||||
int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle)
|
||||
{
|
||||
UAVTalkConnectionData *connection;
|
||||
|
||||
@ -557,7 +557,28 @@ int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle, bool create)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return receiveObject(connection, iproc->type, iproc->objId, iproc->instId, connection->rxBuffer, create);
|
||||
return receiveObject(connection, iproc->type, iproc->objId, iproc->instId, connection->rxBuffer, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete receiving a UAVTalk packet. This will cause the packet to be unpacked, acked, etc.
|
||||
* This version will not create/unpack an object if it does not already exist.
|
||||
* \param[in] connectionHandle UAVTalkConnection to be used
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t UAVTalkReceiveObjectNoCreate(UAVTalkConnection connectionHandle)
|
||||
{
|
||||
UAVTalkConnectionData *connection;
|
||||
|
||||
CHECKCONHANDLE(connectionHandle, connection, return -1);
|
||||
|
||||
UAVTalkInputProcessor *iproc = &connection->iproc;
|
||||
if (iproc->state != UAVTALK_STATE_COMPLETE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return receiveObject(connection, iproc->type, iproc->objId, iproc->instId, connection->rxBuffer, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user