| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #ifndef BLE_ACTION_H__
- #define BLE_ACTION_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "define.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define BLE_ACTION_TICKS 10
- //设置状态
- typedef enum{
- SET_PARAM_SUCCESS = 0x01,
- SET_PARAM_FAILURE = 0x02,
- }ble_param_set_stat_e;
- /*CAN 接口功能设置
- 波特率
- CAN_BAUD_100 = 100,
- CAN_BAUD_150 = 150,
- CAN_BAUD_200 = 200,
- CAN_BAUD_250 = 250,
- CAN_BAUD_300 = 300,
- CAN_BAUD_400 = 400,
- CAN_BAUD_500 = 500,
- CAN_BAUD_666 = 666,
- CAN_BAUD_800 = 800,
- CAN_BAUD_1000 = 1000
- */
- typedef struct{
- uint16_t can_baud; //通讯波特率。
- }__attribute__((packed)) ble_can_set_s;
- typedef enum{
- BLE_DOWNLOAD_MAIN = (uint8_t)0x01,
- BLE_UPLOAD_SLAVE = (uint8_t)0x02,
- }ble_dev_data_type_e;
- typedef enum{
- INS_TOKEN = (uint8_t)0x01, //获取token
- INS_PARAM_SET = (uint8_t)0x02, //参数设置指令
- INS_PARAM_GET = (uint8_t)0x03, //获取设置参数指令
- INS_DATA_GET = (uint8_t)0x04, //获取数据指令
- INS_CONTROL = (uint8_t)0x05, //控制指令
- INS_FIRMWARE = (uint8_t)0xEE, //固件获取指令
- }ble_dev_ins_e;
- typedef enum{
- PARAM_SET_CAN = (uint8_t)0x01, //CAN参数设置
- PARAM_SET_ELECT_TIME = (uint8_t)0x02, //电磁锁上电时间参数设置
- PARAM_SET_RST = (uint8_t)0xEE, //设备重启
- }ble_dev_param_set_e;
- typedef enum{
- PARAM_GET_CAN = (uint8_t)0x01, //CAN参数设置
- }ble_dev_param_get_e;
- typedef enum{
- DATA_GET_NFC = (uint8_t)0x01, //获取电子钥匙NFC号
- }ble_dev_data_get_e;
- typedef enum{
- CONTROL_LOCK = (uint8_t)0x01, //电磁锁控制
- CONTROL_CHARGE = (uint8_t)0x02, //充电控制
- }ble_dev_control_e;
- typedef enum{
- FIRMWARE_GET = (uint8_t)0x01, //获取固件版本号
- FIRMWARE_RST = (uint8_t)0x02, //设备重启
- FIRMWARE_LOCK = (uint8_t)0xAA,
- }ble_dev_firmware_e;
- typedef struct {
- ble_dev_ins_e ins;
- ble_dev_data_type_e data_type;
- uint8_t len;
- uint8_t cmd;
- uint8_t *data;
- uint32_t unixtime;
- uint32_t token;
- }__attribute__((packed)) ble_data_s;
- typedef void (*upload_ble_data_func)(uint8_t *data, int len);
- uint16_t ble_action_task_process_event(uint8_t task_id, uint16_t events);
- bool download_ble_data_callback(uint8_t *data, int len);
- bool download_ble_file_callback(uint8_t *data, int len);
- void set_upload_ble_data_func(upload_ble_data_func func);
- void ble_connect_act(bool stat);
- void ble_action_init(void);
- void ble_get_scancode_send(void);
- void vBle_action_init(void);
- #ifdef __cplusplus
- }
- #endif
- #endif // _BLE_ACTION_H__
- /** @} */
|