【读懂tomcat源码】【城际巴士系统源码】【实时报价源码】Tp dapp源码

2024-11-28 11:32:03 来源:Kong网关源码调试 分类:休闲

1.如何使用 CC2540 制作一个 iBeacon

Tp dapp源码

如何使用 CC2540 制作一个 iBeacon

       å‡†å¤‡å·¥ä½œ

       ä¸€å° PC

       IAR Embedded Workbench 集成开发环境,可以用天试用版本。

       æ”¯æŒ 蓝牙 4.0 的智能手机一部,并安装下列应用之一

       Android Google Play Store.

       iPhone App Store.

       CC 开发板

       CCDebugger 下载器

       åˆ›å»º iBeacon 工程文档

       å®‰è£… TI 官方的 CCx 开发环境

       å¤åˆ¶ C:\Texas Instruments\BLE-CCx-1.3.2\Projects\ble\SimpleBLEBroadcaster 文件夹

       ç²˜è´´åˆ°ï¼šC:\Texas Instruments\BLE-CCx-1.3.2\Projects\ble\iBeacon

       è¿è¡Œ IAR Embedded Workbench,点击 File > Open > Workspace

       ä¿®æ”¹æºä»£ç 

       simpleBLEBroadcaster.c

       // GAP - Advertisement data (max size = bytes,源码读懂tomcat源码 though this is

       // best kept short to conserve power while advertisting)

       static uint8 advertData[] =

       {

        // Flags; this sets the device to use limited discoverable

        // mode (advertises for seconds at a time) instead of general

        // discoverable mode (advertises indefinitely)

        0x, // length of this data

        GAP_ADTYPE_FLAGS,

        GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,

        // three-byte broadcast of the data "1 2 3"

        0x, // length of this data including the data type byte

        GAP_ADTYPE_MANUFACTURER_SPECIFIC, // manufacturer specific advertisement data type

        1,

        2,

        3

       };

       ä¿®æ”¹ä¸‹é¢å…³é”®å­—

       UID: E2CDB5-DFFB-D2-B-D0F5AE0

       Major: 1 (0x)

       Minor: 1 (0x)

       Measured Power: - (0xc5)

       // GAP - Advertisement data (max size = bytes, though this is

       // best kept short to conserve power while advertisting)

       static uint8 advertData[] =

       {

        // byte ibeacon advertising data

        // Preamble: 0x4c

        // UUID: E2CDB5-DFFB-D2-B-D0F5AE0

        // Major: 1 (0x)

        // Minor: 1 (0x)

        // Measured Power: - (0xc5)

        0x1A, // length of this data including the data type byte

        GAP_ADTYPE_MANUFACTURER_SPECIFIC, // manufacturer specific advertisement data type

        0x4c,

        0x,

        0x,

        0x,

        0xe2,

        0xc5,

        0x6d,

        0xb5,

        0xdf,

        0xfb,

        0x,

        0xd2,

        0xb0,

        0x,

        0xd0,

        0xf5,

        0xa7,

        0x,

        0x,

        0xe0,

        0x,

        0x,

        0x,

        0x,

        0xc5

       };

       æŽ¥ä¸‹æ¥ä¿®æ”¹å¹¿æ’­ç±»åž‹ï¼Œå°†ä¸‹é¢ä»£ç 

       //uint8 advType = GAP_ADTYPE_ADV_NONCONN_IND;// use non-connectable advertisements

       uint8 advType = GAP_ADTYPE_ADV_DISCOVER_IND; // use scannable unidirected advertisements

       ä¿®æ”¹ä¸º

       uint8 advType = GAP_ADTYPE_ADV_NONCONN_IND; // use non-connectable advertisements

       //uint8 advType = GAP_ADTYPE_ADV_DISCOVER_IND; // use scannable unidirected advertisements

       æŽ¥ä¸‹æ¥ä¿®æ”¹ GAP

       // Set the GAP Role Parameters

       GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );

       GAPRole_SetParameter( GAPROLE_ADVERT_OFF_TIME, sizeof( uint ), &gapRole_AdvertOffTime );

       GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( scanRspData ), scanRspData );

       GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof( advertData ), advertData );

       GAPRole_SetParameter( GAPROLE_ADV_EVENT_TYPE, sizeof( uint8 ), &advType );

       å› ä¸º iBeacon 必须不间断广播,并且不响应任何数据请求,所以我们要修改 GAPROLE_ADVERT_OFF_TIME 和 GAPROLE_SCAN_RSP_DATA。

       // Set the GAP Role Parameters

       GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );

       //GAPRole_SetParameter( GAPROLE_ADVERT_OFF_TIME, sizeof( uint ), &gapRole_AdvertOffTime );

       //GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( scanRspData ), scanRspData );

       GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof( advertData ), advertData );

       GAPRole_SetParameter( GAPROLE_ADV_EVENT_TYPE, sizeof( uint8 ), &advType );

       ä¿å­˜å·¥ç¨‹åŽï¼Œè¿›è¡Œç¼–译,并通过 CCDebugger 下载程序到开发板中。

       Select Project > Clean to clean the project.

       Select Project > Make to make the project.

       Select Project > Download and Debug to send the code to the CC Key Fob

       Select Debug > Go to Run the code on the CC Key Fob.

       BLE iBeacon

       TI Displayport ESD Protection – TPD8S

       Arduino SPI 精华课程

       TAGS

       Arduino Arduino Due Arduino Esplora Atmegau4 Atmel BacklightBMP Bootloader CC3x DatasheetDisplayport EasyDriver EDID eDPEsplora HDMI HMCL I2CJoystick LCD LED Luban LVDS MIPIMPU MySQL Nginx PCB PHP pinModePWM PX4 Raspberry Pi RGB Sensor SPIStepper Motor Ubuntu Wifi 摇杆 树莓派步进电机 电源 背光 蓝牙

       CATEGORIES

       3D Printer

       Android

       Application Notes

       Arduino

       AVR

       Backlight Driver

       C

       CC3x

       Datasheet

       Development Environment

       HDMI

       Imaging & Graphics

       iOS

       Javascript

       LCD/LCM

       Material

       Others

       PCB Design

       Power Management

       Prototyping

       Raspberry Pi

       Rostock

       Sensor

       Server

       Software

       STM

       Super Manual

       Tutorials

       Work

更多资讯请点击:休闲

热门资讯

easyshopping 源码

2024-11-28 10:511170人浏览

fsu 源码

2024-11-28 10:132162人浏览

Scrcpy源码

2024-11-28 09:06420人浏览

lv源码

2024-11-28 08:542129人浏览

推荐资讯

yun源码安装

1.yum和apt-get的区别详解2.如何安装python3.电脑系统品牌哪个号电脑系统哪个品牌的比较好4.cygwin下载及安装详细教程,windows使用linux的shell命

esword源码

1.Elasticsearch7.8.0集成IK分词器改源码实现MySql5.7.2实现动态词库实时更新Elasticsearch7.8.0集成IK分词器改源码实现MySql5.7.2实现动态词库实时