From 22f48ce8b0af3f3db7483902ee66fe5bf297d14e Mon Sep 17 00:00:00 2001 From: Brian Webb Date: Wed, 2 May 2012 20:42:37 -0700 Subject: [PATCH] Exposed the Send ACK/NACK function in UAVTalk. --- flight/UAVTalk/inc/uavtalk.h | 2 ++ flight/UAVTalk/uavtalk.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/flight/UAVTalk/inc/uavtalk.h b/flight/UAVTalk/inc/uavtalk.h index f15dd1a0a..a45fdb0db 100644 --- a/flight/UAVTalk/inc/uavtalk.h +++ b/flight/UAVTalk/inc/uavtalk.h @@ -53,6 +53,8 @@ int32_t UAVTalkSetOutputStream(UAVTalkConnection connection, UAVTalkOutputStream UAVTalkOutputStream UAVTalkGetOutputStream(UAVTalkConnection connection); int32_t UAVTalkSendObject(UAVTalkConnection connection, UAVObjHandle obj, uint16_t instId, uint8_t acked, int32_t timeoutMs); int32_t UAVTalkSendObjectRequest(UAVTalkConnection connection, UAVObjHandle obj, uint16_t instId, int32_t timeoutMs); +int32_t UAVTalkSendAck(UAVTalkConnection connectionHandle, UAVObjHandle obj, uint16_t instId); +int32_t UAVTalkSendNack(UAVTalkConnection connectionHandle, uint32_t objId); UAVTalkRxState UAVTalkProcessInputStream(UAVTalkConnection connection, uint8_t rxbyte); UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connection, uint8_t rxbyte); void UAVTalkGetStats(UAVTalkConnection connection, UAVTalkStats *stats); diff --git a/flight/UAVTalk/uavtalk.c b/flight/UAVTalk/uavtalk.c index 4e944d2ae..bf0d7e100 100644 --- a/flight/UAVTalk/uavtalk.c +++ b/flight/UAVTalk/uavtalk.c @@ -489,6 +489,36 @@ UAVTalkRxState UAVTalkProcessInputStream(UAVTalkConnection connectionHandle, uin return state; } +/** + * Send a ACK through the telemetry link. + * \param[in] connectionHandle UAVTalkConnection to be used + * \param[in] objId Object ID to send a NACK for + * \return 0 Success + * \return -1 Failure + */ +int32_t UAVTalkSendAck(UAVTalkConnection connectionHandle, UAVObjHandle obj, uint16_t instId) +{ + UAVTalkConnectionData *connection; + CHECKCONHANDLE(connectionHandle,connection,return -1); + + return sendObject(connection, obj, instId, UAVTALK_TYPE_ACK); +} + +/** + * Send a NACK through the telemetry link. + * \param[in] connectionHandle UAVTalkConnection to be used + * \param[in] objId Object ID to send a NACK for + * \return 0 Success + * \return -1 Failure + */ +int32_t UAVTalkSendNack(UAVTalkConnection connectionHandle, uint32_t objId) +{ + UAVTalkConnectionData *connection; + CHECKCONHANDLE(connectionHandle,connection,return -1); + + return sendNack(connection, objId); +} + /** * Receive an object. This function process objects received through the telemetry stream. * \param[in] connection UAVTalkConnection to be used