dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uavtalk.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 #ifndef UAVTALK_H
31 #define UAVTALK_H
32 
33 // Public types
34 typedef int32_t (*UAVTalkOutputCb)(void *ctx, uint8_t *data, int32_t length);
35 typedef void (*UAVTalkAckCb)(void *ctx, uint32_t obj_id, uint16_t inst_id);
36 typedef void (*UAVTalkReqCb)(void *ctx, uint32_t obj_id, uint16_t inst_id);
37 typedef int32_t (*UAVTalkFileCb)(void *ctx, uint8_t *buf,
38  uint32_t file_id, uint32_t offset, uint32_t len);
39 
41 typedef struct {
42  uint32_t txBytes;
43  uint32_t rxBytes;
44  uint32_t txObjectBytes;
45  uint32_t rxObjectBytes;
46  uint32_t rxObjects;
47  uint32_t txObjects;
48  uint32_t txErrors;
49  uint32_t rxErrors;
50  uint32_t rxCRC;
51 } UAVTalkStats;
52 
53 typedef void* UAVTalkConnection;
54 
57 
58 // Public functions
60 int32_t UAVTalkSendObject(UAVTalkConnection connection, UAVObjHandle obj, uint16_t instId, uint8_t acked);
61 int32_t UAVTalkSendObjectTimestamped(UAVTalkConnection connectionHandle, UAVObjHandle obj, uint16_t instId);
62 int32_t UAVTalkSendNack(UAVTalkConnection connectionHandle, uint32_t objId, uint16_t instId);
63 void UAVTalkProcessInputStream(UAVTalkConnection connectionHandle, uint8_t *rxbytes,
64  int numbytes);
66 int32_t UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle);
67 int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle);
69 uint32_t UAVTalkGetPacketObjId(UAVTalkConnection connection);
70 uint32_t UAVTalkGetPacketInstId(UAVTalkConnection connection);
71 
72 #endif // UAVTALK_H
73 
int32_t(* UAVTalkOutputCb)(void *ctx, uint8_t *data, int32_t length)
Definition: uavtalk.h:34
void(* UAVTalkAckCb)(void *ctx, uint32_t obj_id, uint16_t inst_id)
Definition: uavtalk.h:35
int32_t UAVTalkSendObjectTimestamped(UAVTalkConnection connectionHandle, UAVObjHandle obj, uint16_t instId)
Definition: uavtalk.c:142
uint32_t rxErrors
Definition: uavtalk.h:49
int32_t UAVTalkSendNack(UAVTalkConnection connectionHandle, uint32_t objId, uint16_t instId)
Definition: uavtalk.c:903
static void ackCallback(void *ctx, uint32_t obj_id, uint16_t inst_id)
Definition: telemetry.c:520
void UAVTalkGetStats(UAVTalkConnection connection, UAVTalkStats *stats)
Definition: uavtalk.c:93
uint32_t txObjectBytes
Definition: uavtalk.h:44
uint32_t rxObjects
Definition: uavtalk.h:46
uint32_t rxCRC
Definition: uavtalk.h:50
void(* UAVTalkReqCb)(void *ctx, uint32_t obj_id, uint16_t inst_id)
Definition: uavtalk.h:36
void UAVTalkProcessInputStream(UAVTalkConnection connectionHandle, uint8_t *rxbytes, int numbytes)
Definition: uavtalk.c:423
static void reqCallback(void *ctx, uint32_t obj_id, uint16_t inst_id)
Definition: telemetry.c:488
uint32_t txBytes
Definition: uavtalk.h:42
uint8_t data[XFER_BYTES_PER_PACKET]
Definition: bl_messages.h:129
uint8_t length
uint32_t rxBytes
Definition: uavtalk.h:43
void * UAVTalkConnection
Definition: uavtalk.h:53
UAVTalkConnection UAVTalkInitialize(void *ctx, UAVTalkOutputCb outputStream, UAVTalkAckCb ackCallback, UAVTalkReqCb reqCallback, UAVTalkFileCb fileCallback)
Definition: uavtalk.c:59
int32_t(* UAVTalkFileCb)(void *ctx, uint8_t *buf, uint32_t file_id, uint32_t offset, uint32_t len)
Definition: uavtalk.h:37
uint32_t txObjects
Definition: uavtalk.h:47
uint32_t rxObjectBytes
Definition: uavtalk.h:45
uint32_t obj_id
uint32_t UAVTalkGetPacketInstId(UAVTalkConnection connection)
Definition: uavtalk.c:564
Tracking statistics for a UAVTalk connection.
Definition: uavtalk.h:41
uint32_t offset
Definition: uavtalk_priv.h:51
static EventStats stats
Definition: systemmod.c:132
int32_t UAVTalkSendObject(UAVTalkConnection connection, UAVObjHandle obj, uint16_t instId, uint8_t acked)
Definition: uavtalk.c:120
UAVTalkRxState
Definition: uavtalk.h:55
UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connection, uint8_t rxbyte)
Definition: uavtalk.c:180
int32_t UAVTalkReceiveObject(UAVTalkConnection connectionHandle)
Definition: uavtalk.c:531
uint32_t file_id
int32_t UAVTalkRelayPacket(UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle)
Definition: uavtalk.c:451
uint32_t txErrors
Definition: uavtalk.h:48
uint32_t UAVTalkGetPacketObjId(UAVTalkConnection connection)
Definition: uavtalk.c:550