本文主要是介绍25. 蓝牙 - BLE相关2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. 概述
如何自己起一个BLE蓝牙服务,主要满足2点,write/read 和 notice
没有找到恒玄好一点的文章,通过自己对源码的阅读和分析,写了一个demo,供大家参考。
2. 测试demo
2.1 源文件
#include "gatt_service.h"
#include "demo_ble_adapter.h"#define TAG "BLE_SERVICE"#define CUSTOMIZE_MAX_LEN (509)/* uuid */
#define demo_service_uuid_128 0x00,0x00,0x82,0x6f,0x63,0x2e,0x74,0x6e,0x69,0x6f,0x70,0x6c,0x65,0x63,0x78,0x66#define demo_service_char_write_uuid_128 0x01,0x00,0x82,0x6f,0x63,0x2e,0x74,0x6e,0x69,0x6f,0x70,0x6c,0x65,0x63,0x78,0x66
#define demo_service_char_read_uuid_128 0x02,0x00,0x82,0x6f,0x63,0x2e,0x74,0x6e,0x69,0x6f,0x70,0x6c,0x65,0x63,0x78,0x66
#define demo_service_char_notice_uuid_128 0x03,0x00,
这篇关于25. 蓝牙 - BLE相关2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!