完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
我在Project中使用一个Project,它与一个UART通信到另一个设备(主设备)。 用户使用他的手机向主设备发送命令和参数,电话应用程序应该能够告诉他订单已经被主设备正确接收。 因此,在命令之后,PROC接收数据,通过UART发送它,该设备根据接收的命令做出一些动作,并发送UART帧以确认它已经考虑到命令。 不清楚的是我应该如何创造特色。 我是否需要为每个参数创建许多特性,或者几个大的参数: 1) 很少有大的特性,具有20字节数组,并且每一个包含许多参数(如5-6个参数) 这个解决方案的问题是,如果用户在手机上改变一个参数,应用程序手机就必须读取整个特性,然后用掩模只改变一个参数。 2)每个特征的一个参数,它是非常结构化的,但问题是我们有很多参数读取和大量信息从主设备读取(如第一次进入服务的日期,软件版本等,大量的32位或64位长的参数)。因此,我需要至少30种不同的特性。 其他问题,关于验证(确保数据已被主设备接收)。 我必须使用: 1) 一个特征是每个参数(或参数集)的写入和读取:电话应用程序将数据发送到BLE设备中的字符,但是只有当UART帧从主设备返回确认时,才更新句柄。 2)2个特性,一个用于手机应用程序写入数据,另一个用于读取数据(第二个仅由主设备用UART帧编写)。UART应用程序从读取特性通知 3)只需将数据写入特征,并假定数据已被正确地传递到主设备。 什么样的方法最适合我们的应用? 谢谢你的帮助。 以上来自于百度翻译 以下为原文 Hello, I use a PRoC in a project where it communicate with an uart to an other device (the main device). The user use his phone to send commands and or parameters to the main device, and the phone app should be able to tell him that the orders have been correctly received by the main device. So after a command, the PRoC receive the data, send it throught UART, the device make some action according to the received command and send an UART frame to confirm that it have take the command into account. Where it's not clear it's how i should create characteristics. Does i have to create many characterisitics for each parameters, or few big ones : 1) Few larges characteristics, with a 20 bytes arrays, and each one contains many parameters (like 5-6 parameters) The problem with that solution is, that if the user change one parameters on the phone the app phone have to read the entire caracteristics and then change only one parameter with a mask. 2) one parameter per characteritic, its very structured, but the problem is that we have a lots of parameters to read and lots information to read from the main device (like date of first entry into service, software version etc, lots of large 32 or 64 bits long parameters). So with that solution, i need like at least 30 differents characteristics. Other question, about the verification ( be sure that the data have been received by the main device). Does i have to use : 1) one characteritics write and read per parameters ( or set of parameters) : the phone app send data to the caracteristic in the BLE device, but the handle is updated only when and if the confirmation is returned from the main device by an uart frame. 2) 2 characterisitics, one for the phone app to write the data and the other one to read the data (this second one is only writed by the main device with uart frame). The uart app suscribe from notification on the read characteritics 3) Just write the data in characteritics and assume that the data have been correctly delivered to the main device What approches are best suited for our application ? Thanks for you help. |
|
相关推荐
3个回答
|
|
将数据分离成特征完全是一个应用基础问题,它是如何结构化的,而不需要数据存储/传输的紧凑性。
(注意:如果你想要两个功能的组合,你可以实现另一个特性,它可以从一个特性的读/写中独立地更新多个特性。例如炭。A,Char。B,写信给Char。C将更新两个Char。A和B) 为了确保可靠的数据传递和确认,请尝试可靠的写、写和指示用于向外围设备(“主设备”)发送数据的功能。(也有签名的写,但这是安全特性,不一定是握手特性) 通过使用可靠的写,您可以确认数据在握手之前可靠地传递,然后更新您所称的“句柄”。这将丢弃任何未通过握手应答确认的更改。 让我知道如果你需要更多的澄清或有更多的问题。 以上来自于百度翻译 以下为原文 The separation of data into characteristics is entirely an application-base question on how structured you need it versus how compact you want the data stored/transmitted. (Note: You can implement another characteristic that updates multiple characteristics separately from a single characteristic read/write if you want a combination of both functionalities. E.G. Char. A, Char. B, Writing to Char. C will update both Char. A and B) For ensuring reliable data delivery and confirmation, try looking at the Reliable Write, Write, and Indicate functions for delivering data to and from the peripheral device ("main device"). (There is also a signed write, but that is a security feature, and not necessarily a handshake feature) With using the reliable write, you can confirm the data was delivered reliably with a handshake response before updating the "handle" as you called it. This would discard any changes not confirmed with a handshake reply. Let me know if you need more clarification or have more questions. |
|
|
|
yuhe82 发表于 2018-11-27 19:27 坦克为你解答! 这一点更清楚了,但我还是困惑。 对于数据的分离,我想知道什么是更有效的方法来定制特性(在定制服务中)。 因为我不明白为什么我应该使用20个特性(每个特征的1个参数集),如果我只能使用一个唯一的特性,并用页面字节切换数据集。 例如,1个独特的特性:0xP1 0xP2 0xSS0xSS0xSS00xSS。使用0xp1和0xp2页面选择器,剩下的参数/数据集 因此,使用该组织/结构,GATT表的大小可以减少到最小(但这真的重要吗?) 在未来,如果需要更多的特性,我可以使用一个新的服务UUID的第二个服务,并在里面添加新的东西,并且通过识别新的服务UUID来识别旧的外围设备和新的外围设备(新服务允许的新功能)。 在我所看到的所有例子中,大部分时间只有一小部分的值来传输。但对于我的应用来说,这有点不同,而且我必须确保从智能手机到终端设备的正确交付。 大多数时候,智能手机(中央)命令外围设备(非常小的数据和延迟必须是最小的)。 但是智能手机也用于配置,所以有时也会编写和读取大量信息(32或64位参数的大集合)。 为了保证数据传输, 有了可靠的写,我们可以知道数据被正确地传送到BLE,但是如果我必须重新检查“句柄”之后的UART传输(UART传输)是否仍然是必需的?但如果用这个解决方案的应用程序必须管理重试,如果错误的传输,然后我们不使用所有已经存在的东西。 以上来自于百度翻译 以下为原文 Tanks for your answer ! It's a litte more clear, but i'm still confused For the separation of data, i wonder what is the more "efficient" way to procced in a custom characteristic (in a custom service). Because i don't see why i should use like 20 characteritics ( 1 set of parameters per characteristics), if i can just use one unique characteristic and switch the set of data with a page byte. So for example 1 unique characteristic like : 0xP1 0xP2 0xSS 0xSS 0xSS 0xSS. With 0xP1, and 0xP2 the page selector, and the rest the set of parameters/data So with that organization/structure the gatt table size could be reduce to the minimum (but does it really matter ?) And in the futur if there is a need of more characterisics i could just use a second service with a new service UUID and add the new things inside, and recognize old peripheral and new peripheral ( with the new functionnilties allowed by the new service) by recognize the new service UUID. In all the exemple i see, most of time there is just a little set of value to transmit. But for my application it is a bit different plus i have to be sure of the correct delivery from smartphone to the end device. Most of the time the smartphone (central) command the peripheral ( very small data and latency have to be minimum) But the smartphone is used for configuration too,so sometimes write and read lots of information too (larges set of 32 or 64 bits parameters). For ensuring the data delivery, With reliable write we can know that data was transmitted correctly to the ble, but if i have to recheck the "handle" after the handcheck (of uart transmission) is it still necessary ? But the problem if with this solution app have to manage the retries if errors in ble transmissions and then we don't use all the already existent stuff.. |
|
|
|
别担心: GATDB数据库自动存储和更新与远程设备通过BLE通信的数据;因此,如果您有一个值存储在数据库中,那么运行在外围设备上的应用程序不需要将数据库上的每个读取请求的值作为数据库。它存储和自动化回复。因此,如果您具有多个特性,则它简化了外围应用程序,以使请求的数据被自动发送/回复到中央设备。您所描述的分页方法将用于发送和接收数据,但对于需要处理接收到的数据并在外围固件代码中显式地响应(GATT数据库内置到BLE堆栈中,因此是一层),将略微有更多的等待时间。较少的延迟响应。 另外,如果在新版本上添加新服务,则可以直接为每个新的服务添加新的新服务;例如:版本1具有名称、编号和位置特性。然后,版本2添加了第二个数、第二个位置、位置和位置,两个位置。版本3然后添加LaSyNeNd、MIDILYNEX、EMAIL地址 等等,在每个方法实现的方式上没有很大的差别,因为它们都是相似的复杂性IO。然而,我认为这些特性被很好地定义了,所以它使得文档更容易在那里发生,以及正在发生的事情。 因为所有的特性都会被分解成不同的数据包,所以当你发送它们时,每一个数据都是一个低延迟的少量数据;对于设置交换来说,只有更多/更长的通信。(改变你与特征的交互方式不会改变这一点,我敢肯定) 如果您打算在编写该特性之后阅读该特性,那么您可能只需做一个没有验证的写响应,知道您将在阅读之后立即验证它。 或者,如果您只读取它来验证它,那么使用可靠的写允许您丢弃写入值失败的更改值,或者不为其中之一获得响应。(它将所有的写更改保持为临时的,直到您在最后确认它们,在那里完成所有值的更改)。您仍然需要处理在应用程序级别上写入数据的重试,唯一的区别是您是否在每次写入之后添加一个额外的读取,以及在中央设备上的应用程序代码中,您在哪里处理重试;我会看到写、读、重试是类似的。R写,确认/重试,以较少的开销可靠写(S)方法。 以上来自于百度翻译 以下为原文 No worries: The GATTDB database automatically stores and updates data that it communicates with the remote device over BLE; Thus, if you have a value that you store in the database, then the application running on the peripheral doesn't need to tell the database the value on every read request, as the database has it stores and automates the reply. Thus, if you have multiple characteristics, it simplifies the peripheral application to having data requested being automatically sent/replied to the central device. The paging method you describe would work for sending and receiving data, but would have slightly more latency for you needing to handle the data received and respond with the response explicitly in your peripheral firmware code (the GATT Database is built into the BLE stack, and thus is one layer less of latency from responses). Plus, if you are adding new services on a new version, you can just directly add the new services with new names for each new one; For example: Version 1 has Name, Number, and Location characteristics. Version 2 then adds a Second_Number, Second_Location, Location_one_Times, Location_two_Times. Version 3 then adds Last_Name, Middle_Name, Email_Address Etc. There isn't a large difference in how easy each method is to implement, as they are both similar complexity imo. I think the characteristics are nicely defined however, so it makes it easier for documentation on what is there, and what is going on. Since all of the characteristics would be broken into different packets of data, then when you send them each one would be a small amount of data with low latency; There would just be more/longer communication for the setup exchanges. (Changing how you interact with the characteristics won't change this I'm pretty sure) If you are planning on reading the characteristic after writing to it, then you might be able to just do a write response with no verification, knowing that you will verify it immediately afterwards when you read it. Alternatively, if you are only reading it to verify it, then using the reliable write allows you to discard changed values if the writes fail to work, or don't get a response for one of them. (It holds all of the write changes as temporary until you confirm them at the end, where it finishes changing all the values). You are still going to need to handle the retry of writing the data at the application level, the only difference would be whether you add an extra read after each write, and where in the application code on the central device that you handle the retries; I would see write, read, retry being similar to write,confirm/retry with some less overhead on the reliable write(s) method. |
|
|
|
只有小组成员才能发言,加入小组>>
748个成员聚集在这个小组
加入小组2054 浏览 1 评论
1809 浏览 1 评论
3620 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1746 浏览 6 评论
1499 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
481浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
335浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
400浏览 2评论
341浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
833浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-6 11:24 , Processed in 1.089726 second(s), Total 81, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号