add device info service
This commit is contained in:
+4
-1
@@ -89,7 +89,7 @@ extern "C"
|
||||
// BLE Observers - Observers and priority levels
|
||||
#define NRF_SDH_BLE_OBSERVER_PRIO_LEVELS 4
|
||||
// Include the Service Changed characteristic in the Attribute Table.
|
||||
#define NRF_SDH_BLE_SERVICE_CHANGED 0
|
||||
#define NRF_SDH_BLE_SERVICE_CHANGED 1
|
||||
|
||||
// This setting configures how Stack events are dispatched to the application.
|
||||
#define NRF_SDH_DISPATCH_MODEL 2 /* SoftDevice events are to be fetched manually. */
|
||||
@@ -166,6 +166,9 @@ extern "C"
|
||||
// Static maximum MTU size.
|
||||
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23
|
||||
|
||||
// Enable ble device info module
|
||||
#define BLE_DIS_ENABLED 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic.c" />
|
||||
<ClCompile Include="..\bmd380_sdk\components\libraries\atomic_flags\nrf_atflags.c" />
|
||||
@@ -164,6 +165,7 @@
|
||||
<ClCompile Include="le_bas.c" />
|
||||
<ClCompile Include="le_gap.c" />
|
||||
<ClCompile Include="le_gatt.c" />
|
||||
<ClCompile Include="le_srv.c" />
|
||||
<ClCompile Include="main.c" />
|
||||
<None Include="nRF52811_XXAA_s140.lds" />
|
||||
<None Include="nRF52840_XXAA_S140_reserve.lds" />
|
||||
@@ -224,6 +226,7 @@
|
||||
<ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\hal\nrf_ecb.c" />
|
||||
<ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\hal\nrf_nvmc.c" />
|
||||
<ClCompile Include="$(BSP_ROOT)\nRF5x\modules\nrfx\soc\nrfx_atomic.c" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic.h" />
|
||||
<ClInclude Include="..\bmd380_sdk\components\libraries\atomic\nrf_atomic_internal.h" />
|
||||
|
||||
@@ -238,6 +238,18 @@
|
||||
<Filter Include="Header files\ble\nrf_ble_gatt">
|
||||
<UniqueIdentifier>{b6e27cec-5179-4ec4-8f4d-e7e9fbaabae8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble\ble_services">
|
||||
<UniqueIdentifier>{4153528a-d996-4c55-be9f-917ce26d6277}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble\ble_services">
|
||||
<UniqueIdentifier>{7abc8adc-4234-4ec2-a927-53d29690cfc0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source files\ble\ble_services\ble_dis">
|
||||
<UniqueIdentifier>{2cf242dc-b5b5-4aa3-b56f-92c1afd295a1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header files\ble\ble_services\ble_dis">
|
||||
<UniqueIdentifier>{e8688895-c809-46b5-a2ab-2bd49da33d45}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
@@ -1338,6 +1350,12 @@
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.c">
|
||||
<Filter>Source files\ble\nrf_ble_gatt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.c">
|
||||
<Filter>Source files\ble\ble_services\ble_dis</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="le_srv.c">
|
||||
<Filter>Source files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="nRF52840_XXAA_S140_reserve.lds">
|
||||
@@ -1594,6 +1612,9 @@
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\nrf_ble_gatt\nrf_ble_gatt.h">
|
||||
<Filter>Header files\ble\nrf_ble_gatt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\bmd380_sdk\components\ble\ble_services\ble_dis\ble_dis.h">
|
||||
<Filter>Header files\ble\ble_services\ble_dis</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\bmd380_sdk\external\segger_rtt\license\license.txt">
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "app_config.h"
|
||||
#include "apply_old_config.h"
|
||||
#include "sdk_config.h"
|
||||
|
||||
#include "nrf_log.h"
|
||||
#include "nrf_log_ctrl.h"
|
||||
#include "nrf_log_default_backends.h"
|
||||
|
||||
#include "nrf_delay.h"
|
||||
#include "nrf_gpio.h"
|
||||
|
||||
#include "nrf_sdh.h"
|
||||
#include "nrf_sdh_ble.h"
|
||||
#include "nrf_sdh_freertos.h"
|
||||
|
||||
#include "ble_dis.h"
|
||||
#include "nrf_ble_gatt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MANUFACTURER_NAME "MEMCHIP" /**< Manufacturer. Will be passed to Device Information Service. */
|
||||
#define HW_REV STRINGIFY(MAJOR_PRODUCT_NUMBER) "." STRINGIFY(MINOR_PRODUCT_NUMBER) "." STRINGIFY(MAJOR_VERSION_NUMBER) "." STRINGIFY(MINOR_VERSION_NUMBER)
|
||||
#define FW_REV "0.1.0"
|
||||
#define SER_NUM "0000-00-00-00001"
|
||||
#define MODULE_NAME ELITE_DEVICE_NAME
|
||||
|
||||
static void le_dis_init(void)
|
||||
{
|
||||
ble_dis_init_t dis_init;
|
||||
memset(&dis_init, 0, sizeof(dis_init));
|
||||
|
||||
ble_srv_ascii_to_utf8(&dis_init.manufact_name_str, MANUFACTURER_NAME);
|
||||
ble_srv_ascii_to_utf8(&dis_init.fw_rev_str, FW_REV);
|
||||
ble_srv_ascii_to_utf8(&dis_init.hw_rev_str, HW_REV);
|
||||
ble_srv_ascii_to_utf8(&dis_init.model_num_str, MODULE_NAME);
|
||||
ble_srv_ascii_to_utf8(&dis_init.serial_num_str, SER_NUM);
|
||||
dis_init.dis_char_rd_sec = SEC_OPEN;
|
||||
|
||||
ret_code_t err_code = ble_dis_init(&dis_init);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
|
||||
void le_srv_init(void)
|
||||
{
|
||||
le_dis_init();
|
||||
}
|
||||
Reference in New Issue
Block a user