RUI3 (RAK Unified Interface 3) - RAK4631
FragDecoder.h
Go to the documentation of this file.
1 
23 #ifdef SUPPORT_FUOTA
24 
25 #ifndef __FRAG_DECODER_H__
26 #define __FRAG_DECODER_H__
27 
28 #include <stdint.h>
29 
34 #define FRAG_DECODER_FILE_HANDLING_NEW_API 1
35 
41 #define FRAG_MAX_NB 4000
42 
48 #define FRAG_MAX_SIZE 100
49 
55 #define FW_LOCATION 0X7D000
56 
57 
63 #define FRAG_MAX_REDUNDANCY 100
64 
65 #define FRAG_SESSION_FINISHED ( int32_t )0
66 #define FRAG_SESSION_NOT_STARTED ( int32_t )-2
67 #define FRAG_SESSION_ONGOING ( int32_t )-1
68 
69 typedef struct sFragDecoderStatus
70 {
71  uint16_t FragNbRx;
72  uint16_t FragNbLost;
73  uint16_t FragNbLastRx;
74  uint8_t MatrixError;
75 }FragDecoderStatus_t;
76 
77 #if( FRAG_DECODER_FILE_HANDLING_NEW_API == 1 )
78 typedef struct sFragDecoderCallbacks
79 {
89  int8_t ( *FragDecoderWrite )( uint32_t addr, uint32_t size , uint8_t *data);
99  int8_t ( *FragDecoderRead )( uint32_t addr, uint32_t size, uint8_t *data );
100 }FragDecoderCallbacks_t;
101 #endif
102 
103 #if( FRAG_DECODER_FILE_HANDLING_NEW_API == 1 )
104 
111 void FragDecoderInit( uint16_t fragNb, uint8_t fragSize, FragDecoderCallbacks_t *callbacks );
112 #else
113 
121 void FragDecoderInit( uint16_t fragNb, uint8_t fragSize, uint8_t *file, uint32_t fileSize );
122 #endif
123 
124 #if( FRAG_DECODER_FILE_HANDLING_NEW_API == 1 )
125 
130 uint32_t FragDecoderGetMaxFileSize( void );
131 #endif
132 
144 int32_t FragDecoderProcess( uint16_t fragCounter, uint8_t *rawData );
145 
151 FragDecoderStatus_t FragDecoderGetStatus( void );
152 
153 #endif // __FRAG_DECODER_H__
154 
155 #endif // FUOTA