改了下特征长度30,手机App测试可以write不同长度,可以收到noti
This commit is contained in:
parent
04781fdf20
commit
7191a03727
|
@ -635,7 +635,8 @@ static void peripheralParamUpdateCB(uint16_t connHandle, uint16_t connInterval,
|
|||
peripheralConnList.connSlaveLatency = connSlaveLatency;
|
||||
peripheralConnList.connTimeout = connTimeout;
|
||||
|
||||
PRINT("Update %x - Int %x \n", connHandle, connInterval);
|
||||
PRINT("peripheralParamUpdateCB (connHandle)%x - (connInterval) %x- (connSlaveLatency) %x - (connTimeout) %x\n"
|
||||
, connHandle, connInterval, connSlaveLatency, connTimeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -740,8 +741,9 @@ static void peripheralStateNotificationCB(gapRole_States_t newState, gapRoleEven
|
|||
*/
|
||||
static void performPeriodicTask(void)
|
||||
{
|
||||
uint8_t notiData[SIMPLEPROFILE_CHAR4_LEN] = {0x88};
|
||||
peripheralChar4Notify(notiData, SIMPLEPROFILE_CHAR4_LEN);
|
||||
uint8_t notiData[SIMPLEPROFILE_CHAR4_LEN] = {0x11, 0x22, 0x33, 0x44};
|
||||
// peripheralChar4Notify(notiData, SIMPLEPROFILE_CHAR4_LEN);
|
||||
peripheralChar4Notify(notiData, 4);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -793,7 +795,12 @@ static void simpleProfileChangeCB(uint8_t paramID, uint8_t *pValue, uint16_t len
|
|||
{
|
||||
uint8_t newValue[SIMPLEPROFILE_CHAR1_LEN];
|
||||
tmos_memcpy(newValue, pValue, len);
|
||||
PRINT("profile ChangeCB CHAR1.. \n");
|
||||
PRINT("profile ChangeCB CHAR1.. Start\n");
|
||||
for (uint8_t i = 0; i < len; i++)
|
||||
{
|
||||
PRINT("%02x ", newValue[i]);
|
||||
}
|
||||
PRINT("\n profile ChangeCB CHAR1.. End\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -801,7 +808,12 @@ static void simpleProfileChangeCB(uint8_t paramID, uint8_t *pValue, uint16_t len
|
|||
{
|
||||
uint8_t newValue[SIMPLEPROFILE_CHAR3_LEN];
|
||||
tmos_memcpy(newValue, pValue, len);
|
||||
PRINT("profile ChangeCB CHAR3..\n");
|
||||
PRINT("profile ChangeCB CHAR3.. Start\n");
|
||||
for (uint8_t i = 0; i < len; i++)
|
||||
{
|
||||
PRINT("%02x ", newValue[i]);
|
||||
}
|
||||
PRINT("\n profile ChangeCB CHAR3.. End\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
|
||||
struct __attribute__((packed)) valve_data
|
||||
{
|
||||
// uint8_t valve_id;
|
||||
// uint8_t valve_mac[6];
|
||||
uint8_t header;
|
||||
uint8_t cmd;
|
||||
uint8_t data_len;
|
||||
uint8_t valve_type; // 阀门类型
|
||||
uint8_t valve_bat; // 1B 电池电压 30=3V,18=1.8V
|
||||
uint8_t valve_status; // 1B 阀门工作状态 超欠压、过流
|
||||
uint8_t valve_connct_status; // 1B 阀门连接状态 (电磁阀BLE控制盒) 0=未连接 1=已连接
|
||||
uint8_t valve_switch_status; // 1B 阀门开关状态 0=未知 1=关闭 2=关闭过,未按按键恢复 3=关闭过,按下了恢复键 4=打开
|
||||
int8_t valve_temp; // 1B 阀门温度 有符号整数 25 ℃
|
||||
uint8_t valve_humidity; // 1B 阀门湿度 0~100%;
|
||||
uint32_t valve_in_pressure; // 4B 阀门入口压力 Pa
|
||||
uint32_t valve_out_pressure; // 4B 阀门出口压力 Pa
|
||||
uint32_t valve_atm_pressure; // 4B 阀门大气压力 Pa
|
||||
uint8_t tail;
|
||||
};
|
|
@ -77,7 +77,8 @@ void BSP_ADC_Init(void)
|
|||
RoughCalib_Value = ADC_DataCalib_Rough(); // 用于计算ADC内部偏差,记录到全局变量 RoughCalib_Value中
|
||||
PRINT("RoughCalib_Value =%d \n", RoughCalib_Value);
|
||||
|
||||
// DelayMs(300);
|
||||
// 刚上电,要给电容充电
|
||||
DelayMs(300);
|
||||
|
||||
printf("PA13:::::\n");
|
||||
ADC_ChannelCfg(3);
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
#define BLE_MEMHEAP_SIZE (1024*6)
|
||||
#endif
|
||||
#ifndef BLE_BUFF_MAX_LEN
|
||||
#define BLE_BUFF_MAX_LEN 27
|
||||
#define BLE_BUFF_MAX_LEN 251
|
||||
#endif
|
||||
#ifndef BLE_BUFF_NUM
|
||||
#define BLE_BUFF_NUM 5
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Description : 设备信息服务
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Description :
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
|
@ -46,11 +46,11 @@ extern "C" {
|
|||
#define SIMPLEPROFILE_SERVICE 0x00000001
|
||||
|
||||
// Length of characteristic in bytes ( Default MTU is 23 )
|
||||
#define SIMPLEPROFILE_CHAR1_LEN 1
|
||||
#define SIMPLEPROFILE_CHAR2_LEN 1
|
||||
#define SIMPLEPROFILE_CHAR3_LEN 1
|
||||
#define SIMPLEPROFILE_CHAR4_LEN 1
|
||||
#define SIMPLEPROFILE_CHAR5_LEN 5
|
||||
#define SIMPLEPROFILE_CHAR1_LEN 30
|
||||
#define SIMPLEPROFILE_CHAR2_LEN 30
|
||||
#define SIMPLEPROFILE_CHAR3_LEN 30
|
||||
#define SIMPLEPROFILE_CHAR4_LEN 30
|
||||
#define SIMPLEPROFILE_CHAR5_LEN 30
|
||||
|
||||
/*********************************************************************
|
||||
* TYPEDEFS
|
||||
|
|
Loading…
Reference in New Issue