71 lines
1.5 KiB
C
71 lines
1.5 KiB
C
#ifndef _APP_TEMPERATURE_H_
|
|
#define _APP_TEMPERATURE_H_
|
|
|
|
#include <rtthread.h>
|
|
#include <finsh.h>
|
|
#include "common.h"
|
|
#include "param_config.h"
|
|
#include "ble_pub.h"
|
|
#include "drv_oled.h"
|
|
|
|
#include "belon_ble.h"
|
|
|
|
#if (CFG_BLE_VERSION == BLE_VERSION_5_2)
|
|
#include "app_ble.h"
|
|
#include "app_sdp.h"
|
|
#include "app_ble_init.h"
|
|
#endif
|
|
#if (BLE_APP_SEC)
|
|
#include "app_sec.h"
|
|
#endif
|
|
#include "kernel_mem.h"
|
|
|
|
#define BLE_TEMPERATURE_DEVICE_IT12 "iT12"
|
|
#define BLE_TEMPERATURE_DEVICE_IT19 "iT19"
|
|
|
|
#define BLE_TEMPERATURE_DETECT_INTERVAL 2000
|
|
|
|
#define BLE_TEMPERATURE_LIMIT_MIN 3200
|
|
#define BLE_TEMPERATURE_LIMIT_MAX 4200
|
|
|
|
#define BLE_TEMPERATURE_HALL_DETECT_PIN 38
|
|
#define BLE_TEMPERATURE_BOX_POWER_CTR 39
|
|
|
|
#define BLE_TEMPERATURE_POWEROFF_TIMEOUT 5000 //ms
|
|
#define BLE_TEMPERATURE_BIND_MODE_TIMEOUT 8000 //ms
|
|
/**
|
|
* 超时10s 都没有收到温度广播数据 回到等待测温页面
|
|
*/
|
|
#define BLE_TEMPERATURE_IDLE_MODE_TIMEOUT 10000 //ms
|
|
|
|
|
|
#define BLE_TEMPERATURE_FLASH_CONFIG_KEY "dev_cfg"
|
|
|
|
|
|
typedef enum
|
|
{
|
|
APP_MODE_NORMAL,
|
|
APP_MODE_BIND,
|
|
} app_temperature_mode_t;
|
|
|
|
typedef struct
|
|
{
|
|
uint16_t temperature_body;
|
|
uint16_t temperature_obj;
|
|
uint16_t temperature_env;
|
|
uint16_t batt_val;
|
|
}app_temperature_info_t;
|
|
|
|
typedef struct
|
|
{
|
|
uint8_t bind_mac[6];
|
|
uint16_t detect_interval;
|
|
}app_dev_info_t;
|
|
|
|
void temperature_init(void);
|
|
void temperature_adv_callback(recv_adv_t *r_ind);
|
|
|
|
void app_enter_bind_mode(bool enter);
|
|
|
|
#endif //_APP_TEMPERATURE_H_
|