mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-04 04:48:48 +00:00
feat(core): added Device Information Service
This commit is contained in:
parent
4dbabb52e3
commit
9cb2eb40b7
@ -269,6 +269,7 @@ SOURCE_NRFHAL = [
|
|||||||
'embed/sdk/nrf52/components/ble/peer_manager/security_dispatcher.c',
|
'embed/sdk/nrf52/components/ble/peer_manager/security_dispatcher.c',
|
||||||
'embed/sdk/nrf52/components/libraries/fstorage/nrf_fstorage.c',
|
'embed/sdk/nrf52/components/libraries/fstorage/nrf_fstorage.c',
|
||||||
'embed/sdk/nrf52/components/libraries/fstorage/nrf_fstorage_sd.c',
|
'embed/sdk/nrf52/components/libraries/fstorage/nrf_fstorage_sd.c',
|
||||||
|
'embed/sdk/nrf52/components/ble/ble_services/ble_dis/ble_dis.c',
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -276,6 +277,7 @@ SOURCE_BLE_FIRMWARE = [
|
|||||||
'embed/ble_firmware/main.c',
|
'embed/ble_firmware/main.c',
|
||||||
'embed/ble_firmware/ble_nus.c',
|
'embed/ble_firmware/ble_nus.c',
|
||||||
'embed/ble_firmware/int_comm.c',
|
'embed/ble_firmware/int_comm.c',
|
||||||
|
'embed/ble_firmware/dis.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
if MMD:
|
if MMD:
|
||||||
|
23
core/embed/ble_firmware/dis.c
Normal file
23
core/embed/ble_firmware/dis.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include "dis.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "app_error.h"
|
||||||
|
#include "ble_dis.h"
|
||||||
|
#include "sdk_errors.h"
|
||||||
|
|
||||||
|
#define MANUFACTURER_NAME \
|
||||||
|
"SatoshiLabs" /**< Manufacturer. Will be passed to Device Information \
|
||||||
|
Service. */
|
||||||
|
|
||||||
|
void dis_init(void) {
|
||||||
|
ret_code_t err_code;
|
||||||
|
ble_dis_init_t dis_init_obj;
|
||||||
|
|
||||||
|
memset(&dis_init_obj, 0, sizeof(dis_init_obj));
|
||||||
|
|
||||||
|
ble_srv_ascii_to_utf8(&dis_init_obj.manufact_name_str, MANUFACTURER_NAME);
|
||||||
|
|
||||||
|
dis_init_obj.dis_char_rd_sec = SEC_JUST_WORKS;
|
||||||
|
|
||||||
|
err_code = ble_dis_init(&dis_init_obj);
|
||||||
|
APP_ERROR_CHECK(err_code);
|
||||||
|
}
|
8
core/embed/ble_firmware/dis.h
Normal file
8
core/embed/ble_firmware/dis.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#ifndef __DIS__
|
||||||
|
#define __DIS__
|
||||||
|
|
||||||
|
void dis_init(void);
|
||||||
|
|
||||||
|
#endif
|
@ -84,6 +84,7 @@
|
|||||||
#include "nrf_log_ctrl.h"
|
#include "nrf_log_ctrl.h"
|
||||||
#include "nrf_log_default_backends.h"
|
#include "nrf_log_default_backends.h"
|
||||||
|
|
||||||
|
#include "dis.h"
|
||||||
#include "int_comm.h"
|
#include "int_comm.h"
|
||||||
|
|
||||||
#define APP_BLE_CONN_CFG_TAG \
|
#define APP_BLE_CONN_CFG_TAG \
|
||||||
@ -255,6 +256,7 @@ static void services_init(void) {
|
|||||||
err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
|
err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
|
||||||
APP_ERROR_CHECK(err_code);
|
APP_ERROR_CHECK(err_code);
|
||||||
|
|
||||||
|
dis_init();
|
||||||
nus_init(&m_conn_handle);
|
nus_init(&m_conn_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef BLE_DIS_ENABLED
|
#ifndef BLE_DIS_ENABLED
|
||||||
#define BLE_DIS_ENABLED 0
|
#define BLE_DIS_ENABLED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <q> BLE_GLS_ENABLED - ble_gls - Glucose Service
|
// <q> BLE_GLS_ENABLED - ble_gls - Glucose Service
|
||||||
|
@ -27,6 +27,7 @@ SRC_FILES += \
|
|||||||
$(SDK_ROOT)/components/libraries/crc16/crc16.c \
|
$(SDK_ROOT)/components/libraries/crc16/crc16.c \
|
||||||
$(SDK_ROOT)/components/libraries/timer/drv_rtc.c \
|
$(SDK_ROOT)/components/libraries/timer/drv_rtc.c \
|
||||||
$(SDK_ROOT)/components/libraries/fds/fds.c \
|
$(SDK_ROOT)/components/libraries/fds/fds.c \
|
||||||
|
$(SDK_ROOT)/components/libraries/fds/fds.c \
|
||||||
$(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \
|
$(SDK_ROOT)/components/libraries/hardfault/hardfault_implementation.c \
|
||||||
$(SDK_ROOT)/components/libraries/util/nrf_assert.c \
|
$(SDK_ROOT)/components/libraries/util/nrf_assert.c \
|
||||||
$(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c \
|
$(SDK_ROOT)/components/libraries/atomic_fifo/nrf_atfifo.c \
|
||||||
|
Loading…
Reference in New Issue
Block a user