144 lines
4.4 KiB
C
144 lines
4.4 KiB
C
|
#ifndef UWATER_FRAME_FUNC_REPLAY_BLE_H
|
|||
|
#define UWATER_FRAME_FUNC_REPLAY_BLE_H
|
|||
|
#include "sys_config.h"
|
|||
|
#include "type.h"
|
|||
|
#if PRODUCT_BLE_SS
|
|||
|
//----------------------------------------------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԼЭ<D4BC><D0AD>----------------------------------------/
|
|||
|
/**
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD>ʶ0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define BLE_READ_DATA_DI0 0x00
|
|||
|
#define BLE_READ_DATA_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
#define BLE_VALVE_CTRL_DI0 0x01
|
|||
|
#define BLE_VALVE_CTRL_DI1 0x50
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ַ
|
|||
|
#define BLE_READ_MET_DI0 0x02
|
|||
|
#define BLE_READ_MET_DI1 0x50
|
|||
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>ַ
|
|||
|
#define BLE_SET_MET_DI0 0x03
|
|||
|
#define BLE_SET_MET_DI1 0x50
|
|||
|
//<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define BLE_SET_DATA_DI0 0x04
|
|||
|
#define BLE_SET_DATA_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
#define BLE_SET_BOOT_DI0 0x05
|
|||
|
#define BLE_SET_BOOT_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾
|
|||
|
#define BLE_READ_VERSION_DI0 0x06
|
|||
|
#define BLE_READ_VERSION_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
#define BLE_READ_TIME_DI0 0x07
|
|||
|
#define BLE_READ_TIME_DI1 0x50
|
|||
|
//<2F><><EFBFBD>ñ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
#define BLE_SET_TIME_DI0 0x08
|
|||
|
#define BLE_SET_TIME_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>
|
|||
|
#define BLE_TEST_START_DI0 0x09
|
|||
|
#define BLE_TEST_START_DI1 0x50
|
|||
|
//<2F><>ѯ<EFBFBD>Լ<EFBFBD>
|
|||
|
#define BLE_TEST_READ_DI0 0x0A
|
|||
|
#define BLE_TEST_READ_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD>У
|
|||
|
#define BLE_ADJUST_START_DI0 0x0B
|
|||
|
#define BLE_ADJUST_START_DI1 0x50
|
|||
|
//<2F><>ѯУ
|
|||
|
#define BLE_ADJUST_READ_DI0 0x0C
|
|||
|
#define BLE_ADJUST_READ_DI1 0x50
|
|||
|
//<2F><>SOE
|
|||
|
#define BLE_READ_SOE_DI0 0x0D
|
|||
|
#define BLE_READ_SOE_DI1 0x50
|
|||
|
//<2F><>Ƿѹ<C7B7><D1B9>ֵ
|
|||
|
#define BLE_READ_PWLOW_DI0 0x0E
|
|||
|
#define BLE_READ_PWLOW_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ƿѹ<C7B7><D1B9>ֵ
|
|||
|
#define BLE_SET_PWLOW_DI0 0x0F
|
|||
|
#define BLE_SET_PWLOW_DI1 0x50
|
|||
|
//<2F><>EE<45><45><EFBFBD><EFBFBD>
|
|||
|
#define BLE_READ_EEPROM_DI0 0x10
|
|||
|
#define BLE_READ_EEPROM_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD>EEPROM
|
|||
|
#define BLE_ERASE_EEPROM_DI0 0x11
|
|||
|
#define BLE_ERASE_EEPROM_DI1 0x50
|
|||
|
//<2F><>RAM<41><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define BLE_READ_RAM_DI0 0x12
|
|||
|
#define BLE_READ_RAM_DI1 0x50
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>澯ֵ<E6BEAF><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
#define BLE_READ_OVERFLOW_DI0 0x13
|
|||
|
#define BLE_READ_OVERFLOW_DI1 0x50
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD>澯ֵ<E6BEAF><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
#define BLE_SET_OVERFLOW_DI0 0x14
|
|||
|
#define BLE_SET_OVERFLOW_DI1 0x50
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>澯ֵ<E6BEAF><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
#define BLE_READ_ROVERFLOW_DI0 0x15
|
|||
|
#define BLE_READ_ROVERFLOW_DI1 0x50
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD>澯ֵ<E6BEAF><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
#define BLE_SET_ROVERFLOW_DI0 0x16
|
|||
|
#define BLE_SET_ROVERFLOW_DI1 0x50
|
|||
|
//<2F><><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define BLE_READ_DAILY_DI0 0x17
|
|||
|
#define BLE_READ_DAILY_DI1 0x50
|
|||
|
//<2F><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define BLE_READ_MONTH_DI0 0x18
|
|||
|
#define BLE_READ_MONTH_DI1 0x50
|
|||
|
//MCU<43><55><EFBFBD><EFBFBD>
|
|||
|
#define BLE_RESET_MCU_DI0 0x19
|
|||
|
#define BLE_RESET_MCU_DI1 0x50
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define BLE_SET_CONFIG_DI0 0x1A
|
|||
|
#define BLE_SET_CONFIG_DI1 0x50
|
|||
|
//<2F><>˲ʱ<CBB2><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
#define BLE_READ_FLOWTEMP_DI0 0x1B
|
|||
|
#define BLE_READ_FLOWTEMP_DI1 0x50
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>춨
|
|||
|
#define BLE_ENTER_TEST_DI0 0x1C
|
|||
|
#define BLE_ENTER_TEST_DI1 0x50
|
|||
|
//<2F><><EFBFBD>춨<EFBFBD><ECB6A8><EFBFBD><EFBFBD>
|
|||
|
#define BLE_READ_TEST_DI0 0x1D
|
|||
|
#define BLE_READ_TEST_DI1 0x50
|
|||
|
//<2F>˳<EFBFBD><CBB3>춨
|
|||
|
#define BLE_EXIT_TEST_DI0 0x1E
|
|||
|
#define BLE_EXIT_TEST_DI1 0x50
|
|||
|
//<2F><>ij<EFBFBD><C4B3><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
|||
|
#define BLE_READ_HIS_DI0 0x1F
|
|||
|
#define BLE_READ_HIS_DI1 0x50
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>OTA<54><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
|||
|
#define BLE_OTA_NOTIC_DI0 0x80
|
|||
|
#define BLE_OTA_NOTIC_DI1 0x50
|
|||
|
|
|||
|
typedef enum{
|
|||
|
BLE_STATE_S0 = 0,
|
|||
|
BLE_STATE_S1,
|
|||
|
BLE_STATE_S2,
|
|||
|
BLE_STATE_S3,
|
|||
|
BLE_STATE_S4
|
|||
|
}TYP_STATE_BLE;
|
|||
|
|
|||
|
#define PACK_NUM_GPRS 155
|
|||
|
//<2F><>ȡ״̬<D7B4><CCAC>
|
|||
|
UNION_4U8TOU32 getBleWetState(void);
|
|||
|
//<2F><>Լ<EFBFBD><D4BC><EFBFBD>ݴ洢<DDB4><E6B4A2><EFBFBD>ֳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
void DataStoreInit(void);
|
|||
|
//<2F><>Լ<EFBFBD><D4BC><EFBFBD>ݴ洢״̬<D7B4><CCAC>
|
|||
|
void DataStoreMachine(void);
|
|||
|
//<2F><>Լ<EFBFBD><D4BC><EFBFBD>ݴ洢<DDB4><E6B4A2><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
u8 DataStoreIfIdle(void);
|
|||
|
|
|||
|
u8 crack_frame_BLE(u16 frame_lenth,u8 *frame_buffer);
|
|||
|
//<2F><>ˮ<EFBFBD><CBAE>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>
|
|||
|
u8 up_deal_code_ble(void);
|
|||
|
void Frame_ResetDealState_BLE(void);
|
|||
|
//Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡
|
|||
|
void Frame_ack_BLE(u8* p_send_buf, u16* p_send_len);
|
|||
|
|
|||
|
u32 sys_get_net_state(void);
|
|||
|
void setBleReadAccessFlag(u8 data);
|
|||
|
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
|
|||
|
|