| 数据搜索系统,热门电子元器件搜索 |
|
UM2071 数据表(PDF) 31 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
UM2071 数据表(HTML) 31 Page - STMicroelectronics |
|
31 / 56 page ![]() UM2071 BlueNRG-1 chat master and slave demo application DocID029370 Rev 3 31/56 The BLE peripheral and central roles are specified in the aci_gap_init() command. See the BlueNRG-1 BLE API documentation for more information on these and following commands. 8.1.2 Add service and characteristics Refer to Section 7.1.2: " Add service and characteristics ". 8.1.3 Start discovery procedure To find another BlueNRG-1 BLE chat master and slave device in discovery mode, a discovery procedure must be started via: aci_gap_start_general_discovery_proc(0x4000, 0x4000, 0x00, 0x00); 8.1.4 Enter connectable mode The following GAP API command is used for entering general discoverable mode: aci_gap_set_discoverable(ADV_IND, 0x90, 0x90, PUBLIC_ADDR, NO_WHITE_LIST_USE, sizeof(local_name), local_name, 0, NULL, 0x6, 0x8); 8.1.5 Connection with chat master and slave client device In the above mentioned discovery and mode assignment procedures, the two chat master and slave applications assume respective client and server roles at runtime. During this initial configuration phase, when a chat master and slave device is placed in discoverable mode and it is found by the other chat master and slave device performing a discovery procedure, a Bluetooth low energy connection is created and the device roles are defined. The following GAP API command is used for connecting to the discovered device: aci_gap_create_connection(0x4000, 0x4000,device_found_address_type, device_found_address, PUBLIC_ADDR, 40, 40, 0, 60, 2000 , 2000); Where device_found_address_type is the address type of the discovered chat master and slave and device_found_address is the peer address of the discovered chat master and slave device. Once the two devices are connected, you can set up corresponding serial terminals and type messages in either of them. The typed characters are stored in two respective buffers and when the return key is pressed: On the BLE chat master-and-slave server device, the typed characters are sent to the master-and-slave client device by notifying the previously added TX characteristic (after notifications have been enabled). This is done via: aci_gatt_update_char_value(chatServHandle, TXCharHandle, 0, len, (uint8_t *)cmd+j); On the master-and-slave client device, the typed characters are sent to the master-and- slave server device, by writing the previously added RX characteristic. This is done via: aci_gatt_write_without_resp (connection_handle, rx_handle +1, len, (uint8_t *)cmd+j); Where connection_handle is the handle returned upon connection as a parameter of the connection complete event, rx_handle is the RX characteristic handle discovered by the client device. Once these API commands have been sent, the values of the TX and RX characteristics are displayed on the serial terminals. |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |