60 lines
1.6 KiB
C
60 lines
1.6 KiB
C
/**
|
|
* @file include/di/drv/xbee/frame.h
|
|
* @ingroup XBee
|
|
* @brief DI XBee frame functions.
|
|
* @date March 30, 2017
|
|
* @author svlies
|
|
* @copyright 2017 Dual Inventive Technology Centre B.V.
|
|
*
|
|
* DI XBee frame functions.
|
|
* @{
|
|
*/
|
|
|
|
#ifndef LIBDI_INCLUDE_DI_DRV_XBEE_FRAME_H_
|
|
#define LIBDI_INCLUDE_DI_DRV_XBEE_FRAME_H_
|
|
|
|
#include <di/drv/xbee.h>
|
|
#include <di/drv/xbee/definitions.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define DI_DRV_XBEE_FRAME_NETWORK_SLEEP 0x0c
|
|
#define DI_DRV_XBEE_FRAME_NETWORK_WOKE_UP 0x0b
|
|
|
|
/*
|
|
* Xbee parsed frame struct
|
|
*/
|
|
struct di_drv_xbee_frame {
|
|
enum di_drv_xbee_frame_types type; /**<Frametype of the received frame.*/
|
|
char src_addr[17]; /**<Source address of the received frame if remote frame.*/
|
|
uint8_t id; /**<Frame ID of the received frame.*/
|
|
char cmd[3]; /**<AT command of the received frame.*/
|
|
enum di_drv_xbee_cmd_status cmd_status; /**<AT command status of the received frame.*/
|
|
uint8_t size; /**<Size of the data attached to the frame.*/
|
|
uint8_t data[DI_DRV_XBEE_DEFAULT_FRAME_MAX_FRAME_SIZE];/**<Array of the frame data.*/
|
|
};
|
|
|
|
/**
|
|
* converts the frame in the di_buffer to a xbee_frame struct.
|
|
* @param buf Buffer with the serialized frame.
|
|
* @param frame frame to write to.
|
|
* @return Returns DNE_CHECKSUM if incorrect checksum, corrupt source address or unsupported frametype.
|
|
*/
|
|
di_errno_t di_drv_xbee_frame_deserialize(struct di_buffer *buf, struct di_drv_xbee_frame *frame);
|
|
|
|
/**
|
|
* Init the Xbee_frame
|
|
* @param frame Frame to init.
|
|
*/
|
|
void di_drv_xbee_frame_init(struct di_drv_xbee_frame *frame);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
#endif /* LIBDI_INCLUDE_DI_DRV_XBEE_FRAME_H_ */
|