Onboard-SDK-ROS
DJI_Codec.h
Go to the documentation of this file.
1 
22 #ifndef DJI_CODEC_H
23 #define DJI_CODEC_H
24 
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <string.h>
28 #include <memory>
29 #include "DJI_Type.h"
30 
31 #define _SDK_MAX_RECV_SIZE (BUFFER_SIZE)
32 #define _SDK_SOF ((unsigned char)(0xAA))
33 #define _SDK_CRC_HEAD_SIZE (2) // CRC16
34 #define _SDK_CRC_DATA_SIZE (4) // CRC32
35 #define _SDK_HEAD_DATA_LEN (sizeof(DJI::onboardSDK::Header) - 2)
36 #define _SDK_FULL_DATA_SIZE_MIN (sizeof(DJI::onboardSDK::Header) + _SDK_CRC_DATA_SIZE)
37 
38 #define _SDK_U32_SET(_addr, _val) (*((unsigned int *)(_addr)) = (_val))
39 #define _SDK_U16_SET(_addr, _val) (*((unsigned short *)(_addr)) = (_val))
40 
41 #define _SDK_CALC_CRC_HEAD(_msg, _len) \
42  sdk_stream_crc16_calc((const unsigned char *)(_msg), _len)
43 #define _SDK_CALC_CRC_TAIL(_msg, _len) \
44  sdk_stream_crc32_calc((const unsigned char *)(_msg), _len)
45 
46 
47 void transformTwoByte(const char *pstr, unsigned char *pdata);
48 
49 #endif // DJI_CODEC_H