Data processing method, electronic equipment and storage medium
By analyzing the key information of data requests and generating corresponding communication protocol requests, combined with business link list management, the business blockage problem caused by the Pocket module under synchronous operation is solved, and data processing efficiency and interactive flexibility are improved.
Patent Information
- Application Number
- CN202411666735.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, when receiving data requests from cloud platforms or local applications, the Pocket module will cause service blockage caused by synchronization operations due to the influence of mutex locks, which will affect data processing efficiency.
By analyzing the first key information of the first data request, a second data request is generated according to the first communication protocol, and a linked list node is constructed in the preset business linked list to realize asynchronous operations to avoid traffic jams.
It improves the interaction efficiency between the Pocket module and the inverter, reduces the time to wait for a response, enhances the processing capability of different services, and avoids response blockage.
Smart Images

Figure CN119415523A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a data processing method, an electronic device and a storage medium. Background Art
[0002] The device achieves functional enhancement or expansion through a pocket module that can be inserted or embedded into the device. For example, the pocket module can be used as a communication medium between the inverter and the cloud platform or local application. The pocket module receives data requests from the cloud platform or local application, requests data from the inverter and reports the data to the cloud platform or local application. The data processing in this process is performed synchronously, that is, after the pocket module receives the data request from the cloud platform or local application, the pocket module triggers the inverter to feedback data according to the data request. While waiting for the inverter to feedback data, due to the influence of the mutex lock, the pocket module cannot receive other data requests from the cloud platform or local application, nor can it report other data of the inverter to the cloud platform or local application, resulting in response blocking and affecting data processing efficiency. Summary of the invention
[0003] The embodiments of the present application disclose a data processing method, an electronic device and a storage medium, which solve the technical problem of low data processing efficiency in related technical solutions.
[0004] The present application provides a data processing method, which is applied to a first electronic device, wherein the first electronic device is connected to a second electronic device and an inverter, and the method includes: receiving a first data request from the second electronic device, and parsing first key information of the first data request; generating a second data request according to a first communication protocol and the first key information, wherein the first communication protocol is determined according to a business type corresponding to the first key information; sending the second data request to the inverter, and constructing a first linked list node in a preset business linked list based on a first business identifier of the first communication protocol; receiving a first data packet sent by the inverter, and determining a second business identifier based on the first data packet; if the first business identifier matches the second business identifier, generating a second data packet according to the first data packet and annotation information in the first linked list node, wherein the annotation information is determined according to the first data request; and sending the second data packet to the second electronic device.
[0005] In some embodiments of the present application, the method for generating the first service identifier includes: parsing a first command code and a first function code of the first communication protocol; and generating the first service identifier according to the first command code and the first function code.
[0006] In some embodiments of the present application, determining the second service identifier based on the first data packet includes: parsing the packet header of the first data packet to obtain the second communication protocol corresponding to the first data packet; parsing the second command code and the second function code of the second communication protocol; and generating the second service identifier based on the second command code and the second function code.
[0007] In some embodiments of the present application, after the first service identifier matches the second service identifier, the method further includes: storing the first data packet in the data field of the first linked list node; using the callback function of the first linked list node to send the first data packet and the annotation information to the communication management unit of the first electronic device, the communication management unit being used to report data to the second electronic device; and deleting the first linked list node from the service linked list.
[0008] In some embodiments of the present application, generating a second data packet based on the first data packet and the annotation information in the first linked list node includes: using the communication management unit to parse the first data packet and the second key information of the annotation information; generating the second data packet based on a third communication protocol and the second key information.
[0009] In some embodiments of the present application, the method also includes: querying the time threshold of each linked list node in the business linked list according to a preset period; if the first data packet is not received within the time threshold of the first linked list node, deleting the first linked list node; and sending an abnormal result to the second electronic device.
[0010] In some embodiments of the present application, the method also includes: setting multiple query cycles within a preset data reporting time; sending a third data request to the inverter within each query cycle, and receiving a third data packet sent by the inverter; determining a target data packet from multiple third data packets based on the data reporting time, the reception time of the target data packet being later than the non-target data packets in the multiple third data packets; and sending the target data packet to the second electronic device.
[0011] In some embodiments of the present application, after receiving the third data packet sent by the inverter, the method further includes: determining a third service identifier based on the third data packet; if a second linked list node matching the third service identifier is found in the service linked list, storing the third data packet in a database, and deleting the second linked list node from the service linked list.
[0012] The present application also provides an electronic device, which includes a processor and a memory, and the processor is used to implement the data processing method when executing a computer program stored in the memory.
[0013] The present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the data processing method is implemented.
[0014] The data processing method provided in the present application is applied to a first electronic device, which is connected to a second electronic device and an inverter, wherein the first electronic device may be a pocket module, and the second electronic device may be a device deployed with a cloud platform or a local application. The first electronic device receives a first data request from a second electronic device, and in order to establish interaction between the first electronic device and the inverter, parses the first key information of the first data request, thereby generating a second data request according to the first communication protocol and the first key information. Among them, the first communication protocol is determined according to the business type corresponding to the first key information, indicating that the first electronic device uses the first communication protocol to interact with the inverter for the business type of the first key information. By binding different business types with different communication protocols, different business types can be distinguished according to the communication protocol. In addition, the first electronic device, as an interactive medium between the second device and the inverter, when receiving the first data request from the second electronic device, in order to avoid binding with a unique protocol and using business congestion caused by synchronous operation, determines the first communication protocol according to the business type corresponding to the first key information, so that the interaction between the first electronic device and the inverter depends on the first communication protocol, and realizes the purpose of layered processing according to the communication protocol, and increases the flexibility of interaction between the first electronic device, the second electronic device and the inverter. In addition, asynchronous operation of different businesses avoids business congestion.
[0015] A second data request is sent to the inverter, and a first linked list node is constructed in a preset business linked list based on the first business identifier of the first communication protocol. Since different businesses can be distinguished according to different communication protocols, the linked list nodes corresponding to different businesses can be managed through the business linked list, so that the first electronic device can process different businesses at the same time, that is, asynchronously process different businesses. The first electronic device receives the first data packet sent by the inverter, and determines the second business identifier based on the first data packet. If the first business identifier matches the second business identifier, it means that there is a linked list node matching the second business identifier in the business linked list, and the linked list node is the first linked list node. By matching the first business identifier with the second business identifier, the same business can be associated, so that the first device can determine that the response to the second data request from the inverter is received, thereby improving the accuracy of the first device receiving the first data packet fed back by the inverter, and reducing the waiting time for the response by establishing a linked list node.
[0016] A second data packet is generated based on the first data packet and the annotation information in the first linked list node, the annotation information is determined based on the first data request, and the annotation information corresponding to the second electronic device is combined with the first data packet received from the inverter, so that the second electronic device determines that a response corresponding to the first data request has been received by identifying the annotation information of the second data packet. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of an application scenario of the data processing method provided in an embodiment of the present application.
[0018] Figure 2 It is a flow chart of the data processing method provided in the embodiment of the present application.
[0019] Figure 3 It is a schematic diagram of data layering processing provided in an embodiment of the present application.
[0020] Figure 4 It is a flowchart of a data processing method provided by another embodiment of the present application. DETAILED DESCRIPTION
[0021] To facilitate understanding, some illustrations of concepts related to the embodiments of the present application are given by way of example for reference.
[0022] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0023] Due to business needs, pocket modules are usually used as a communication medium between the inverter and the cloud platform or local application. The pocket module can be a network card device that can obtain data from the inverter and report the inverter data to the cloud platform or local application, so that the cloud platform can monitor the operation of the inverter and the device status of the inverter. The pocket module can also receive data requests from the cloud platform or local application.
[0024] At present, the interaction between the cloud platform or local application, pocket module and inverter is carried out synchronously, which is easy to cause communication blockage and may also cause misplaced responses. In one example, take the interaction between the cloud platform, pocket module and inverter as an example. When the pocket module receives the setting command from the cloud platform, it forwards the setting command to the inverter through serial communication. During the forwarding process, the pocket module needs to convert the command in the message queue telemetry transport (Message Queuing Telemetry Transport, MQTT) format into a format recognizable by the inverter. After the pocket module sends a command to the inverter, the pocket module starts to block and wait for the inverter's response. During the blocking waiting period, in order to avoid interference from other communications, the message queue telemetry transport (Message Queuing Telemetry Transport, MQTT) mutex is usually used to maintain the command. After the pocket module receives the inverter's response, the pocket module directly parses the inverter's data in the inverter data parsing thread, and then reports the parsed data to the cloud platform. Since it is a synchronous operation, it needs to rely on the MQTT mutex lock, which makes it impossible to process other data requests, causing response blocking and affecting data processing efficiency.
[0025] In addition, in the related art, modular programming is performed according to business classification, and each business module constructs a complete protocol frame for its own business, resulting in a large amount of redundant code.
[0026] In order to solve the problems of low data processing efficiency and the appearance of a large amount of redundant code, an embodiment of the present application provides a data processing method, an electronic device and a storage medium. The application scenario of the data processing method of the present application is first described below.
[0027] Figure 1 1 is a schematic diagram of an application scenario of the data processing method provided in the embodiment of the present application. The data processing method provided in the embodiment of the present application is applied to an electronic device 10, and the electronic device 10 is connected to an electronic device 20 and an inverter 30. The electronic device 10 includes a communication management unit 110, a memory 120 and at least one processor 130.
[0028] The electronic device 10 may be a pocket module, serving as a communication medium between the electronic device 20 and the inverter 30. The communication management unit 110 may be a functional module in the electronic device 10, used for parsing data, reporting data, and the like.
[0029] The memory 120 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM). The random access memory can be directly read and written by the processor 130, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data. The random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc.
[0030] The non-volatile memory may also store executable programs and user and application data, etc., and may be pre-loaded into the random access memory for direct reading and writing by the processor 130. The non-volatile memory may include a disk storage device and a flash memory.
[0031] The memory 120 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 130. The one or more computer programs include multiple instructions. When the multiple instructions are executed by the processor 130, the data processing method executed on the energy storage device 10 can be implemented.
[0032] In other embodiments, the energy storage device 10 further includes an external memory interface for connecting to an external memory to expand the storage capacity of the energy storage device 10 .
[0033] The processor 130 may include one or more processing units, for example, the processor 130 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0034] The processor 130 provides computing and control capabilities. For example, the processor 130 is used to execute a computer program stored in the memory 120 to implement the above-mentioned data processing method.
[0035] The electronic device 20 may be a server on which a cloud platform is deployed, or a terminal device including an application program, which is not limited in the present application.
[0036] In one example, the electronic device 10 can receive a data request sent by the electronic device 20, and can also report the data of the inverter 30 to the electronic device 20. When the electronic device 10 receives the first data request of the electronic device 20, the first data request can be parsed and a second data request can be generated through the communication management unit 110, and then the second data request can be sent to the inverter 30. In addition, a first linked list node is added to the service linked list, and the first linked list node includes a first service identifier of the first communication protocol corresponding to the second data request, which is used to distinguish different services. When the electronic device 10 receives the first data packet fed back by the inverter 30, it starts to search the service linked list. If the second service identifier of the first data packet matches the first service identifier, it is determined that the first data packet is the data to be obtained by the first data request. The first data packet, the annotation information in the first linked list node, and the third communication protocol are encapsulated into a second data packet through the communication management unit 110 and reported to the electronic device 20, so that the electronic device 20 can distinguish different services through the annotation information.
[0037] The indication Figure 1 This is only an example of an application scenario and does not constitute a limitation on the use scenario of the electronic device 10. The electronic device 10 can be used in any environment with data processing requirements, and this application does not limit this.
[0038] The following is a detailed description of the embodiments of the present application.
[0039] Figure 2is a flow chart of a data processing method provided in an embodiment of the present application, which is applied to a first electronic device (eg Figure 1 According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0040] Step S201: receiving a first data request from a second electronic device, and parsing first key information of the first data request.
[0041] In some embodiments of the present application, the second electronic device may be Figure 1 The electronic device 20 shown. The first data request may be a setting request, which may be an operation requesting to change or configure the system state. For example, device parameter update, server configuration modification, etc. The first data request may also be a query request, which may be an operation requesting to obtain the current state of the device or related data. For example, checking the device operation status, obtaining server logs, etc.
[0042] In addition, the first data request may also be any one of the following requests: POST request, PUT request, DELETE request, PATCH request, OPTIONS request, etc. Among them, the POST request can be used to submit data to create a new resource, such as login, registration, etc.; the PUT request is used to update an existing resource or create a new resource; the DELETE request is used to delete a specified resource; the PATCH request is used to partially modify a resource; and the OPTIONS request is used to obtain a list of HTTP methods supported by the server. This application does not limit the request type for the first data request.
[0043] In some embodiments of the present application, the first electronic device includes a communication management unit. The communication management unit can parse the key fields in the first data request to obtain the first key information. The key fields can be the setting time, task identifier (task_id), etc. The first key information can be composed of multiple key fields. The present application does not limit the parsed key fields.
[0044] Step S202: Generate a second data request according to the first communication protocol and the first key information.
[0045] In some implementations of the present application, the electronic device and the inverter can interact through a variety of different communication protocols, each communication protocol can correspond to at least one business type, so that the business type of the corresponding data can be determined by parsing the communication protocol. After the communication management unit of the electronic device obtains the first key information, it can determine the protocol type according to the business type corresponding to the first key information, for example, the protocol type is the first communication protocol. After determining the first communication protocol, the communication management unit encapsulates the first key information into a data packet according to the first communication protocol, and uses the data packet as the second data request.
[0046] Step S203: Send a second data request to the inverter, and construct a first linked list node in a preset service linked list based on a first service identifier of the first communication protocol.
[0047] In some implementations of the present application, the communication management unit may send a second data request to the inverter, so that the inverter can feedback a corresponding response result in response to the second data request. In addition, since the first communication protocol represents a certain business type, the first communication protocol can be parsed to generate a first business identifier (bid), so that a first linked list node can be constructed in a preset business linked list according to the first business identifier. Among them, the business linked list is a data structure for storing and managing a series of business data or tasks. Multiple linked list nodes can be registered on the business linked list at the same time, and each linked list node represents a different business type.
[0048] In some implementations of the present application, parsing the first communication protocol and generating the first service identifier includes: the command code and the function code in the communication protocol are used to identify a specific operation or instruction, and the first command code and the first function code of the first communication protocol can be parsed, thereby generating the first service identifier according to the first command code and the first function code. Specifically, the first service identifier can be generated according to the lower 6 bits of the first command code and the first function code, and the type of the first service identifier can be uint16_t.
[0049] In one example, the first command code is 0x81 and the first function code is 0x23. Extract the lower 6 bits of 0x81: 0x81&0x3F=0x01; extract the lower 6 bits of 0x23: 0x23&0x3F=0x23. In order to combine 0x01 and 0x23, the first command code can be shifted left by 6 bits: (0x01<<6)|0x23=0x123, and the first service identifier is 0x123. Register 0x123 as the first linked list node in the service linked list.
[0050] Step S204: receiving a first data packet sent by the inverter, and determining a second service identifier based on the first data packet.
[0051] In some implementations of the present application, an electronic device receives a first data packet from an inverter, and the header of the first data packet generally includes a protocol type. Then, by parsing the header of the first data packet, it can be obtained that the protocol of the first data packet is the second communication protocol. In order to determine the service type of the first data packet, the second communication protocol can be parsed, and specifically, the second communication protocol is parsed to obtain a second command code and a second function code. A second service identifier is generated based on the second command code and the second function code. The second service identifier can be composed of the lower 6 bits of the second command code and the second function code. The generation process of the second service identifier is the same as that of the first service identifier, and will not be described by way of example here.
[0052] Step S205: if the first service identifier matches the second service identifier, a second data packet is generated according to the first data packet and the annotation information in the first linked list node.
[0053] In some embodiments of the present application, the service chain list includes multiple chain list nodes, each chain list node corresponds to a service identifier, so after determining the second service identifier, the chain list node matching the second service identifier can be searched in the service chain list. If the first service identifier matches the second service identifier, it means that the second service identifier matches the first chain list node.
[0054] In some embodiments of the present application, the first linked list node may include a data domain, annotation information, a time threshold, a callback function, and the like. After the first linked list node is determined, the first data packet may be stored in the data domain, and the callback function is triggered to send the first data packet and the annotation information in the data domain to the communication management unit. The communication management unit is used to report data to the second electronic device. After the callback function is triggered, the first linked list node may be deleted from the business linked list to release the storage space of the business linked list. In the communication management unit, the first data packet and the second key information of the annotation information may be parsed to obtain a third communication protocol for interaction between the first electronic device and the second electronic device. A second data packet is generated according to the third communication protocol and the second key information.
[0055] In addition, the electronic device may periodically poll the time threshold corresponding to each link table node in the service link table. Taking the time threshold corresponding to the first link table node as an example, if the first data packet is not received within the time threshold, it means that the inverter does not respond within the time threshold, and the first link table node may be deleted. And, the abnormal result is sent to the second electronic device.
[0056] Step S206: Send a second data packet to a second electronic device.
[0057] In some embodiments of the present application, the first electronic device receives the first data request of the second electronic device. Assuming that the first data request is a setting request, it is usually for changing the state or configuration of the inverter. The first electronic device sends the second data packet to the second electronic device, usually to determine the operation result, monitor the device status, error handling and debugging, and ensure data synchronization. Therefore, the first electronic device sends the second data packet to the second electronic device to confirm the setting of the inverter, which improves the overall communication efficiency.
[0058] In an embodiment of the present application, a first electronic device receives a first data request from a second electronic device, and in order to establish interaction between the first electronic device and the inverter, the first key information of the first data request is parsed, thereby generating a second data request according to the first communication protocol and the first key information. The first communication protocol is determined according to the business type corresponding to the first key information, indicating that for the business type of the first key information, the first electronic device uses the first communication protocol to interact with the inverter. By binding different business types to different communication protocols, different business types can be distinguished according to the communication protocol.
[0059] A second data request is sent to the inverter, and a first linked list node is constructed in a preset business linked list based on the first business identifier of the first communication protocol. Since different businesses can be distinguished according to different communication protocols, the linked list nodes corresponding to different businesses can be managed through the business linked list, so that the first electronic device can process different businesses at the same time. The first electronic device receives the first data packet sent by the inverter, and determines the second business identifier based on the first data packet. If the first business identifier matches the second business identifier, it means that there is a linked list node matching the second business identifier in the business linked list, and the linked list node is the first linked list node. By matching the first business identifier with the second business identifier, the same business can be associated, so that the first device can determine that the response to the second data request from the inverter is received, thereby improving the accuracy of the first device receiving the first data packet fed back by the inverter, and reducing the waiting time for the response by establishing a linked list node.
[0060] Generate a second data packet based on the first data packet and the annotation information in the first linked list node, the annotation information is determined according to the first data request, and by combining the annotation information corresponding to the second electronic device with the first data packet received from the inverter, the second electronic device determines that it has received a response corresponding to the first data request by identifying the annotation information of the second data packet. Combined with the characteristics of the communication protocol and referring to the network layer architecture, the data is processed by protocol layering to increase the portability of the code. Figure 3 Describe in detail the process of hierarchical data processing.
[0061] Figure 3is a schematic diagram of data layering processing provided by an embodiment of the present application, such as Figure 3 As shown, the cloud platform distributes messages according to topics, where, in the MQTT protocol, Topics are used to define the channels and paths for message transmission. The cloud platform further classifies messages according to the main package function code of the protocol. Then, the cloud platform processes the messages more carefully according to the type of sub-packets. Finally, the processed message is sent to the first electronic device as a first data request. The first electronic device extracts the first key information of the first data request through the communication management unit, and constructs an inverter request message and a data field for storing inverter data through the first key information. Based on the first communication protocol, a protocol header and checksum (AA55 protocol) are added to the inverter request message and the data field to generate a second data request. According to the first service identifier of the first communication protocol, the first linked list node is registered in the service linked list, and the second data request is sent to the inverter.
[0062] The first electronic device receives the first data packet through the inverter serial port, and then identifies the first data packet and matches the service identifier. When the first service identifier matches the second service identifier, the communication management unit is used to parse the first data packet and the second key information of the annotation information. Then, based on the second key information, a data domain reported to the cloud platform is constructed, and a protocol header and checksum (2424 protocol) are added to the data domain carrying the second key information to generate a second data packet. The second data packet is reported to the cloud platform.
[0063] Through Figure 3 The layered processing shown can increase the portability of the code. For example, when adapting the third-party protocol 20305, only the relevant content of 20305, that is, the sub-packet data field in the 2424 protocol, is concerned. Even if the interaction protocol between the first electronic device and the inverter, or the interaction protocol between the first electronic device and the second electronic device changes, there is no need for excessive modification.
[0064] Figure 4 is a flowchart of a data processing method provided by another embodiment of the present application. Figure 2 As shown, the process may be triggered by the first electronic device according to the first data request received from the second electronic device, and as shown Figure 4 The figure shows a process in which the first electronic device actively reports data to the second electronic device according to a preset data reporting time, including the following steps: Step S401, setting a plurality of query cycles within a preset data reporting time.
[0065] In some embodiments of the present application, in order to monitor the operating status of the inverter, the data of the inverter can be periodically obtained. Therefore, the data reporting time can be pre-set in the first device. The data reporting time can be set periodically, for example, the data reporting time is set every 5 minutes. This application is not limited to this.
[0066] In some embodiments of the present application, in order to avoid abnormal situations such as packet loss, multiple query cycles can be set within the preset data reporting time, so that corresponding data can be obtained in each query cycle, and a query cycle can be set every 5 seconds.
[0067] Step S402: sending a third data request to the inverter in each query cycle, and receiving a third data packet sent by the inverter.
[0068] In some embodiments of the present application, the same third data request can be sent in each query cycle to obtain request data corresponding to multiple third data requests within a preset data reporting time. When a third data packet sent by the inverter is received, the header of the third data packet is parsed to obtain a protocol, and the protocol is recorded as a fourth protocol. The command code and the lower 6 bits of the function code of the fourth protocol are parsed to obtain a parsing result. A third service identifier is generated based on the parsing result. If a second linked list node matching the third service identifier is found in the service linked list, the third data packet is sent to the communication management unit and the second linked list node is deleted from the service linked list. The third data packet is stored in the database using the communication management unit.
[0069] Step S403: determining a target data packet from a plurality of third data packets according to the data reporting time.
[0070] In some embodiments of the present application, when the data reporting time is reached, the communication management unit obtains multiple third data packets from the database, and determines a target data packet from the third data packets according to the reception time of the multiple third data packets, and the reception time of the target data packet is later than that of the non-target data packets in the multiple third data packets.
[0071] Step S404: sending the target data packet to the second electronic device.
[0072] In some embodiments of the present application, after the first electronic device obtains the target data packet, it can send the target data packet to the second electronic device based on the protocol for interaction between the first electronic device and the second electronic device. The second electronic device can periodically monitor the operation of the inverter through the target data packet.
[0073] In the embodiment of the present application, by regularly triggering the first electronic device to feed back corresponding inverter data, the purpose of periodically monitoring the inverter can be achieved. In addition, by processing data in layers, the portability of the code can be increased.
[0074] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the methods in the above-mentioned embodiments of the present application.
[0075] The computer-readable storage medium may be an internal memory of the energy storage device described in the above embodiment, such as a hard disk or memory of the energy storage device. The computer-readable storage medium may also be an external storage device of the energy storage device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the energy storage device.
[0076] In some embodiments, the computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the energy storage device, etc.
[0077] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0078] Those of ordinary skill 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 depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0079] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is 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. Another point is that the mutual coupling or direct coupling or communication connection 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.
[0080] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0081] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data processing method, applied to a first electronic device, characterized in that: The first electronic device is connected to the second electronic device and an inverter, and the method includes: receiving a first data request from the second electronic device, and parsing first key information of the first data request; generating a second data request according to a first communication protocol and the first key information, wherein the first communication protocol is determined according to a service type corresponding to the first key information; Sending the second data request to the inverter, and constructing a first linked list node in a preset service linked list based on the first service identifier of the first communication protocol; receiving a first data packet sent by the inverter, and determining a second service identifier based on the first data packet; If the first service identifier matches the second service identifier, generating a second data packet according to the first data packet and annotation information in the first linked list node, wherein the annotation information is determined according to the first data request; The second data packet is sent to the second electronic device.
2. The data processing method according to claim 1, characterized in that: The method for generating the first service identifier includes: Parsing a first command code and a first function code of the first communication protocol; The first service identifier is generated according to the first command code and the first function code.
3. The data processing method according to claim 1, characterized in that: The determining the second service identifier based on the first data packet includes: Parsing the header of the first data packet to obtain a second communication protocol corresponding to the first data packet; Parsing a second command code and a second function code of the second communication protocol; The second service identifier is generated according to the second command code and the second function code.
4. The data processing method according to claim 1, characterized in that: After the first service identifier matches the second service identifier, the method further includes: Storing the first data packet in the data field of the first linked list node; Using the callback function of the first linked list node, the first data packet and the annotation information are sent to the communication management unit of the first electronic device, and the communication management unit is used to report data to the second electronic device; Delete the first linked list node from the service linked list.
5. The data processing method according to claim 4, characterized in that: The generating a second data packet according to the first data packet and the annotation information in the first linked list node includes: parsing the first data packet and the second key information of the annotation information using the communication management unit; Generate the second data packet according to the third communication protocol and the second key information.
6. The data processing method according to claim 4, characterized in that: The method further comprises: Query the time threshold of each link table node in the service link table according to a preset period; If the first data packet is not received within the time threshold of the first linked list node, deleting the first linked list node; The abnormal result is sent to the second electronic device.
7. The data processing method according to claim 1, characterized in that: The method further comprises: Set multiple query cycles within the preset data reporting time; Sending a third data request to the inverter in each query cycle, and receiving a third data packet sent by the inverter; Determine a target data packet from a plurality of third data packets according to the data reporting time, wherein the receiving time of the target data packet is later than the non-target data packets in the plurality of third data packets; The target data packet is sent to the second electronic device.
8. The data processing method according to claim 7, characterized in that: After receiving the third data packet sent by the inverter, the method further includes: Determine a third service identifier based on the third data packet; If a second linked list node matching the third service identifier is found in the service linked list, the third data packet is stored in a database, and the second linked list node is deleted from the service linked list.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the data processing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the data processing method according to any one of claims 1 to 8 is implemented.