93 lines
2.2 KiB
C
93 lines
2.2 KiB
C
/**
|
|
* @file include/di_fw/drv/bc95.h
|
|
* @brief bc95 module header file
|
|
* @date June 1, 2017
|
|
* @copyright 2017 Dual Inventive Technology Centre B.V..
|
|
*/
|
|
#ifndef INCLUDE_DI_FW_DRV_BC95_H_
|
|
#define INCLUDE_DI_FW_DRV_BC95_H_
|
|
|
|
#include <di/types.h>
|
|
#include <di/encoding/me.h>
|
|
|
|
#include <di_fw/drv/bc95/me.h>
|
|
|
|
enum di_fw_drv_bc95_reply {
|
|
DI_FW_BC95_REPLY_TIMEOUT = -1,
|
|
DI_FW_BC95_REPLY_UNKNOWN = 0,
|
|
DI_FW_BC95_REPLY_OK,
|
|
DI_FW_BC95_REPLY_ERROR
|
|
};
|
|
|
|
enum di_fw_drv_bc95_msg_status {
|
|
DI_FW_BC95_MSG_STATUS_SENT = 0,
|
|
DI_FW_BC95_MSG_STATUS_DISCARDED,
|
|
DI_FW_BC95_MSG_STATUS_UNKNOWN
|
|
};
|
|
|
|
struct di_fw_drv_bc95_ctx {
|
|
uint8_t linebuffer[128];
|
|
uint8_t readbuffer[128];
|
|
|
|
enum di_fw_drv_bc95_reply reply;
|
|
enum di_fw_drv_bc95_msg_status msg_status;
|
|
struct di_me_ctx me; /**< driver matching engine context */
|
|
enum di_me_item_states me_items_state[DI_FW_DRV_BC95_ME_ITEMS_SIZE];
|
|
|
|
struct carrier {
|
|
uint8_t att;
|
|
uint8_t con;
|
|
uint8_t reg;
|
|
int8_t rssi;
|
|
int8_t ber;
|
|
} carrier;
|
|
};
|
|
|
|
/**
|
|
* initiate BC95 variable
|
|
*/
|
|
void di_fw_bc95_init(void);
|
|
|
|
/**
|
|
* power down the bc95 module
|
|
*/
|
|
void di_fw_bc95_disable(void);
|
|
|
|
/**
|
|
* Power up the bc95 module and wait till its ready
|
|
* @return DNOK when BC95 is ready
|
|
* @return DNE_TIMEOUT when BC95 is not started within 10 seconds
|
|
*/
|
|
di_errno_t di_fw_bc95_enable(void);
|
|
|
|
/**
|
|
* Configure BC95 module with set configuration
|
|
* @return DNOK Configuration is done properly
|
|
* @return DNE_TIMEOUT timeout occurred while trying to configure
|
|
*/
|
|
di_errno_t di_fw_bc95_configure(void);
|
|
|
|
/**
|
|
* Wait for connection to network
|
|
* @return DNOK network is connected
|
|
* @return DNE_TIMEOUT Network not found within 30 seconds
|
|
*/
|
|
di_errno_t di_fw_bc95_wait_for_connection(void);
|
|
|
|
/**
|
|
* Send data to server
|
|
* @param wbuf Data to be written to server, should be hex encoded
|
|
* @return DNOK message send correctly
|
|
* @return DNE_TIMEOUT message not send
|
|
*/
|
|
di_errno_t di_fw_bc95_send_data(const char *wbuf);
|
|
|
|
/**
|
|
* set the BC95 module to low power mode
|
|
* @return DNOK Configuration is done properly
|
|
* @return DNE_TIMEOUT timeout occurred while trying to configure
|
|
*/
|
|
di_errno_t di_fw_bc95_low_power_mode(void);
|
|
|
|
#endif /* INCLUDE_DI_FW_DRV_BC95_H_ */
|