porkling 1 gadu atpakaļ
vecāks
revīzija
e6db7302ff

+ 1 - 5
owned_server/inc/ble_peripheral.h

@@ -50,14 +50,10 @@ typedef struct
 
 typedef struct
 {
+	uint8_t head;
 	uint8_t product_type;
 	uint8_t dev_version;
 	uint8_t dev_reg_stat;
-#if NRF_BLE_ADVDATA_INCLUDE_BAT	== 1
-	uint8_t	bat_percent;
-#else
-	uint8_t value_null;
-#endif
 	uint8_t m_addr[BLE_GAP_ADDR_LEN];		//设备mac地址
 }ble_adv_manuf_data;
 	

+ 5 - 3
owned_server/src/ble_peripheral.c

@@ -18,6 +18,10 @@ static void ble_dfu_evt_handler(ble_dfu_buttonless_evt_type_t event);
 #include "my_ble_uarts.h"
 #endif
 
+#if WECHAT_SERVER_ENABLED==1
+#include "ble_wechat.h" 																											/**< ******************** WECHAT instance. ********************/
+#endif
+
 BLE_ADVERTISING_DEF(m_advertising);                            											/**< ************** Advertising module instance. **************/
 
 int8_t tx_power_level=NRF_BLE_ADVDATA_NOREG_TX_POWER;																/**< *********************** ble发射功率 **********************/
@@ -362,13 +366,11 @@ uint32_t advertising_init(void)
 	manuf_data.data.size          = sizeof(ble_adv_manuf_data);
 	//指向制造商自定义的数据
 	ble_adv_manuf_data adv_manuf_data={
+		.head = 0xFF,
 		.m_addr={0},
 		.product_type=NRF_DEV_PRODUCT,
 		.dev_version=(NRF_BLE_ADV_DEV_VERSION_MAIN<<4)| NRF_BLE_ADV_DEV_VERSION_SLAVE,
 		.dev_reg_stat=(NRF_DEV_TYPE<<4) | dev_reg_stat,
-#if NRF_BLE_ADVDATA_INCLUDE_BAT	== 1
-		.bat_percent=bat_percent,
-#endif
 	};
 //#ifdef user_config_param
 	memcpy(adv_manuf_data.m_addr,m_addl_adv_manuf_data,BLE_GAP_ADDR_LEN);

+ 1 - 0
owned_server/src/ble_user.c

@@ -22,6 +22,7 @@ BLE_UARTS_DEF(m_uarts);                 //定义名称为m_uarts的串口透传
 NRF_BLE_GATT_DEF(m_gatt);               																						/**< ************* 定义名称为m_gatt的GATT模块实例 *************/
 NRF_BLE_QWR_DEF(m_qwr);                 																						/**< *********** 定义一个名称为m_qwr的排队写入实例 ************/
 #if WECHAT_SERVER_ENABLED==1
+	#include "ble_wechat.h"
 	BLE_WECHAT_DEF(m_wechat);   																											/**< ******************** WECHAT instance. ********************/
 #endif
 static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context);

+ 1 - 1
wechat/src/ble_wechat.c

@@ -21,7 +21,7 @@
 #include "nrf_log.h"
 NRF_LOG_MODULE_REGISTER();
 
-uint8_t m_addl_adv_manuf_data[BLE_GAP_ADDR_LEN]={0};
+extern uint8_t m_addl_adv_manuf_data[BLE_GAP_ADDR_LEN];
 /*****************************************************************************
 * data handle
 *****************************************************************************/