Hello Dialog,
我们综合了IMU与DA14585奥维传感器r I2C it was successful. After that, we have created new characteristics for the IMU sensor (ACC, GYRO, Temp) and able to read all the sensor characteristics values on nRF connect app by sending trigger using control point characteristic(0x01). For developing this application we have used the ble_peripherial example.
Now we want to read the same data using BLE central device, this we want to do without the sending any trigger. Like, when the BLE central connected to the BLE server it should send sensor data automatically without any external trigger. Is this possible with the available stack if so tell us what modification we should perform in the ble_peripherial example?
Thank you
D.Vishnu
Keywords:
Device:
Hi vishnuatdialog,
So you would like to create a central application based on the 585 device and as soon as the device is connected to a central it should start reading data from the peripheral or the peripheral notifying the central device with the updated values ? If that is the case then the project that you request is quite more than a simple mod for the ble_app_peripheral. In order to implement that you will have to take a empty project configure the stack as a central, issue a scanning command and upon receiving the proper advertising string you can issue a connection requet. After the connection is estblished you will have to discover all the characteristics available on the peripheral side. That means that you will have to create a central profile that will perform a discovery procedure that will support the custom profile on the peripheral side and as soon as the discovery procedure is completed (and the central is aware of all the characteristics supported on that specific peripheral) start issuing reading commands (in case you would like the central to read data from the peripheral) or you should write to the CCC descriptors of the peripheral (in case the characteristics are notifyable) so that the peripheral would start sending data to the central. For implementing a custom central profile there is no document or tutorial or a simple example, but you can take the DSPS demo as a reference (the host side) in order to implement something quite similar, a device that will perform a discovery and start communicating with a central.
Thanks MT_dialog
Hello Dialog,
whichever you have explained above is in the case of both (client and server ) is based on DA14585.
But, In my case
BLE Server(peripheral) is (DA14585 + IMU sensor)
BLE Client(Central) is (CC2650 ) not DA14585 based.
As of above case, I don't want to implement a triggering in BLE client. Whenever the BLE client is connected to the BLE server without triggering I want to read the data. For this, I want to make changes in the BLE_peripheral code automated, not in the BLE client code.
Is it possible to read the data from BLE server(peripheral) without writing 0x01 to control point(triggering)?
Thank you
D.Vishnu
Hi vishnuatdialog,
The read procedure is a command that only a central can initiate and not a peripheral, in BLE the only way for a peripheral to initiate a data transfer towards a central is via notification, that means that you will have to make your characteristics notifiable. Also in order for the central to get the notifications from the peripheral it must perform a write request to the notifiable characteristic in order to enable the notifications. So its not mandatory to write to the control point that the ble_app_peripheral has (the control point just enables a timer that will trigger the sending of the notifications) but its mandatory to enable the CCC on the characteristic that you would like to send its value. For example when using the ble_app_peripheral you need to perform two writes in order to start getting data from the peripheral, one is the control point and the other write is to enable the CCC of the ADC characteristic, the later is mandatory for the client to start getting the notifications which you could start triggering upon connection in the corresponding callback.
Thanks MT_Dialog
Hello Dialog,
But, when I have used the nRFconnect app as a BLEcentral I wrote only to the control point(0x01) and then press the notification enabled arrow followed by pressing read arrow to receive the peripheral data. I didn't write any external command to enable CCC from the app to read the ADC Value.
CCC在水资源如何teristic is enabled is this performed by code or should we do this by using BLE Central?
Finally is it possible to receive peripheral data without writing any command from BLE central?
Thank you
D.Vishnu
Hi vishnuatdialog,
When you are pressing the notification enable button, this is what the central does, it writes to the CCC of the characteristic in order to enable the notifications of the specified characteristic.
If you dont write to the CCC characteristic (i.e. enable the notifications) the central wont be able to receive anything from that particual characteristic.
Thanks MT_dialog
Hello Dialog,
If I don't want to write to control point how can I trigger the timer automatically?
Hi vishnuatdialog,
You can either set a timer to issue a small delay after connecting with the device, and send a notification in the callback of that timer, or you can use the write indication when the central writes to the CCC (in order to enable the notification) and either start a timer from there or send the notification directly. For the later all you have to do is to have this implementation in the user_catch_rest_hndl() function when you receive a CUSTS1_VAL_WRITE_IND.
Thanks MT_dialog