Read/Write functions in DSPS

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
RoniKreinin
Offline
Last seen:2 years 11 months ago
加入:2018-01-02 16:10
Read/Write functions in DSPS

Hi,

I am trying to get the DSPS program to perform like normal but if it receives certain data over bluetooth, and if it matches a certain command, send back some data instead of passing the data on over uart. Which functions should I use for reading and writing this data?

I'm using DSPS 5.150.2 .

Thanks

Keywords:
Device:
MT_dialog
Offline
Last seen:2 months 6 days ago
Staff
加入:2015-06-08 11:34
Hi RoninKreinin,

Hi RoninKreinin,

The question is a bit vague, what you are trying to implement i suppose that is something like a AT command, which would require customization of the DSPS reference design and you will have to either check the buffer that stores the incoming UART or BLE data depending on what you would like to implement and then either send data or perform some kind of action. Please have a look at the codeless demo (you will be able to find it in the reference design section on the support site), i suppose that this is exactly what you are looking for.

Thanks MT_dialog

RoniKreinin
Offline
Last seen:2 years 11 months ago
加入:2018-01-02 16:10
基本上我只是想

基本上我只是想compare the input buffer (from ble) to a constant value and if they are equal then I want to send back some data, and if they are not then the program continues to function normally.

In pseudocode:

if (data == CNST_VALUE)
{
Write_something_to_ble();
}
else
{
//Proceed to regular functionality
}

I'm just not sure about how to get the data buffer and which function to use for sending data back through ble

MT_dialog
Offline
Last seen:2 months 6 days ago
Staff
加入:2015-06-08 11:34
Hi RoninKreinin,

Hi RoninKreinin,

I assume that you would like to send something from the central device and you would like to DSPS on the peripheral side to parse it and do whatever is that you would like to do. So when the device gets data from the central side the message SPS_SERVER_DATA_RX_IND will occur the message is attached to the user_sps_server_data_rx_ind_handler() so you will be able to get whatever the central sends in the callback mentioned above. The default functionality will just invoke the user_ble_push() in order to push the data in the buffer. So an idea would be to check the incoming data and either do your thing or push the data into the buffer in order to be printed out on the uart side. Now in case that you would like to send back something to the central in case of a specific command what you can do is use the user_send_ble_data() function and directly send a notification to the central without going through the buffers.

Thanks MT_dialog