Communication method, communication chip, electronic device and computer readable storage medium

By separating the universal serial port protocol from the device description file, the existing serial port protocol design differences and poor versatility problems are solved, the protocol's high versatility and scalability are achieved, the data type expansion process is simplified, and manpower and material resources are saved.

CN115801920BActive Publication Date: 2025-01-17ECOFLOW INC
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211255051.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-13
Publication Date
2025-01-17
Estimated Expiration
2042-10-13

AI Technical Summary

Technical Problem

The existing serial port protocol design is aimed at specific equipment, with great differences, poor versatility and scalability, resulting in the need to redesign and test the protocol when it is necessary to transmit new data types, which consumes a lot of manpower and material resources.

Method used

Separate the universal serial port protocol from the device description file. The universal serial port protocol is responsible for content other than the message body parsing rules, and the device description file is responsible for the message body parsing rules. Receive messages through a universal serial port protocol, obtain the device description file, parse the message body, and implement data transmission.

Benefits of technology

It improves the versatility and scalability of the serial port protocol, eliminates the need to design different serial port protocols for different devices, simplifies the data type expansion process, and saves manpower and material resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115801920B_ABST
    Figure CN115801920B_ABST
Patent Text Reader

Abstract

The present application provides a communication method, a communication chip, an electronic device and a computer-readable storage medium, which relate to the field of Internet of Things technology, wherein the method comprises: receiving a first message sent by a first interactive party through a serial port; parsing the first message according to a universal serial port protocol to obtain a first message body in the first message; obtaining a device description file corresponding to the first interactive party, parsing the first message body according to the device description file, and obtaining first target data. The technical solution provided by the present application facilitates the expansion of the communication protocol.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Internet of Things, and in particular to a communication method, a communication chip, an electronic device and a computer-readable storage medium. Background Art

[0002] With the advent of the Internet of Things era, the application scope of the Internet of Things is becoming wider and wider, and various electronic devices are also being connected to related Internet of Things systems.

[0003] In the IoT system, electronic devices and different modules within an electronic device may communicate using a serial port protocol. For example, a main control module and a communication module (such as a Wi-Fi module) within an electronic device may communicate using a serial port protocol.

[0004] However, serial port protocols are generally designed for specific devices, and the serial port protocols corresponding to different devices vary greatly. For example, the serial port protocol of a fan is usually only suitable for transmitting the relevant parameters of the fan, which results in these serial port protocols being able to only transmit data of a certain product in a targeted manner, and having poor versatility. Moreover, these serial port protocols usually limit the types of data that can be transmitted, and have extremely poor scalability. If there is a new type of data to be transmitted, a series of heavy tasks such as redesigning the serial port protocol and testing the serial port protocol need to be carried out, which consumes a lot of manpower and material resources. Summary of the invention

[0005] In view of this, embodiments of the present application provide a communication method, a communication chip, an electronic device, and a computer-readable storage medium to facilitate the expansion of communication protocols.

[0006] In order to achieve the above objectives, in a first aspect, an embodiment of the present application provides a communication method, including:

[0007] receiving a first message sent by a first interactive party through a serial port;

[0008] Parsing the first message according to a universal serial port protocol to obtain a first message body in the first message;

[0009] A device description file corresponding to the first interactive party is obtained, and the first message body is parsed according to the device description file to obtain first target data.

[0010] As an optional implementation of the embodiment of the present application, the obtaining of the device description file corresponding to the first interaction party includes:

[0011] Obtaining a device identifier of the first interacting party;

[0012] Find the device description file corresponding to the device identifier.

[0013] As an optional implementation of the embodiment of the present application, searching for a device description file corresponding to the device identifier includes:

[0014] The device description file corresponding to the device identification is searched in the memory, and / or the device description file corresponding to the device identification is obtained from the server.

[0015] As an optional implementation of the embodiment of the present application, after obtaining the first target data, the method further includes:

[0016] The first target data is sent to the second interacting party.

[0017] As an optional implementation of the embodiment of the present application, the method further includes:

[0018] receiving second target data sent by the second interaction party;

[0019] converting the second target data into a second message according to the device description file;

[0020] The second message is sent to the first interactive party through the serial port.

[0021] As an optional implementation of the embodiment of the present application, the device description file is written according to the json format.

[0022] In a second aspect, an embodiment of the present application provides a communication device, including:

[0023] Receiving module: used for receiving a first message sent by a first interactive party through a serial port;

[0024] Parsing module: used for parsing the first message according to the universal serial port protocol to obtain the first message body in the first message;

[0025] An acquisition module: used for acquiring a device description file corresponding to the first interaction party;

[0026] The parsing module is further configured to parse the first message body according to the device description file acquired by the acquisition module to obtain first target data.

[0027] In a third aspect, an embodiment of the present application provides a communication chip, comprising a memory and a processor, wherein the processor executes a computer program stored in the memory to implement the method described in the first aspect or any embodiment of the first aspect.

[0028] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a main control chip and a communication chip as described in the third aspect above, wherein the main control chip and the communication chip are connected via a serial port.

[0029] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method described in the first aspect or any one of the embodiments of the first aspect is implemented.

[0030] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the first aspect or any one of the embodiments of the first aspect is implemented.

[0031] In the communication scheme provided by the embodiment of the present application, when the electronic device (or a module in the electronic device) receives the first message sent by the first interactive party, the electronic device can parse the first message through the universal serial port protocol to obtain the first message body in the first message. Then, the electronic device can obtain the device description file corresponding to the first interactive party, parse the first message body according to the device description file, and obtain the first target data.

[0032] It should be noted that, since the main difference between different serial port protocols is the parsing rules of the message body, in the communication method provided in the embodiment of the present application, the content other than the parsing rules of the message body can be independently made into a universal serial port protocol, and the parsing rules of the message body can be independently made into a device description file. When electronic devices receive messages sent by different interactive parties through serial ports, they can all be parsed through the universal serial port protocol to determine the message body in the message. There is no need to design different serial port protocols for different devices, which can effectively improve the versatility of the universal serial port protocol. Moreover, when you want to expand the transmittable data type in the later stage, you only need to modify the corresponding device description file, and there is no need to redesign the universal serial port protocol, nor is there any need to retest the universal serial port protocol, etc., which greatly improves the extensibility of the universal serial port protocol and can save a lot of manpower and material resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of a fan serial port protocol provided in an embodiment of the present application;

[0034] Figure 2 A flow chart of a communication method provided in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of a universal serial port protocol provided in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of a device description file provided in an embodiment of the present application;

[0037] Figure 5 A flowchart of another communication method provided in an embodiment of the present application;

[0038] Figure 6 A schematic diagram of the structure of a communication device provided in an embodiment of the present application;

[0039] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0040] Figure 8 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application;

[0041] Fig. 9 A schematic diagram of the structure of a communication chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] With the advent of the Internet of Things era, the application scope of the Internet of Things is becoming larger and larger, and various electronic devices are being connected to related Internet of Things systems.

[0043] In the IoT system, electronic devices and different modules within an electronic device may communicate using a serial port protocol. For example, a main control module and a communication module (such as a Wi-Fi module) within an electronic device may communicate using a serial port protocol.

[0044] However, serial port protocols are generally designed for specific devices, such as Figure 1 In the fan serial port protocol shown in the figure, the message includes: protocol header, fan-related power on / off, wind speed, gear and other fields, while the refrigerator serial port protocol needs to include refrigerator-related temperature and other fields. This leads to large differences in the serial port protocols corresponding to different devices. A serial port protocol can usually only transmit data of a certain product in a targeted manner, and has poor versatility. Moreover, these serial port protocols usually limit the types of data that can be transmitted, and have extremely poor scalability. If there is a new type of data to be transmitted, a series of heavy tasks such as redesigning the serial port protocol and testing the serial port protocol need to be carried out, which consumes a lot of manpower and material resources.

[0045] Since the main difference between different serial port protocols is the parsing rules of device-related parameters (i.e., message bodies), the embodiment of the present application provides a communication method, which makes the contents other than the parsing rules of the message bodies independent universal serial port protocols, and makes the parsing rules of the message bodies independent device description files. In this way, when electronic devices receive messages sent by different interactive parties through serial ports, they can parse them through the universal serial port protocol, determine the message body in the message, and then parse the message body according to the corresponding device description file, without the need to design different serial port protocols for different devices, thereby effectively improving the versatility of the universal serial port protocol.

[0046] The execution subject of the communication method provided in the embodiment of the present application may be a Wi-Fi module of an electronic device, or other communication modules of the electronic device, wherein the Wi-Fi module or other communication modules may be integrated in a communication chip. This embodiment will be exemplified by taking the execution subject of the communication method as a Wi-Fi module as an example.

[0047] Figure 2 A flow chart of a communication method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method may include the following steps:

[0048] S110: Receive a first message sent by a first interactive party through a serial port.

[0049] The first interactive party may be a main control module, or may be another module that communicates with the Wi-Fi module through a serial port. The main control module may be integrated in a main control chip. This implementation will be described exemplarily by taking the first interactive party as the main control module.

[0050] In scenarios where the computing power resources / storage resources of the main control module are limited, the main control module may not have the ability to parse JSON files, etc. Therefore, in these scenarios, the main control module may send the first binary message through the serial port, thereby saving the computing power resources / storage resources of the main control module.

[0051] The first message is used for the electronic device where the main control module is located to feed back one or more of its own device operation status, control instructions or other information to the Wi-Fi module.

[0052] S120: Parse the first message according to the universal serial port protocol to obtain a first message body in the first message.

[0053] Figure 3 A schematic diagram of a universal serial port protocol provided in an embodiment of the present application, such as Figure 3 As shown, the universal serial port protocol may include a protocol header, length, command word, check bit and message body. The Wi-Fi module can parse the message (i.e., the first message) sent by the main control module of different devices through the serial port according to the universal serial port protocol to obtain different message bodies.

[0054] The format of the message body obtained after parsing is the same as the format of the first message. For example, if the first message is binary, the corresponding message body after parsing is also binary. In other words, the universal serial port protocol can be used to describe the position of the message body in the message sent by the serial port, but does not set the parsing rules of the message body.

[0055] S130: Obtain a device description file corresponding to the first interactive party, and parse the first message body according to the device description file to obtain first target data.

[0056] The device description file can define the device's identification, functions, and the data format corresponding to the functions.

[0057] Figure 4 A schematic diagram of a device description file provided in an embodiment of the present application, such as Figure 4 As shown, the device description file is in json format. The file first defines the product model of the corresponding device as A200, and then defines the device functions of the corresponding device, including power on / off and gear position. The data type corresponding to each function is defined through the type field, and the specific value corresponding to each function is defined through the value field.

[0058] The data type corresponding to the power-on function is Boolean (bool) type, with a data length of 1 byte, where 0 represents power off and 1 represents power on; the data type corresponding to the gear function is enumeration (enum) type, with a data length of 1 byte, including first gear, second gear and third gear, where 1 represents first gear, 2 represents second gear and 3 represents third gear.

[0059] The device file also defines the identifier id in the binary serial port protocol, where the id corresponding to the switch is 1, and the id corresponding to the gear position is 2. The length of the id can be set to a fixed 2 bytes.

[0060] The above is only an illustrative example of the device description file in the embodiment of the present application. In the actual application process, developers can set corresponding device description files according to the actual needs of various electronic devices. The embodiment of the present application does not limit the specific form of the device description file.

[0061] The device description file may be stored in a memory of the device or in a server. This embodiment will be described exemplarily by taking the storage of the device description file in the server as an example.

[0062] The Wi-Fi module may first obtain the device identification of the first interactive party, such as the device model, SN number, etc. Specifically, the device identification may be stored in the main control module or memory of the device, and when the device communicates with the Wi-Fi module, the Wi-Fi module may obtain the device identification from the main control module or memory of the device.

[0063] Then, according to the device identifier, the corresponding device description file is obtained from the server, and then the first message body is parsed according to the device description file.

[0064] For example, the first message body is "0x00,0x01,0x01,0x00,0x02,0x02", and the device description file is Figure 4 As shown, the Wi-Fi module first parses the first two bytes of the first message body, which are fixed as ID, and the obtained value is 0x0001, which corresponds to the power on / off function in the device description file. Then, it takes one byte to get the value of 0x01, which corresponds to power on in the description file. At this time, the first function is parsed. Then, it parses the next two bytes, which are also fixed as ID, and the obtained value is 0x0002, which corresponds to the gear position in the device description file. Then, it takes one byte to get the value of 0x02, which corresponds to the second gear in the description file. At this time, the second function is parsed. That is, the data obtained after parsing the first message body is "power on / off: power on, gear position: second gear".

[0065] Then, the parsed data can be converted into a preset format to obtain the first target data. For example, the preset format can be a json format, and the first target data can be {"on / off":"on","gear":"second gear"}. It can be understood that the first target data can also be data in other formats, and this application does not specifically limit this.

[0066] In addition, the first target data may also include a device identifier of the electronic device where the main control module is located, so that the user can distinguish the operating conditions of different electronic devices.

[0067] In some embodiments, after the Wi-Fi module acquires the first target data, the following step may further include: sending the first target data to the second interaction party.

[0068] The second interactive party may be another application (Application, APP) that communicates with the Wi-Fi module. The data format of the first target data is the data line transmission format agreed upon by the Wi-Fi module and the second interactive party. The user can view the first target data through the second interactive party to learn the operation status of the device where the main control module is located.

[0069] In some embodiments, in addition to receiving the first message sent by the first interactive party, the Wi-Fi module can also receive the second target data sent by the second interactive party, convert the second target data into a second message and send it to the first interactive party. Figure 5 , the interaction process may include the following steps:

[0070] S510: Receive second target data sent by a second interactive party.

[0071] The second target data is used to control the operation of other electronic devices, and the second target data may include device identifications of other electronic devices.

[0072] The data format of the second target data is the data transmission format agreed upon by the Wi-Fi module and the second interacting party.

[0073] For example, the second target data may be {"product model":"A200","power on / off":"power on","gear position":"third gear"}.

[0074] S520: Convert the second target data into a second message according to the device description file.

[0075] Specifically, the Wi-Fi module can obtain the corresponding device description file from the server according to the device identifier in the second target data, and then convert the second target data into a second message body according to the device description file, and then generate a second message by combining the second message body and the universal serial port protocol.

[0076] The format of the second message is specified by the universal serial port protocol, which is the data format when the main control module communicates with the Wi-Fi module through the serial port.

[0077] S530: Send a second message to the first interactive party through the serial port.

[0078] After generating the second message, the Wi-Fi module may send the second message to the main control module through the serial port.

[0079] In addition, the communication method provided by the present application can also be applied to the development and debugging of programs related to the Internet of Things. It should be noted that in the process of product development, multi-device joint debugging is required to test the communication capabilities of the product. In the previous development and debugging links, developers need to fully determine the data transmission requirements of the product before they can write the corresponding serial communication protocol according to the data transmission requirements of the product, which seriously slows down the progress of multi-device joint debugging. Even after the joint debugging, once the data transmission requirements of the product change, the developer needs to rewrite the serial communication protocol and perform multi-device joint debugging according to the rewritten serial communication protocol.

[0080] In the communication method provided by the present application, since the Wi-Fi module and the main control module communicate based on the universal serial port protocol, even if the data transmission requirements of the product are not fully determined, the Wi-Fi module and the main control module can also perform multi-device joint debugging based on the universal serial port protocol and a temporary device description file. In the later stage, if the data transmission requirements of the product change, it is only necessary to change the device description file without changing the universal serial port protocol. If the communication protocol is not modified, there is no need to re-combine multiple devices, thereby speeding up the debugging progress and saving later manpower consumption.

[0081] Even in some scenarios, even if the Wi-Fi module or main control module has not been developed or produced yet, you can use a simulator to simulate the Wi-Fi module or main control module for multi-device joint debugging based on the universal serial port protocol and a temporary device description file.

[0082] For example, when using a simulator to simulate the main control module of an electronic device, a main control simulator capable of sending a first message can be generated by parsing the device description file corresponding to the electronic device. In this way, when debugging, the developer of the Wi-Fi module can send the first message to communicate with the Wi-Fi module through the main control simulator to implement debugging between the Wi-Fi module and the main control module, thereby solving the dependence on electronic devices when debugging IoT-related programs.

[0083] When using a simulator to simulate the Wi-Fi module of an electronic device, the corresponding Wi-Fi simulator can also be generated by parsing the device description file corresponding to the electronic device and the communication protocol between the Wi-Fi module and other devices. In this way, the developer of the main control module can communicate with the main control module through the Wi-Fi simulator to debug the main control module. Developers of other electronic devices, such as developers of related applications (Application, APP) on mobile devices, can also communicate with the APP of the mobile device through the Wi-Fi simulator to debug the APP; the simulator can also generate simulators of other devices by parsing the communication protocol between the Wi-Fi module and other devices, such as the simulator of the related APP on the mobile device, so that the developer of the Wi-Fi module can directly use the APP simulator to communicate with the Wi-Fi module during debugging to debug the Wi-Fi module and APP. Through the above method, the problem of multi-terminal mutual dependence in the development and debugging of Internet of Things related programs can be solved to a certain extent, and the efficiency of development and debugging can be improved.

[0084] Those skilled in the art will appreciate that the above embodiments are exemplary and are not intended to limit the present application. Where possible, the execution order of one or more of the above steps may be adjusted, or may be selectively combined to obtain one or more other embodiments. Those skilled in the art may select and combine any of the above steps as needed, and all those that do not depart from the essence of the present application fall within the scope of protection of the present application.

[0085] In the communication scheme provided by the embodiment of the present application, when the electronic device (or a module in the electronic device) receives the first message sent by the first interactive party, the electronic device can parse the first message through the universal serial port protocol to obtain the first message body in the first message. Then, the electronic device can obtain the device description file corresponding to the first interactive party, parse the first message body according to the device description file, and obtain the first target data.

[0086] It should be noted that, since the main difference between different serial port protocols is the parsing rules of the message body, in the communication method provided in the embodiment of the present application, the content other than the parsing rules of the message body can be independently made into a universal serial port protocol, and the parsing rules of the message body can be independently made into a device description file. When electronic devices receive messages sent by different interactive parties through serial ports, they can all be parsed through the universal serial port protocol to determine the message body in the message. There is no need to design different serial port protocols for different devices, which can effectively improve the versatility of the universal serial port protocol. Moreover, when you want to expand the transmittable data type in the later stage, you only need to modify the corresponding device description file, and there is no need to redesign the universal serial port protocol, nor is there any need to retest the universal serial port protocol, etc., which greatly improves the extensibility of the universal serial port protocol and can save a lot of manpower and material resources.

[0087] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application provides a communication device, and the device embodiment corresponds to the above method embodiment. For ease of reading, the present device embodiment will no longer repeat the details of the above method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents in the above method embodiment.

[0088] Figure 6 A schematic diagram of the structure of a communication device provided in an embodiment of the present application, such as Figure 6 As shown, the communication device provided in this embodiment includes:

[0089] Receiving module 11: used to receive a first message sent by a first interactive party through a serial port;

[0090] Parsing module 12: used for parsing the first message according to the universal serial port protocol to obtain a first message body in the first message;

[0091] Acquisition module 13: used to acquire a device description file corresponding to the first interaction party;

[0092] The parsing module 12 is further configured to parse the first message body according to the device description file acquired by the acquisition module to obtain first target data.

[0093] As an optional implementation manner, the acquisition module 13 is specifically used for:

[0094] Obtaining a device identifier of the first interacting party;

[0095] Find the device description file corresponding to the device identifier.

[0096] As an optional implementation manner, the acquisition module 13 is specifically used for:

[0097] The device description file corresponding to the device identification is searched in the memory, and / or the device description file corresponding to the device identification is obtained from the server.

[0098] As an optional implementation manner, the communication device further includes:

[0099] The sending module 14 is configured to send the first target data to the second interactive party.

[0100] As an optional implementation manner, the receiving module is further used to: receive second target data sent by the second interaction party;

[0101] The parsing module 12 is also used to: convert the second target data into a second message according to the device description file;

[0102] The sending module 14 is further configured to send the second message to the first interacting party through the serial port.

[0103] As an optional implementation, the device description file is written according to the JSON format.

[0104] The communication device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0105] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0106] Based on the same inventive concept, an embodiment of the present application also provides an electronic device. Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 7As shown, the electronic device provided in this embodiment may include: a memory 210, a processor 220, and a computer program stored in the memory 210 and executable on the processor 220. When the processor 220 executes the computer program, the method described in the above method embodiment is implemented.

[0107] The electronic device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0108] Based on the same inventive concept, an embodiment of the present application also provides another electronic device. Figure 8 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the electronic device provided in this embodiment includes: a main control chip 310 and a communication chip 320, and the main control chip 310 and the communication chip 320 are connected through a serial port.

[0109] The electronic device provided in this embodiment can execute the above method embodiment through the communication chip 320. Its implementation principle and technical effect are similar and will not be repeated here.

[0110] Based on the same inventive concept, an embodiment of the present application also provides a communication chip. Fig. 9 A schematic diagram of the structure of a communication chip provided in an embodiment of the present application, such as Fig. 9 As shown, the communication chip provided in this embodiment includes: a memory 410 and a processor 420, and the processor is used to execute the computer program stored in the memory to implement the method described in the above method embodiment.

[0111] The communication chip provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0112] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method described in the above method embodiment is implemented.

[0113] The embodiment of the present application also provides a computer program product. When the computer program product is run on an electronic device, the electronic device implements the method described in the above method embodiment when executing the computer program product.

[0114] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

[0115] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media can include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

[0116] The naming or numbering of the steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The named or numbered process steps can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.

[0117] 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.

[0118] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are merely schematic, for example, the division of the modules or units is only a logical function division, and 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.

[0119] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0120] In the description of this application, unless otherwise specified, " / " indicates that the objects associated with each other are in an "or" relationship, for example, A / B can represent A or B; "and / or" in this application is merely a description of the association relationship between associated objects, indicating that three relationships may exist, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.

[0121] Furthermore, in the description of this application, unless otherwise specified, "plurality" means two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0122] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0123] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.

[0124] References described in the specification of the present application to "one embodiment" or "some embodiments" etc. mean that one or more embodiments of the present application include a specific feature, structure or characteristic described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in the specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.

[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A communication method, applied to a communication chip in an electronic device, characterized in that: include: receiving a first message sent by a first interactive party through a serial port; The first interaction party is a module in the electronic device; Parsing the first message according to a universal serial port protocol to obtain a first message body in the first message; Obtaining a device identifier of the first interacting party; Searching for a device description file corresponding to the device identifier; Parsing the first message body according to the device description file to obtain first target data, wherein the device description file is stored in the electronic device or the server; receiving second target data sent by a second interactive party; converting the second target data into a second message according to the device description file; The second message is sent to the first interactive party through the serial port.

2. The method according to claim 1, characterized in that The searching for a device description file corresponding to the device identifier includes: The device description file corresponding to the device identification is searched in the memory, and / or the device description file corresponding to the device identification is obtained from the server.

3. The method according to claim 1, characterized in that After obtaining the first target data, the method further includes: The first target data is sent to the second interacting party.

4. The method according to any one of claims 1 to 3, characterized in that: The device description file is written according to the json format.

5. A communication chip, characterized in that: The communication chip includes a memory and a processor, and the processor executes a computer program stored in the memory to implement the method according to any one of claims 1 to 4.

6. An electronic device, characterized in that: include: The main control chip and the communication chip as claimed in claim 5, wherein the main control chip and the communication chip are connected via a serial port.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Arbitrary binary device access analysis and standardization system and method

    CN108881251A

  • Internet of Things information interaction method based on binary analysis protocol customization

    CN109981676A

  • Internet of Things equipment protocol analysis method based on configuration file

    CN113726762A