Generate a custom Profile in Bluetooth Developer Studio
- Create a custom profile:
- File->New;
- Rename 'New Profile' to, for example 'Test Profile'
- Create a custom service:
- CUSTOM SERVICE;
- Rename 'TEST PROFILE NEW SERVICE' to , for example 'Test Profile Test service'
- Add a new characteristic:
- Click on '+'
- Rename the characteristic to, for example 'RX'
- Set Read/Write/Notify/Indicate properties, for example, 'Write Without Response' to 'Mandatory'
- Add Fields to the characteristic
- Add one 'value' field with format '_VARIABLE'
- Add as many characteristics as needed (for example add one more 'TX' variable with with Notify property to 'Mandatory' and a '_VARIABLE' field named 'value')
- Generate code
- Tools->Generate Code
- Choose 'Server' and 'NORDIC SEMICONDUCTOR NRF51 PLUGIN'
Using a custom Profile in 'my_project'
- Include the generated h file:
#include "ble_test_profile_test_service.h"
- If you want to use logging, define APP_LOG macro
#define APPL_LOG NRF_LOG_INFO
- Declare a service structure variable:
static ble_test_profile_test_service_t m_tests;
- Create a service event handler function:
static void on_test_evt(ble_test_profile_test_service_t * p_test_profile_test_service,
ble_test_profile_test_service_evt_t * p_evt)
{
switch (p_evt->evt_type)
{
case BLE_TEST_PROFILE_TEST_SERVICE_RX_EVT_WRITE:
APPL_LOG("Charact written with value %s. ", p_evt->params.rx.value.p_data);
break;
default:
// No implementation needed.
break;
}
}
- add the service initialization in services_init(void)
uint32_t err_code;
ble_test_profile_test_service_init_t tests_init;
// Initialize XXX Service.
memset(&tests_init, 0, sizeof(tests_init));
tests_init.evt_handler = on_test_evt;
//tests_init.is_xxx_notify_supported = true;
tests_init.ble_test_profile_test_service_rx_initial_value.value.size = 20;
tests_init.ble_test_profile_test_service_rx_initial_value.value.p_data = rx_value;
tests_init.ble_test_profile_test_service_tx_initial_value.value.size = 20;
tests_init.ble_test_profile_test_service_tx_initial_value.value.p_data = tx_value;
err_code = ble_test_profile_test_service_init(&m_tests, &tests_init);
APP_ERROR_CHECK(err_code);
- add the call to the service's on_ble_event API in ble_evt_dispatch function
ble_test_profile_test_service_on_ble_evt(&m_tests, p_ble_evt);
- in the keil project, add the service source file (add existing file to group nRF_BLE, choose 'ble_test_profile_test_service.c')
没有合适的资源?快使用搜索试试~ 我知道了~
experimental_bluetooth_zip_源码
共435个文件
h:38个
emsession:33个
emproject:33个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 107 浏览量
2021-10-02
14:25:43
上传
评论
收藏 8MB ZIP 举报
温馨提示
experimental experimental bluetooth
资源推荐
资源详情
资源评论
收起资源包目录
experimental_bluetooth_zip_源码 (435个子文件)
main.c 61KB
main.c 46KB
main.c 41KB
main.c 33KB
main.c 27KB
main.c 24KB
main.c 24KB
main.c 23KB
main.c 23KB
main.c 22KB
ble_m.c 15KB
nrf_ble_qwrs.c 6KB
main.c 5KB
buttons_m.c 4KB
pm_m.c 3KB
service_if.c 3KB
ble_app_hids_keyboard_nfc_pairing_pca10056_s140.emProject 25KB
ble_nfc_pairing_reference_pca10056_s140.emProject 24KB
ble_app_hrs_nfc_pairing_pca10056_s113.emProject 24KB
ble_app_hrs_nfc_pairing_pca10056_s140.emProject 24KB
ble_app_hids_keyboard_nfc_pairing_pca10040_s132.emProject 23KB
ble_nfc_pairing_reference_pca10040_s132.emProject 23KB
ble_app_hrs_nfc_pairing_pca10040_s112.emProject 23KB
ble_app_hrs_nfc_pairing_pca10040_s132.emProject 23KB
ble_app_hrs_nfc_pairing_pca10100_s113.emProject 23KB
ble_app_hrs_nfc_pairing_pca10100_s140.emProject 23KB
ble_app_cli_pca10040_s132.emProject 19KB
ble_app_cli_pca10056_s140.emProject 19KB
ble_app_cgms_pca10040_s132.emProject 18KB
ble_app_cgms_pca10056_s140.emProject 18KB
experimental_ble_app_lns_pca10040_s132.emProject 17KB
experimental_ble_app_lns_pca10056_s140.emProject 17KB
ble_app_queued_writes_pca10040_s132.emProject 16KB
ble_app_queued_writes_pca10056_s140.emProject 16KB
ble_app_lls_pca10040_s132.emProject 16KB
ble_app_lls_pca10056_s140.emProject 16KB
bluetoothds_template_pca10040_s132.emProject 16KB
bluetoothds_template_pca10056_s140.emProject 16KB
ble_app_ots_pca10040_s132.emProject 16KB
ble_app_ots_pca10056_s140.emProject 16KB
experimental_ble_app_lns_pca10040e_s112.emProject 16KB
experimental_ble_app_lns_pca10056e_s112.emProject 16KB
ble_app_lls_pca10040e_s112.emProject 15KB
ble_app_lls_pca10056e_s112.emProject 15KB
ble_app_multiperipheral_pca10040_s112.emProject 15KB
ble_app_multiperipheral_pca10040_s132.emProject 15KB
ble_app_multiperipheral_pca10056_s140.emProject 15KB
ble_app_multiperipheral_pca10040e_s112.emProject 13KB
ble_app_multiperipheral_pca10056e_s112.emProject 13KB
ble_app_hids_keyboard_nfc_pairing_pca10056_s140.emSession 387B
ble_app_hids_keyboard_nfc_pairing_pca10040_s132.emSession 387B
experimental_ble_app_lns_pca10056e_s112.emSession 379B
experimental_ble_app_lns_pca10040e_s112.emSession 379B
ble_nfc_pairing_reference_pca10056_s140.emSession 379B
ble_nfc_pairing_reference_pca10040_s132.emSession 379B
ble_app_multiperipheral_pca10040e_s112.emSession 378B
ble_app_multiperipheral_pca10056e_s112.emSession 378B
experimental_ble_app_lns_pca10056_s140.emSession 378B
experimental_ble_app_lns_pca10040_s132.emSession 378B
ble_app_multiperipheral_pca10056_s140.emSession 377B
ble_app_multiperipheral_pca10040_s132.emSession 377B
ble_app_multiperipheral_pca10040_s112.emSession 377B
ble_app_hrs_nfc_pairing_pca10056_s140.emSession 377B
ble_app_hrs_nfc_pairing_pca10040_s132.emSession 377B
ble_app_hrs_nfc_pairing_pca10056_s113.emSession 377B
ble_app_hrs_nfc_pairing_pca10100_s140.emSession 377B
ble_app_hrs_nfc_pairing_pca10100_s113.emSession 377B
ble_app_hrs_nfc_pairing_pca10040_s112.emSession 377B
ble_app_queued_writes_pca10056_s140.emSession 375B
ble_app_queued_writes_pca10040_s132.emSession 375B
bluetoothds_template_pca10040_s132.emSession 374B
bluetoothds_template_pca10056_s140.emSession 374B
ble_app_cgms_pca10040_s132.emSession 366B
ble_app_cgms_pca10056_s140.emSession 366B
ble_app_lls_pca10040e_s112.emSession 366B
ble_app_lls_pca10056e_s112.emSession 366B
ble_app_lls_pca10040_s132.emSession 365B
ble_app_lls_pca10056_s140.emSession 365B
ble_app_cli_pca10056_s140.emSession 365B
ble_app_cli_pca10040_s132.emSession 365B
ble_app_ots_pca10056_s140.emSession 365B
ble_app_ots_pca10040_s132.emSession 365B
ble_app_cgms_pca10056_s140.ewd 36KB
ble_app_cgms_pca10040_s132.ewd 36KB
ble_app_multiperipheral_pca10056e_s112.ewd 36KB
ble_app_multiperipheral_pca10040e_s112.ewd 36KB
ble_app_multiperipheral_pca10056_s140.ewd 36KB
ble_app_multiperipheral_pca10040_s112.ewd 36KB
ble_app_queued_writes_pca10056_s140.ewd 36KB
ble_app_multiperipheral_pca10040_s132.ewd 36KB
bluetoothds_template_pca10056_s140.ewd 36KB
bluetoothds_template_pca10040_s132.ewd 36KB
ble_app_queued_writes_pca10040_s132.ewd 36KB
ble_app_hrs_nfc_pairing_pca10100_s140.ewd 36KB
ble_app_lls_pca10056e_s112.ewd 36KB
ble_app_hrs_nfc_pairing_pca10056_s140.ewd 36KB
ble_app_hrs_nfc_pairing_pca10056_s113.ewd 36KB
ble_app_hrs_nfc_pairing_pca10040_s132.ewd 36KB
ble_app_hrs_nfc_pairing_pca10100_s113.ewd 36KB
ble_app_hrs_nfc_pairing_pca10040_s112.ewd 36KB
共 435 条
- 1
- 2
- 3
- 4
- 5
资源评论
爱牛仕
- 粉丝: 96
- 资源: 4716
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功