Learn MoreFAQsTutorials

10个帖子/ 0新
Last post
HamzaAffes
Offline
最后一次露面:4天12小时前
Joined:2020-10-03 13:11
using app_easy_timer

亲爱的对话框,

所以我开始构建一个小而简单的项目sing DA14585 and sdk 6.0.14. A small simulation i would rather say. I want to create a queue that holds a struct data type defined by the user and each interval of 30 seconds for exemple it gets enqueued until it reaches its maximum size . i managed to do this when a connection is established and get the data by refering to the ble peripheral exemple now what im asking is how can i implement this when theres is no connection to the ble and by that i mean once the system is up the queue is automatically filled and then once a connection is established i get the data count in the queue and start sending it through a characteristic that i made along side the data itself. is it possible to do this using the app_easy_timer function to fill the queue even if the ble is not active? if so since it is a one shot timer is there a way to call the enqueuing function periodically until ble is active ?

Thank you

Device:
PM_DIALOG.
Offline
最后一次露面:1天6分钟前
Staff
Joined:2018-02-08 11:03
嗨Hamzaaffes,

嗨Hamzaaffes,

谢谢你的问题在线。您可以将数据存储在广告字符串中,并使用App_easy_Timer opdate它们。请查看SDK和ADV_DATA_UPDATE_TIMER_CB()函数的BLE_APP_PHERIALAL示例。此回调在app_addata_update_to秒之后更新制造商特定数据。

谢谢,PM_DIALOG.

HamzaAffes
Offline
最后一次露面:4天12小时前
Joined:2020-10-03 13:11
嗨对话框,

嗨对话框,

您能否在使用user_peripheral.c文件中进一步解释如何在上面实现我的请求?对于我尝试完成的内容是,通过使用app_easy_timer定期填充一个随机数的队列,然后一旦建立连接,我会停止eNqueue,我通过类似于app_adcval1_timer_cb_handler的特征发送数据。

thank you

PM_DIALOG.
Offline
最后一次露面:1天6分钟前
Staff
Joined:2018-02-08 11:03
嗨Hamzaaffes,

嗨Hamzaaffes,

First you should define th manufacturer specific data in the advertising string and updating the by using the app_easy_timer. Please check adv_data_update_timer_cb() that updates the manufacturer specific data.

应该放在广告字符串中的数据量是多少?

还请查看以下教程:

http://lpccs-docs.dialog-seminiondiond.com/da145xx_advertising_tutorial/changing_advertising_parameters.html#changing-the-advertising-data.

Once the device is connected, you should stop the timer, copy the data and send them via notifications.

Regarding the BLE notifications, please check app_adcval1_timer_cb_handler() function.

谢谢,PM_DIALOG.

HamzaAffes
Offline
最后一次露面:4天12小时前
Joined:2020-10-03 13:11
Hi dialog and thank you for

Hi dialog and thank you for your response

#define BUFFER_LENGTH 1000 typedef struct sensorData_t { uint16_t _sensor1 ; uint16_t _sensor2 ; uint16_t _sensor3 ; uint16_t _sensor4 ; uint16_t _sensor5 ; uint16_t _sensor6 ; uint16_t _sensor7 ; uint16_t _sensor8 ; uint16_t _sensor9 ; uint16_t _sensor10 ; uint16_t _sensor11 ; uint16_t _sensor12 ; }sensorData_t; sensorData_t SensorDataBuffer[BUFFER_LENGTH];

all of the values of sensor1 to 12 are randomly generated (dummy values) and then stored in the SensorDataBuffer every 30 sec and once i connect i send the stored values one by one in a certain order through app_adcval1_timer_cb_handler so a single element would be sizeof(sensorData_t) which is 24 bytes

PM_DIALOG.
Offline
最后一次露面:1天6分钟前
Staff
Joined:2018-02-08 11:03
嗨Hamzaaffes,

嗨Hamzaaffes,

Just for a clarification: Before sending them via BLE notification, what is your requirement? Do you need to place the 24bytes into the advertising string and update it?

谢谢,PM_DIALOG.

HamzaAffes
Offline
最后一次露面:4天12小时前
Joined:2020-10-03 13:11
嗨对话框,

嗨对话框,

as i said before the sensorDataBuffer will be filled with a sensorData_t variable every 30 sec so its like pushing data through a stack and then once the board is connected to lightblue app i can pop all of the data from the stack one by one. sensorDataBuffer is an array to store the data which are randomly generated for testing purposes so if the array has 100 as length it can hold 2400 bytes of gathered data. i apologise for this beginner request

thank you

PM_DIALOG.
Offline
最后一次露面:1天6分钟前
Staff
Joined:2018-02-08 11:03
嗨Hamzaaffes,

嗨Hamzaaffes,

You could use the adverting or the scan response data for storing your custom data. Please checkout theChanging advertising parameters using GPIO interrupts and/or timersandBLE Advertising Tutorial (HTML).

谢谢,PM_DIALOG.

HamzaAffes
Offline
最后一次露面:4天12小时前
Joined:2020-10-03 13:11
嗨对话框,

嗨对话框,

I must say that i cant find any common ground between what you said and my request. I need to store 2400 bytes and the advertisement packets cant hold this much payload. The goal is not to update the existing data but to store new generated data following the structure defined in the previous comment.A ring buffer can solve this if you could kindly clarify to me how to implement it and how to fill it with data using the app_easy_timer when no connection is established and then when ble connection is present I can pop the data through app_adcval1_timer_cb_handler characteristic to monitor the whole buffer.

Thank you

PM_DIALOG.
Offline
最后一次露面:1天6分钟前
Staff
Joined:2018-02-08 11:03
嗨Hamzaaffes,

嗨Hamzaaffes,

>>A ring buffer can solve this if you could kindly clarify to me how to implement.

This is something you should design by your own. You might take a look at the DSPS example that implements a circular buffer.

>> how to fill it with data using the app_easy_timer when no connection is established

As mentioned in my previous comments, you should you the advertising string so to store your custom data. Please take a look at the ble_app_peripheral example of the SDK and adv_data_update_timer_cb() function

>> when ble connection is present I can pop the data through app_adcval1_timer_cb_handler characteristic to monitor the whole buffer.

The ble_app_peripheral example of the SDK demonstrates how to send notifications to the peer device

谢谢,PM_DIALOG.