CN118509275A - Method, device, equipment and storage medium for data writing in data communication - Google Patents
Method, device, equipment and storage medium for data writing in data communication Download PDFInfo
- Publication number
- CN118509275A CN118509275A CN202310122239.5A CN202310122239A CN118509275A CN 118509275 A CN118509275 A CN 118509275A CN 202310122239 A CN202310122239 A CN 202310122239A CN 118509275 A CN118509275 A CN 118509275A
- Authority
- CN
- China
- Prior art keywords
- value
- current
- written
- writing
- write
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/2803—Home automation networks
- H04L12/2807—Exchanging configuration information on appliance services in a home automation network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0078—Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location
- H04L1/0091—Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location arrangements specific to receivers, e.g. format detection
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Automation & Control Theory (AREA)
- Debugging And Monitoring (AREA)
Abstract
本申请涉及设备技术领域,公开一种用于数据通信中数据写入的方法、装置、设备及存储介质。该方法包括:在确定已写入当前写入值的情况下,获取对应的当前接收值;在所述当前接收值与目标写入值之间的当前差值的绝对值大于或等于预设误差值的情况下,根据所述当前差值,对所述当前写入值进行修正,得到修正后写入值,并进行写入处理;在所述当前写入值与所述当前接收值之间的当前绝对差值小于预设误差值的情况下,输出所述当前写入值。这样,数据通信时,快速且准确的校验出每条写入值的补偿值,自动纠正写入值的误差,极大提升数据通信效率。
The present application relates to the field of equipment technology, and discloses a method, device, equipment and storage medium for writing data in data communication. The method includes: when it is determined that the current write value has been written, obtaining the corresponding current received value; when the absolute value of the current difference between the current received value and the target write value is greater than or equal to the preset error value, correcting the current write value according to the current difference to obtain the corrected write value, and performing write processing; when the current absolute difference between the current write value and the current received value is less than the preset error value, outputting the current write value. In this way, during data communication, the compensation value of each write value is quickly and accurately verified, and the error of the write value is automatically corrected, which greatly improves the efficiency of data communication.
Description
技术领域Technical Field
本申请涉及智能设备技术领域,例如涉及用于数据通信中数据写入的方法、装置、设备及存储介质。The present application relates to the field of smart device technology, for example, to a method, apparatus, device and storage medium for writing data in data communication.
背景技术Background Art
随着智能技术的普及,智能设备可应用于人们的日常生活中,并且,智能设备之间还可进行数据通信。目前,智能设备进行数据通信时,因为解析或计算方法的不同,有时会出现写入值与实际接收值不符、写入值与实际接收值存在误差的问题。With the popularization of smart technology, smart devices can be applied to people's daily life, and data communication can be carried out between smart devices. At present, when smart devices carry out data communication, due to different parsing or calculation methods, sometimes there will be problems such as the written value does not match the actual received value, or there is an error between the written value and the actual received value.
通过人工手动反复校队,可得到相应的补偿值,并进行补偿,并且,下一条通信数据写入时存在误差,也需要重新进行校队,极大地影响了数据通信效率。Through repeated manual calibration, the corresponding compensation value can be obtained and compensated. In addition, if there is an error when writing the next communication data, it also needs to be re-calibrated, which greatly affects the data communication efficiency.
需要说明的是,在上述背景技术部分公开的信息仅用于加强对本申请的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field.
发明内容Summary of the invention
为了对披露的实施例的一些方面有基本的理解,下面给出了简单的概括。所述概括不是泛泛评述,也不是要确定关键/重要组成元素或描绘这些实施例的保护范围,而是作为后面的详细说明的序言。In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key/critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
本公开实施例提供了一种用于数据通信中数据写入的方法、装置、设备和存储介质,以解决数据通信效率有待提高的技术问题。The embodiments of the present disclosure provide a method, an apparatus, a device and a storage medium for writing data in data communication, so as to solve the technical problem that the efficiency of data communication needs to be improved.
在一些实施例中,所述方法包括:In some embodiments, the method comprises:
在确定已写入当前写入值的情况下,获取对应的当前接收值;When it is determined that the current written value has been written, the corresponding current received value is obtained;
在所述当前接收值与目标写入值之间的当前差值的绝对值大于或等于预设误差值的情况下,根据所述当前差值,对所述当前写入值进行修正,得到修正后写入值,并进行写入处理;When the absolute value of the current difference between the current received value and the target written value is greater than or equal to the preset error value, the current written value is corrected according to the current difference to obtain a corrected written value, and a writing process is performed;
在所述当前写入值与所述当前接收值之间的当前绝对差值小于预设误差值的情况下,输出所述当前写入值。In a case where a current absolute difference between the current written value and the current received value is smaller than a preset error value, the current written value is output.
在一些实施例中,所述装置包括:In some embodiments, the apparatus comprises:
获取模块,被配置为在确定已写入当前写入值的情况下,获取对应的当前接收值;An acquisition module is configured to acquire a corresponding current received value when it is determined that the current written value has been written;
修正模块,被配置为在所述当前接收值与目标写入值之间的当前差值的绝对值大于或等于预设误差值的情况下,根据所述当前差值,对所述当前写入值进行修正,得到修正后写入值,并进行写入处理;a correction module, configured to correct the current written value according to the current difference value, obtain a corrected written value, and perform writing processing on the current written value when the absolute value of the current difference value between the current received value and the target written value is greater than or equal to a preset error value;
输出模块,被配置为在所述当前写入值与所述当前接收值之间的当前绝对差值小于预设误差值的情况下,输出所述当前写入值。The output module is configured to output the current written value when a current absolute difference between the current written value and the current received value is less than a preset error value.
在一些实施例中,所述用于数据通信中数据写入的装置,包括处理器和存储有程序指令的存储器,所述处理器被配置为在执行所述程序指令时,执行上述用于数据通信中数据写入方法。In some embodiments, the device for writing data in data communication includes a processor and a memory storing program instructions, and the processor is configured to execute the above-mentioned method for writing data in data communication when executing the program instructions.
在一些实施例中,所述设备,包括设备本体;上述用于数据通信中数据写入的装置,被安装于所述设备本体。In some embodiments, the device includes a device body; the above-mentioned device for writing data in data communication is installed in the device body.
在一些实施例中,所述存储介质,存储有程序指令,所述程序指令在运行时,执行上述用于数据通信中数据写入的方法。In some embodiments, the storage medium stores program instructions, and when the program instructions are run, the method for writing data in data communication is executed.
本公开实施例提供的用于数据通信中数据写入的方法、装置和设备,可以实现以下技术效果:The method, apparatus, and device for writing data in data communication provided by the embodiments of the present disclosure can achieve the following technical effects:
获取到与当前写入值对应的当前接收值后,得到当前接收值与目标写入值之间的当前差值的绝对值,在差值的绝对值大于或等于预设误差值的情况下,对当前写入值进行修正并再次写入,直至差值的绝对值小于预设误差值时,输出当前写入值,这样,数据通信时,写入值与输出值一致,自动、快速且准确实现了通信数据的校验,极大提升数据通信效率。After obtaining the current received value corresponding to the current written value, the absolute value of the current difference between the current received value and the target written value is obtained. When the absolute value of the difference is greater than or equal to the preset error value, the current written value is corrected and written again until the absolute value of the difference is less than the preset error value. The current written value is output. In this way, during data communication, the written value is consistent with the output value, and the communication data is verified automatically, quickly and accurately, greatly improving the data communication efficiency.
以上的总体描述和下文中的描述仅是示例性和解释性的,不用于限制本申请。The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
一个或多个实施例通过与之对应的附图进行示例性说明,这些示例性说明和附图并不构成对实施例的限定,附图中具有相同参考数字标号的元件示为类似的元件,附图不构成比例限制,并且其中:One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
图1是本公开实施例提供的一种设备之间数据通信的应用场景示意图;FIG1 is a schematic diagram of an application scenario of data communication between devices provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种用于数据通信中数据写入方法的流程示意图;FIG2 is a schematic diagram of a flow chart of a method for writing data in data communication provided by an embodiment of the present disclosure;
图3是本公开实施例提供的一种用于数据通信中数据写入方法的流程示意图;FIG3 is a flow chart of a method for writing data in data communication provided by an embodiment of the present disclosure;
图4是本公开实施例提供的一种用于数据通信中数据写入装置的结构示意图;FIG4 is a schematic diagram of the structure of a data writing device for data communication provided by an embodiment of the present disclosure;
图5是本公开实施例提供的一种用于数据通信中数据写入装置的结构示意图;FIG5 is a schematic diagram of the structure of a data writing device for data communication provided by an embodiment of the present disclosure;
图6是本公开实施例提供的一种用于数据通信中数据写入装置的结构示意图;FIG6 is a schematic diagram of the structure of a data writing device for data communication provided by an embodiment of the present disclosure;
图7是本公开实施例提供的一个设备的示意图。FIG. 7 is a schematic diagram of a device provided by an embodiment of the present disclosure.
具体实施方式DETAILED DESCRIPTION
为了能够更加详尽地了解本公开实施例的特点与技术内容,下面结合附图对本公开实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本公开实施例。在以下的技术描述中,为方便解释起见,通过多个细节以提供对所披露实施例的充分理解。然而,在没有这些细节的情况下,一个或多个实施例仍然可以实施。在其它情况下,为简化附图,熟知的结构和装置可以简化展示。In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
本公开实施例的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开实施例的实施例。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含。The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
除非另有说明,术语“多个”表示两个或两个以上。Unless otherwise stated, the term "plurality" means two or more.
本公开实施例中,字符“/”表示前后对象是一种“或”的关系。例如,A/B表示:A或B。In the embodiment of the present disclosure, the character "/" indicates that the preceding and following objects are in an "or" relationship. For example, A/B indicates: A or B.
术语“和/或”是一种描述对象的关联关系,表示可以存在三种关系。例如,A和/或B,表示:A或B,或,A和B这三种关系。The term "and/or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and/or B means: A or B, or, A and B.
本公开实施例中,设备在进行数据通信中的数据写入时,获取到的当前接收值与目标写入值不匹配时,可得到当前接收值与目标写入值之间的当前差值的绝对值,在差值的绝对值大于或等于预设误差值的情况下,对当前写入值进行修正并再次写入,直至差值的绝对值小于预设误差值时,输出当前写入值,这样,数据通信时,快速且准确的校验出每条写入值的补偿值,自动纠正写入值的误差,使得输出值与目标写入值相匹配,极大提升数据通信效率。In the disclosed embodiment, when the device is writing data during data communication, if the currently received value obtained does not match the target written value, the absolute value of the current difference between the currently received value and the target written value can be obtained. When the absolute value of the difference is greater than or equal to the preset error value, the currently written value is corrected and written again until the absolute value of the difference is less than the preset error value, and the currently written value is output. In this way, during data communication, the compensation value of each written value can be quickly and accurately checked, and the error of the written value can be automatically corrected so that the output value matches the target written value, greatly improving the data communication efficiency.
图1是本公开实施例提供的一种设备之间数据通信的应用场景示意图。如图1所示,在智能家居系统中,空调可分别与智能灯具、智能窗帘等进行数据通信,实现空调与智能灯具、智能窗帘之间的联动,例如:接收到睡眠指令,空调可控制本端进入睡眠模式,并与智能灯具、智能窗帘进行数据通信,控制智能灯具关闭,也控制智能窗帘处于展开状态等等。可见,这些设备之间可进行数据通信,并且,进行数据通信时,有些设备可获取到目标写入值,并需将目标写入值写入对应存储空间中,而在数据通信的写入过程中,可进行数据的自动校验,使得输出值与目标写入值相匹配,提升数据通信效率。FIG1 is a schematic diagram of an application scenario of data communication between devices provided by an embodiment of the present disclosure. As shown in FIG1 , in a smart home system, an air conditioner can respectively communicate data with smart lamps, smart curtains, etc., to realize the linkage between the air conditioner and the smart lamps and smart curtains. For example, upon receiving a sleep instruction, the air conditioner can control the local end to enter sleep mode, and communicate data with smart lamps and smart curtains to control the smart lamps to turn off, and also control the smart curtains to be in an unfolded state, etc. It can be seen that data communication can be performed between these devices, and when performing data communication, some devices can obtain the target write value and need to write the target write value into the corresponding storage space, and during the writing process of data communication, the data can be automatically verified so that the output value matches the target write value, thereby improving the efficiency of data communication.
图2是本公开实施例提供的一种用于数据通信中数据写入方法的流程示意图。如图2所示,数据通信中数据写入的过程包括:FIG2 is a flow chart of a method for writing data in data communication provided by an embodiment of the present disclosure. As shown in FIG2 , the process of writing data in data communication includes:
步骤201:在确定已写入当前写入值的情况下,获取对应的当前接收值。Step 201: When it is determined that the current written value has been written, obtain the corresponding current received value.
数据通信过程中,设备获取到目标写入值后,可记录即保存目标写入值,当然,也可针对目标写入值,配置对应的预设误差值,不同类型的写入值,可对应不同的预设误差值,这样,可根据目标写入值,进行数据的写入。During the data communication process, after the device obtains the target write value, it can record or save the target write value. Of course, it can also configure a corresponding preset error value for the target write value. Different types of write values can correspond to different preset error values. In this way, data can be written according to the target write value.
本公开实施例中,可在写入过程中,自动纠正写入值的误差,使得输出值与目标写入值相匹配,因此,有可能一次写入过程,即可实现输出值与目标写入值相匹配,也有可能两次或多次写入过程,才可实现输出值与目标写入值相匹配。因此,当前时刻进行的写入过程,对应的写入值即为当前写入值。而第一次进行写入过程时,对应的当前写入值即为目标写入值,即将目标写入值确定为当前写入值,并写入当前写入值。In the disclosed embodiment, the error of the written value can be automatically corrected during the writing process so that the output value matches the target written value. Therefore, it is possible that the output value matches the target written value in one writing process, or it is possible that two or more writing processes are required to match the output value with the target written value. Therefore, the writing process performed at the current moment corresponds to the current written value. When the writing process is performed for the first time, the corresponding current written value is the target written value, that is, the target written value is determined as the current written value, and the current written value is written.
进入了写入过程,即确定已写入当前写入值,即可在对应的存储空间,获取到对应的当前接收值。Entering the writing process, that is, determining that the current writing value has been written, the corresponding current receiving value can be obtained in the corresponding storage space.
步骤202:在当前接收值与目标写入值之间的当前差值的绝对值大于或等于预设误差值的情况下,根据当前差值,对当前写入值进行修正,得到修正后写入值,并进行写入处理。Step 202: When the absolute value of the current difference between the current received value and the target written value is greater than or equal to the preset error value, the current written value is corrected according to the current difference to obtain a corrected written value, and a writing process is performed.
本公开实施例中,获取并保存目标写入值可为Xm,保存的对应的预设误差值为Δ,这样,获得当前接收值Jd之后,可得到当前接收值与目标写入值之间的当前差值的绝对值,即│Jd-Xm│。然后,可将当前差值的绝对值与预设误差值件比较,若当前差值的绝对值大于或等于预设误差值,即│Jd-Xm│≥Δ时,可确定当前写入值与目标写入值不匹配,不能输出,需要进行纠正,即需要根据当前差值,对当前写入值进行修正,得到修正后写入值。In the disclosed embodiment, the target write value obtained and saved may be Xm, and the corresponding preset error value saved is Δ. In this way, after obtaining the current received value Jd, the absolute value of the current difference between the current received value and the target write value, i.e., |Jd-Xm|, can be obtained. Then, the absolute value of the current difference can be compared with the preset error value. If the absolute value of the current difference is greater than or equal to the preset error value, i.e., |Jd-Xm|≥Δ, it can be determined that the current write value does not match the target write value and cannot be output, and needs to be corrected, i.e., the current write value needs to be corrected according to the current difference to obtain the corrected write value.
在一些实施例中,得到修正后写入值包括:将当前写入值和当前差值之间的当前和值,确定为修正后写入值。当前接收值与目标写入值之间的当前差值为Jd-Xm,当前写入值为Xd,从而,修正后写入值Xx=Xd+(Jd-Xm)。In some embodiments, obtaining the corrected write value includes: determining the current sum between the current write value and the current difference value as the corrected write value. The current difference between the current received value and the target write value is Jd-Xm, and the current write value is Xd, so the corrected write value Xx=Xd+(Jd-Xm).
在一些实施例中,得到修正后写入值包括:根据当前差值,对当前写入值进行迭代处理,得到修正后写入值。当然,本公开实施例也不限于此,可根据设备类型,写入数据的类型等等,确定对应纠正方案。In some embodiments, obtaining the corrected written value includes: iteratively processing the current written value according to the current difference value to obtain the corrected written value. Of course, the disclosed embodiments are not limited thereto, and the corresponding correction scheme can be determined according to the device type, the type of written data, etc.
得到修正后写入值之后,还需再次进行写入处理,即在一些实施例中,将修正后写入值确定为当前写入值,并写入当前写入值,从而,继续进行写入过程。After obtaining the corrected write value, it is necessary to perform the write process again, that is, in some embodiments, the corrected write value is determined as the current write value, and the current write value is written, thereby continuing the write process.
步骤203:在当前写入值与当前接收值之间的当前绝对差值小于预设误差值的情况下,输出当前写入值。Step 203: When the current absolute difference between the current written value and the current received value is smaller than the preset error value, output the current written value.
当前差值的绝对值小于预设误差值,即│Jd-Xm│<Δ时,可确定当前写入值与目标写入值相匹配了,从而,可输出当前写入值。When the absolute value of the current difference is less than the preset error value, that is, |Jd-Xm|<Δ, it can be determined that the current write value matches the target write value, and thus the current write value can be output.
可见,本公开实施例中,在进行数据通信中的数据写入时,获取到的当前接收值与目标写入值不匹配时,可得到当前接收值与目标写入值之间的当前差值的绝对值,在差值的绝对值大于或等于预设误差值的情况下,对当前写入值进行修正并再次写入,直至差值的绝对值小于预设误差值时,输出当前写入值,这样,数据通信时,快速且准确的校验出每条写入值的补偿值,自动纠正写入值的误差,使得输出值与目标写入值相匹配,降低了数据校验的错误率,极大提升数据通信效率。It can be seen that in the embodiments of the present disclosure, when writing data in data communication, when the currently received value obtained does not match the target written value, the absolute value of the current difference between the currently received value and the target written value can be obtained. When the absolute value of the difference is greater than or equal to the preset error value, the current written value is corrected and written again until the absolute value of the difference is less than the preset error value, and the current written value is output. In this way, during data communication, the compensation value of each written value is quickly and accurately checked, and the error of the written value is automatically corrected so that the output value matches the target written value, thereby reducing the error rate of data verification and greatly improving data communication efficiency.
下面将操作流程集合到具体实施例中,举例说明本发明实施例提供的用于数据通信中数据写入过程。The operation flow is collected into a specific embodiment below to illustrate the data writing process in data communication provided by the embodiment of the present invention.
本公开一实施例中,设备可为如图1所示能进行数据通信的空调,需写入的数据可为加湿器发送的湿度值数据,或其他设备发送的数据值。In one embodiment of the present disclosure, the device may be an air conditioner capable of data communication as shown in FIG. 1 , and the data to be written may be humidity value data sent by a humidifier, or data values sent by other devices.
图3是本公开实施例提供的一种用于数据通信中数据写入方法的流程示意图。结合图3,数据通信中数据写入过程包括:FIG3 is a flow chart of a method for writing data in data communication provided by an embodiment of the present disclosure. In conjunction with FIG3 , the process of writing data in data communication includes:
步骤301:获取目标写入值,并保存目标写入值和对应的预设误差值。Step 301: Obtain a target write value, and save the target write value and a corresponding preset error value.
步骤302:将目标写入值确定为当前写入值。Step 302: Determine the target write value as the current write value.
步骤303:写入当前写入值,并获取对应的当前接收值。Step 303: Write the current written value and obtain the corresponding current received value.
步骤304:判断当前接收值与目标写入值之间的当前差值的绝对值是否大于或等于预设误差值?即判断│Jd-Xm│≥Δ是否成立?若是,执行步骤305,否则,执行步骤307。Step 304: Determine whether the absolute value of the current difference between the current received value and the target written value is greater than or equal to the preset error value? That is, determine whether |Jd-Xm|≥Δ is established? If so, execute step 305, otherwise, execute step 307.
步骤305:将当前写入值和当前差值之间的当前和值,确定为修正后写入值。Step 305: Determine the current sum value between the current written value and the current difference value as the corrected written value.
Xx=Xd+(Jd-Xm)。Xx=Xd+(Jd-Xm).
步骤306:将修正后写入值确定为当前写入值,返回步骤303。Step 306 : Determine the corrected written value as the current written value, and return to step 303 .
步骤307:输出当前写入值。Step 307: Output the current written value.
可见,本实施例中,空调在进行数据通信中的数据写入时,获取到的当前接收值与目标写入值不匹配时,可得到当前接收值与目标写入值之间的当前差值的绝对值,在差值的绝对值大于或等于预设误差值的情况下,将当前写入值和当前差值之间的当前和值,确定为修正后写入值并再次写入,直至差值的绝对值小于预设误差值时,输出当前写入值,这样,数据通信时,快速且准确的校验出每条写入值的补偿值,自动纠正写入值的误差,使得输出值与目标写入值相匹配,降低了数据校验的错误率,极大提升数据通信效率。It can be seen that in this embodiment, when the air conditioner is writing data in data communication, when the current received value obtained does not match the target written value, the absolute value of the current difference between the current received value and the target written value can be obtained. When the absolute value of the difference is greater than or equal to the preset error value, the current sum between the current written value and the current difference is determined as the corrected written value and written again until the absolute value of the difference is less than the preset error value, and the current written value is output. In this way, during data communication, the compensation value of each written value is quickly and accurately checked, and the error of the written value is automatically corrected, so that the output value matches the target written value, which reduces the error rate of data verification and greatly improves data communication efficiency.
根据上述用于数据通信中数据写入的过程,可构建一种用于数据通信中数据写入的装置。According to the above process for writing data in data communication, a device for writing data in data communication can be constructed.
图4是本公开实施例提供的一种用于数据通信中数据写入装置的结构示意图。如图4所示,用于数据通信中数据写入装置400包括:获取模块410、修正模块420、输出模块430。Fig. 4 is a schematic diagram of a data writing device for data communication provided by an embodiment of the present disclosure. As shown in Fig. 4 , the data writing device 400 for data communication includes: an acquisition module 410 , a correction module 420 , and an output module 430 .
获取模块410,被配置为在确定已写入当前写入值的情况下,获取对应的当前接收值。The acquisition module 410 is configured to acquire the corresponding current received value when it is determined that the current written value has been written.
修正模块420,被配置为在当前接收值与目标写入值之间的当前差值的绝对值大于或等于预设误差值的情况下,根据当前差值,对当前写入值进行修正,得到修正后写入值,并进行写入处理。The correction module 420 is configured to correct the current write value according to the current difference value when the absolute value of the current difference value between the current received value and the target write value is greater than or equal to the preset error value, obtain the corrected write value, and perform write processing.
输出模块430,被配置为在当前写入值与当前接收值之间的当前绝对差值小于预设误差值的情况下,输出当前写入值。The output module 430 is configured to output the current written value when the current absolute difference between the current written value and the current received value is less than a preset error value.
在一些实施例中,还包括:保存模块,被配置为获取并保存目标写入值和预设误差值。In some embodiments, the method further includes: a saving module configured to obtain and save a target writing value and a preset error value.
在一些实施例中,还包括:写入模块,被配置为将目标写入值确定为当前写入值,并写入当前写入值。In some embodiments, the method further includes: a writing module configured to determine the target writing value as the current writing value and write the current writing value.
在一些实施例中,修正模块420,具体被配置为将当前写入值和当前差值之间的当前和值,确定为修正后写入值;或,根据当前差值,对当前写入值进行迭代处理,得到修正后写入值。In some embodiments, the correction module 420 is specifically configured to determine the current sum between the current written value and the current difference value as the corrected written value; or, according to the current difference value, iteratively process the current written value to obtain the corrected written value.
在一些实施例中,写入模块,还被配置为将修正后写入值确定为当前写入值,并写入当前写入值。In some embodiments, the writing module is further configured to determine the corrected writing value as the current writing value and write the current writing value.
下面结合实施例进一步描述用于数据通信中数据写入装置的数据通信中数据写入过程。The data writing process in data communication used by the data writing device in data communication is further described below in conjunction with the embodiments.
本实施例中,设备可为如图1能进行数据通信的智能窗帘,需写入的数据可为接收到的窗帘展开程度值,或其他数据值。In this embodiment, the device may be a smart curtain capable of data communication as shown in FIG. 1 , and the data to be written may be the received curtain expansion degree value, or other data values.
图5是本公开实施例提供的一种用于数据通信中数据写入装置的结构示意图。如图5所示,用于数据通信中数据写入装置400包括:获取模块410、修正模块420、输出模块430、保存模块440和写入模块450。FIG5 is a schematic diagram of a data writing device for data communication provided by an embodiment of the present disclosure. As shown in FIG5 , the data writing device 400 for data communication includes: an acquisition module 410 , a correction module 420 , an output module 430 , a storage module 440 and a writing module 450 .
智能窗帘获取到目标写入值,保存模块440可保存目标写入值和对应的预设误差值。这样,写入模块450可将目标写入值确定为当前写入值,并写入当前写入值,从而,获取模块410获取对应的当前接收值。The smart curtain obtains the target write value, and the saving module 440 can save the target write value and the corresponding preset error value. In this way, the writing module 450 can determine the target write value as the current write value and write the current write value, so that the acquisition module 410 obtains the corresponding current received value.
若当前接收值与目标写入值之间的当前差值的绝对值大于或等于预设误差值,即│Jd-Xm│≥Δ时,修正模块420可将当前写入值和当前差值之间的当前和值,确定为修正后写入值,即Xx=Xd+(Jd-Xm),这样,写入模块450可将修正后写入值确定为当前写入值,并写入当前写入值,从而,获取模块410获取对应的当前接收值。If the absolute value of the current difference between the current received value and the target written value is greater than or equal to the preset error value, that is, │Jd-Xm│≥Δ, the correction module 420 can determine the current sum value between the current written value and the current difference as the corrected written value, that is, Xx=Xd+(Jd-Xm). In this way, the writing module 450 can determine the corrected written value as the current written value and write the current written value, so that the acquisition module 410 acquires the corresponding current received value.
若当前接收值与目标写入值之间的当前差值的绝对值小于预设误差值,即│Jd-Xm│<Δ时,输出模块430则输出当前写入值If the absolute value of the current difference between the current received value and the target written value is less than the preset error value, that is, |Jd-Xm|<Δ, the output module 430 outputs the current written value
可见,本实施例中,设备在进行数据通信中的数据写入时,用于数据通信中数据写入的装置获取到的当前接收值与目标写入值不匹配时,可得到当前接收值与目标写入值之间的当前差值的绝对值,在差值的绝对值大于或等于预设误差值的情况下,将当前写入值和当前差值之间的当前和值,确定为修正后写入值并再次写入,直至差值的绝对值小于预设误差值时,输出当前写入值,这样,数据通信时,快速且准确的校验出每条写入值的补偿值,自动纠正写入值的误差,使得输出值与目标写入值相匹配,降低了数据校验的错误率,极大提升数据通信效率。It can be seen that in this embodiment, when the device is writing data in data communication, when the current received value obtained by the device for writing data in data communication does not match the target written value, the absolute value of the current difference between the current received value and the target written value can be obtained. When the absolute value of the difference is greater than or equal to the preset error value, the current sum between the current written value and the current difference is determined as the corrected written value and written again until the absolute value of the difference is less than the preset error value, and the current written value is output. In this way, during data communication, the compensation value of each written value is quickly and accurately checked, and the error of the written value is automatically corrected, so that the output value matches the target written value, which reduces the error rate of data verification and greatly improves data communication efficiency.
结合图6,本公开实施例提供了一种用于数据通信中数据写入的装置600,包括:In conjunction with FIG6 , an embodiment of the present disclosure provides a device 600 for writing data in data communication, including:
处理器(processor)1000和存储器(memory)1001,还可以包括通信接口(Communication Interface)1002和总线1003。其中,处理器1000、通信接口1002、存储器1001可以通过总线1003完成相互间的通信。通信接口1002可以用于信息传输。处理器1000可以调用存储器1001中的逻辑指令,以执行上述实施例的用于数据通信中数据写入的方法。The processor 1000 and the memory 1001 may also include a communication interface 1002 and a bus 1003. The processor 1000, the communication interface 1002, and the memory 1001 may communicate with each other through the bus 1003. The communication interface 1002 may be used for information transmission. The processor 1000 may call the logic instructions in the memory 1001 to execute the method for writing data in data communication of the above embodiment.
此外,上述的存储器1001中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。In addition, the logic instructions in the above-mentioned memory 1001 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
存储器1001作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序,如本公开实施例中的方法对应的程序指令/模块。处理器1000通过运行存储在存储器1001中的程序指令/模块,从而执行功能应用以及数据处理,即实现上述方法实施例中的用于数据通信中数据写入的方法。The memory 1001 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions/modules corresponding to the methods in the embodiments of the present disclosure. The processor 1000 executes functional applications and data processing by running the program instructions/modules stored in the memory 1001, that is, implements the method for writing data in data communication in the above method embodiment.
存储器1001可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端设备的使用所创建的数据等。此外,存储器1001可以包括高速随机存取存储器,还可以包括非易失性存储器。The memory 1001 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 1001 may include a high-speed random access memory and may also include a non-volatile memory.
本公开实施例提供了一种用于数据通信中数据写入装置,包括:处理器和存储有程序指令的存储器,处理器被配置为在执行程序指令时,执行用于数据通信中数据写入方法。An embodiment of the present disclosure provides a data writing device for data communication, comprising: a processor and a memory storing program instructions, wherein the processor is configured to execute a data writing method for data communication when executing the program instructions.
结合图7,本公开实施例提供了一种设备700,包括:设备本体,以及上述用于数据通信中数据写入装置400(600)。用于数据通信中数据写入装置400(600)被安装于所述设备本体。这里所表述的安装关系,并不仅限于在产品内部放置,还包括了与产品的其他元器件的安装连接,包括但不限于物理连接、电性连接或者信号传输连接等。本领域技术人员可以理解的是,用于数据通信中数据写入装置400(600)可以适配于可行的设备主体,进而实现其他可行的实施例。In conjunction with Figure 7, an embodiment of the present disclosure provides a device 700, including: a device body, and the above-mentioned data writing device 400 (600) for data communication. The data writing device 400 (600) for data communication is installed in the device body. The installation relationship described here is not limited to placement inside the product, but also includes installation connections with other components of the product, including but not limited to physical connections, electrical connections or signal transmission connections. It can be understood by those skilled in the art that the data writing device 400 (600) for data communication can be adapted to a feasible device body, thereby realizing other feasible embodiments.
本公开实施例提供了一种存储介质,存储有程序指令,所述程序指令在运行时,执行如上述用于数据通信中数据写入的方法。An embodiment of the present disclosure provides a storage medium storing program instructions, wherein the program instructions, when executed, execute the above-mentioned method for writing data in data communication.
本公开实施例提供了一种计算机程序产品,所述计算机程序产品包括存储在存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行上述用于数据通信中数据写入方法。An embodiment of the present disclosure provides a computer program product, which includes a computer program stored on a storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the above-mentioned data writing method for data communication.
上述的存储介质可以是暂态计算机可读存储介质,也可以是非暂态计算机可读存储介质。The above-mentioned storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
本公开实施例的技术方案可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括一个或多个指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开实施例所述方法的全部或部分步骤。而前述的存储介质可以是非暂态存储介质,包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等多种可以存储程序代码的介质,也可以是暂态存储介质。The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, or a transient storage medium.
以上描述和附图充分地示出了本公开的实施例,以使本领域的技术人员能够实践它们。其他实施例可以包括结构的、逻辑的、电气的、过程的以及其他的改变。实施例仅代表可能的变化。除非明确要求,否则单独的部件和功能是可选的,并且操作的顺序可以变化。一些实施例的部分和特征可以被包括在或替换其他实施例的部分和特征。本公开实施例的范围包括权利要求书的整个范围,以及权利要求书的所有可获得的等同物。当用于本申请中时,虽然术语“第一”、“第二”等可能会在本申请中使用以描述各元件,但这些元件不应受到这些术语的限制。这些术语仅用于将一个元件与另一个元件区别开。比如,在不改变描述的含义的情况下,第一元件可以叫做第二元件,并且同样第,第二元件可以叫做第一元件,只要所有出现的“第一元件”一致重命名并且所有出现的“第二元件”一致重命名即可。第一元件和第二元件都是元件,但可以不是相同的元件。而且,本申请中使用的用词仅用于描述实施例并且不用于限制权利要求。如在实施例以及权利要求的描述中使用的,除非上下文清楚地表明,否则单数形式的“一个”(a)、“一个”(an)和“所述”(the)旨在同样包括复数形式。类似地,如在本申请中所使用的术语“和/或”是指包含一个或一个以上相关联的列出的任何以及所有可能的组合。另外,当用于本申请中时,术语“包括”(comprise)及其变型“包括”(comprises)和/或包括(comprising)等指陈述的特征、整体、步骤、操作、元素,和/或组件的存在,但不排除一个或一个以上其它特征、整体、步骤、操作、元素、组件和/或这些的分组的存在或添加。在没有更多限制的情况下,由语句“包括一个…”限定的要素,并不排除在包括所述要素的过程、方法或者设备中还存在另外的相同要素。本文中,每个实施例重点说明的可以是与其他实施例的不同之处,各个实施例之间相同相似部分可以互相参见。对于实施例公开的方法、产品等而言,如果其与实施例公开的方法部分相对应,那么相关之处可以参见方法部分的描述。The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible changes. Unless explicitly required, individual components and functions are optional, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of the present disclosure includes the entire scope of the claims, and all available equivalents of the claims. When used in this application, although the terms "first", "second", etc. may be used in this application to describe each element, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, without changing the meaning of the description, the first element can be called the second element, and similarly, the second element can be called the first element, as long as all occurrences of the "first element" are renamed consistently and all occurrences of the "second element" are renamed consistently. The first element and the second element are both elements, but may not be the same element. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms "a", "an" and "the" are intended to include the plural forms as well. Similarly, the term "and/or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and/or comprising refer to the presence of stated features, wholes, steps, operations, elements, and/or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and/or groups of these. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method or device including the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
本领域技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,可以取决于技术方案的特定应用和设计约束条件。所述技术人员可以对每个特定的应用来使用不同方法以实现所描述的功能,但是这种实现不应认为超出本公开实施例的范围。所述技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
本文所披露的实施例中,所揭露的方法、产品(包括但不限于装置、设备等),可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,可以仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例。另外,在本公开实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
附图中的流程图和框图显示了根据本公开实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这可以依所涉及的功能而定。在附图中的流程图和框图所对应的描述中,不同的方框所对应的操作或步骤也可以以不同于描述中所披露的顺序发生,有时不同的操作或步骤之间不存在特定的顺序。例如,两个连续的操作或步骤实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这可以依所涉及的功能而定。框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310122239.5A CN118509275A (en) | 2023-02-16 | 2023-02-16 | Method, device, equipment and storage medium for data writing in data communication |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310122239.5A CN118509275A (en) | 2023-02-16 | 2023-02-16 | Method, device, equipment and storage medium for data writing in data communication |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118509275A true CN118509275A (en) | 2024-08-16 |
Family
ID=92240268
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310122239.5A Pending CN118509275A (en) | 2023-02-16 | 2023-02-16 | Method, device, equipment and storage medium for data writing in data communication |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118509275A (en) |
-
2023
- 2023-02-16 CN CN202310122239.5A patent/CN118509275A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9015695B2 (en) | Information processing apparatus and information processing method | |
CN105718281B (en) | A kind of touch screen firmware upgrade method and device | |
CN107193560B (en) | Configuration updating method and device | |
JP2008090433A (en) | Memory controller, memory system and data transfer method | |
CN111338662A (en) | Firmware upgrading method and device for slave station and terminal | |
US10353370B2 (en) | Programmable logic controller, control method thereof and contorl program thereof | |
CN104679685A (en) | Access method of baseboard management controller | |
CN111208933A (en) | Data access method, device, equipment and storage medium | |
US20120271983A1 (en) | Computing device and data synchronization method | |
CN105205142A (en) | Method, device and mobile terminal for saving log file | |
US9891986B2 (en) | System and method for performing bus transactions | |
CN111190621A (en) | Firmware burning method, device, system, terminal device and storage medium | |
CN113272785B (en) | Method for mounting file system, terminal equipment and storage medium | |
US20130332629A1 (en) | Configuration controller and configuration control method | |
KR20150072963A (en) | Multisystem, and method of booting the same | |
CN118509275A (en) | Method, device, equipment and storage medium for data writing in data communication | |
EP3891594B1 (en) | Memory control system with a sequence processing unit | |
JP5111020B2 (en) | Image processing apparatus and control method thereof | |
CN103761203A (en) | General connection method for different types of hardware equipment | |
CN113434178B (en) | Programmable multiphase power supply online upgrading method, device, equipment and storage medium | |
US20150143015A1 (en) | Dma controller and data readout device | |
US8321756B2 (en) | Error detection code memory module | |
CN107977282B (en) | Method and device for reading data page by SPI-Nand | |
CN117850662A (en) | Method, device, electronic device and storage medium for data updating | |
CN110046120B (en) | Data processing method, device and system based on IIC protocol and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |