A method, system, device and storage medium for generating WIFI protocols for batch processing
By automatically matching public information and command messages to generate WIFI protocols, the problem of low efficiency in WIFI protocol testing in existing technologies is solved, batch generation and verification are realized, and the efficiency and accuracy of protocol generation are improved.
Patent Information
- Application Number
- CN202111528931.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-12-14
AI Technical Summary
Existing technologies require manual adjustment of serial port protocols one by one in WIFI protocol testing, which is inefficient, error-prone, and unable to achieve batch generation.
By acquiring public information and command messages, the system automatically matches protocol data formats to generate Wi-Fi protocols, including synchronization headers, device types, reserved fields, command codes, and message bodies. It also automatically calculates checksums to achieve batch generation and output of text format.
It enables batch automatic generation of WIFI protocols, improving generation efficiency, reducing error rate, and enhancing the flexibility and accuracy of the protocols.
Smart Images

Figure CN114189556B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of protocol conversion, and in particular to a method, system, device and storage medium for generating WIFI protocols for batch processing. Background Art
[0002] At present, when conducting WiFi protocol testing, it is necessary to manually adjust the protocol of each different command according to the WiFi module serial port protocol data format, and use existing tools to manually convert data between different bases one by one. It is impossible to generate protocols in batches. Manual operation alone takes a lot of time and the amount of manual operation is large. There is also the possibility of errors in the data conversion process, which affects the efficiency of protocol generation and testing. Summary of the invention
[0003] In order to overcome the deficiencies of the prior art, one of the objectives of the present invention is to provide a batch processing WIFI protocol generation method, which can automatically generate WIFI protocols in batches and improve the efficiency of protocol generation.
[0004] A second object of the present invention is to provide a WIFI protocol generation system for batch processing.
[0005] A third object of the present invention is to provide an electronic device.
[0006] A fourth object of the present invention is to provide a storage medium.
[0007] One of the purposes of the present invention is achieved by the following technical solution:
[0008] A method for generating WIFI protocols for batch processing, comprising:
[0009] Obtain public information and write it into the public data segment of the protocol data format;
[0010] Acquire multiple command messages, and generate a corresponding WIFI protocol after matching the corresponding public data segment for each command message according to the protocol data format.
[0011] Furthermore, the method for obtaining public information is:
[0012] Receive public information input from users; or,
[0013] Retrieve the public information corresponding to the protocol data format pre-stored in the database.
[0014] Furthermore, the common data segment includes a synchronization header, a device type and a reserved field.
[0015] Furthermore, the command message includes a command code and a message body corresponding to the command code, and the message body includes user binding selection, SSID length, password length, SSID content and password content.
[0016] Furthermore, the method for generating the WIFI protocol is:
[0017] Performing data conversion on each of the message bodies and automatically calculating the message length of the message body;
[0018] The common data segment, the command code, the message body and the message length are merged to generate a corresponding WIFI protocol.
[0019] Furthermore, before generating the WIFI protocol, it also includes:
[0020] The corresponding checksum is calculated according to the number of bytes of the common data segment, the command code, the message body and the message length, and the checksum is integrated into the protocol data format to generate a WIFI protocol containing the checksum.
[0021] Furthermore, after generating the WIFI protocol, it also includes:
[0022] Convert batch-generated WIFI protocols into editable text format for output.
[0023] The second object of the present invention is achieved by adopting the following technical solution:
[0024] A batch processing WIFI protocol generation system, which executes the batch processing WIFI protocol generation method as described above, comprises:
[0025] A public information acquisition module, used to acquire public information and write it into a public data segment in a protocol data format;
[0026] A command message acquisition module, used for receiving multiple command messages;
[0027] The protocol generation module is used to generate a corresponding WIFI protocol after matching the corresponding public data segment for each command message according to the protocol data format.
[0028] The third object of the present invention is achieved by adopting the following technical solution:
[0029] An electronic device comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the processor implements a WIFI protocol generation method for batch processing when executing the computer program.
[0030] The fourth object of the present invention is achieved by adopting the following technical solution:
[0031] A storage medium stores a computer program, which implements the above-mentioned batch processing WIFI protocol generation method when executed.
[0032] Compared with the prior art, the present invention has the following beneficial effects:
[0033] According to the protocol data format of the WIFI module serial port, after batch input of multiple command messages, the present invention can integrate each command message into a common data segment, and then perform format conversion on the integrated data to generate a WIFI protocol, and can automatically generate a checksum at the same time. Compared with the original manual conversion of protocols one by one, the present invention can automatically perform data conversion and check in batches, and automatically generate multiple protocols at one time, that is, the present invention can realize batch generation of WIFI protocols, improve protocol generation efficiency, and reduce protocol conversion error rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram of the flow chart of the WIFI protocol generation method for batch processing of the present invention;
[0035] Figure 2 This is a data format diagram of the serial port protocol of the WIFI module of the present invention;
[0036] Figure 3 The module diagram of the WIFI protocol generation system for batch processing of the present invention is shown in FIG. DETAILED DESCRIPTION
[0037] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.
[0038] Embodiment 1
[0039] This embodiment provides a method for generating WIFI protocols in batch processing, by which a large number of required WIFI protocols can be generated in batches, and the generation efficiency and accuracy of the WIFI protocols can be greatly improved.
[0040] like Figure 1 As shown, the WIFI protocol generation method of this embodiment specifically includes the following steps:
[0041] Step S1: Obtain public information and write it into the public data segment of the protocol data format;
[0042] Step S2: Acquire multiple command messages, match the corresponding public data segment for each command message according to the protocol data format, and then generate a corresponding WIFI protocol.
[0043] The user can determine the protocol data format of the WIFI module serial port in advance according to the protocol requirements, and can generate the required WIFI protocols in batches through a unified format. The protocol data mode mainly includes two parts of data content, one is the public data segment, and the other is the command data segment; the data recorded in the public data segment is the data common to each protocol, such as Figure 2 As shown, the public data segment in the protocol data format determined in this embodiment includes a synchronization header, a device type and a reserved field. The first byte in the protocol data format represents the synchronization header, the second byte represents the device type, and the third to sixth bytes represent the reserved field; correspondingly, the acquired public information includes the synchronization header, the device type and the reserved field. After acquiring the public information, the acquired synchronization header content is automatically written into the synchronization header in the protocol data format, and the acquired device type is written into the device type in the protocol data format; and the reserved field is generally all zero by default, which means that the third to sixth bytes in the protocol data format are all zero.
[0044] The method for obtaining public information in this embodiment can be obtained through user input, that is, the user inputs the common synchronization header-device type-reserved field, and after obtaining the public information, it can be written into the corresponding data segment of the protocol data format according to the input public information.
[0045] In addition, the public information corresponding to each protocol data format can be pre-stored in the database, and the public information corresponding to the current protocol data format can be automatically retrieved from the database when the protocol requirement is received; at the same time, after the public information is integrated into the data segment corresponding to the protocol data format, the user can also change any public information corresponding to each protocol according to his own needs, thereby improving the flexibility of protocol conversion.
[0046] Each protocol to be generated in this embodiment has the same common data segment, and the content of the command data segment in the protocol data format can be obtained through batch input by the user. Specifically: the user batch inputs multiple command messages, writes the command messages into the corresponding bytes of the command data segment in the protocol data format, and then matches the same common data segment to each command data segment to generate the corresponding protocol, thereby achieving the effect of batch generating protocols.
[0047] The command data segment of the protocol data format includes a command code located at the 7th byte, a message length located at the 8th byte, a message body located at the 9th to 9+N bytes, and a checksum located at the 10th+N bytes, where N is greater than or equal to 0; the command message input by the user in batches includes a command code and a message body corresponding to the command code, and the command code input by the user is written into the 7th byte in the protocol data format; data conversion is performed on the message body, and the message body is converted into hexadecimal and written into the 9th to 9+N bytes in the protocol data format; in addition, this embodiment automatically calculates the message length of the message body and writes the message length into the 8th byte in the protocol data format.
[0048] The message body input in this embodiment includes user binding selection, SSID length, password length, SSID content and password content; for example, the message body of Bluetooth-assisted network configuration: user binding selection 00-SSID length-password length-SSID content tenda-password content asd123, where the user binding selection is 00, no conversion is required, and the length of the string corresponding to the user binding selection is automatically calculated. The SSID content tenda in the message body of Bluetooth-assisted network configuration selects the string to be converted to hexadecimal, and the SSID length is automatically calculated; the password content asd123 selects the string to be converted to hexadecimal, and the password length is automatically calculated. In this embodiment, the user binding selection is 0, indicating that no user binding operation is performed, only network configuration; the user binding selection is 1, indicating that a user binding operation is performed.
[0049] At the same time, this embodiment can also add the number of bytes of the common data segment, command code, message length and message body to calculate the checksum corresponding to the protocol, and integrate the checksum into the checksum field of the protocol data format to generate a WIFI protocol containing the checksum, that is, the number of bytes of the 1st to 9th + N bytes of the protocol data format is added to obtain the checksum, and the checksum is written into the 10th + N bytes of the protocol data format. Among them, the message length and the checksum are used to verify the data integrity and accuracy of the WIFI protocol.
[0050] In this embodiment, after automatically matching the common data segment and automatically filling in the relevant content of the command data segment for each input command, the corresponding WIFI protocol can be generated for each command, thereby achieving the effect of batch generation of WIFI protocols. After the WIFI protocols are batch generated, the batch generated WIFI protocols can be converted into an editable text format output according to user needs, so that the user can copy or edit the WIFI protocol code in text format, thereby improving the flexibility of using the WIFI protocol.
[0051] Embodiment 2
[0052] This embodiment provides a batch processing WIFI protocol generation system, which executes the batch processing WIFI protocol generation method as described in the first embodiment, such as Figure 3 As shown, the system includes:
[0053] A public information acquisition module, used to acquire public information and write it into a public data segment in a protocol data format;
[0054] A command message acquisition module, used for receiving multiple command messages;
[0055] The protocol conversion module is used to generate a corresponding WIFI protocol after matching the corresponding public data segment for each command message according to the protocol data format.
[0056] In this embodiment, the user batch inputs command codes and message bodies corresponding to the command codes, and each command code can generate a corresponding WIFI protocol. In the process of generating the WIFI protocol, the common public data segment is automatically matched for each command code, so as to automatically fill in the content of the 1st to 6th bytes of the protocol data format corresponding to each protocol; each command code, the message body corresponding to each command code, and the message length calculated according to the message body are automatically filled into the 7th to 9+N bytes in the protocol data format; and the 1st to 9+N bytes are added to obtain the check code, so as to obtain the relevant content of the 10th+N to 10+N+M bytes of the protocol data format, and then the commands batch input by the user are batch converted into the corresponding WIFI protocols according to the protocol data format, so as to achieve the effect of batch generating WIFI.
[0057] Embodiment 3
[0058] The present embodiment provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the batch processing WIFI protocol generation method in the first embodiment when executing the computer program; in addition, the present embodiment further provides a storage medium, on which the computer program is stored, wherein the computer program implements the batch processing WIFI protocol generation method described above when executed.
[0059] The device and storage medium in this embodiment and the method in the aforementioned embodiment are two aspects based on the same inventive concept. The method implementation process has been described in detail above, so those skilled in the art can clearly understand the structure and implementation process of the device and storage medium in this embodiment based on the aforementioned description. For the sake of brevity of the specification, they will not be repeated here.
[0060] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.
Claims
1. A method for generating WIFI protocols for batch processing, characterized in that: include: Obtain public information and write it into the public data segment of the protocol data format; Acquire multiple command messages, and generate a corresponding WIFI protocol after matching the corresponding public data segment for each command message according to the protocol data format; the command message includes a command code and a message body corresponding to the command code, and the message body includes user binding selection, SSID length, password length, SSID content, and password content; The method for generating the WIFI protocol is: Performing data conversion on each of the message bodies and automatically calculating the message length of the message body; Writing the command code, the message body and the message length into corresponding bytes of the protocol data format to generate a corresponding WIFI protocol; Before generating the WIFI protocol, it also includes: The corresponding checksum is calculated according to the number of bytes of the common data segment, the command code, the message body and the message length, and the checksum is incorporated into the checksum field of the protocol data format to generate a WIFI protocol containing the checksum.
2. The method for generating WIFI protocols for batch processing according to claim 1, characterized in that: The method for obtaining the public information is: receiving the public information input by a user; or, The public information corresponding to the protocol data format pre-stored in the database is retrieved.
3. The method for generating WIFI protocols for batch processing according to claim 1, characterized in that: The common data segment includes a synchronization header, a device type, and a reserved field.
4. The method for generating WIFI protocols for batch processing according to claim 1, characterized in that: After the WIFI protocol is generated, it also includes: Convert batch-generated WIFI protocols into editable text format for output.
5. A batch processing WIFI protocol generation system, characterized in that: In the WIFI protocol generation method for batch processing according to any one of claims 1 to 4, the system includes: A public information acquisition module, used to acquire public information and write it into a public data segment in a protocol data format; A command message acquisition module, used for receiving multiple command messages; A protocol generation module, used to generate a corresponding WIFI protocol after matching the corresponding public data segment for each command message according to the protocol data format; the command message includes a command code and a message body corresponding to the command code, and the message body includes user binding selection, SSID length, password length, SSID content and password content; The method for generating the WIFI protocol is: Performing data conversion on each of the message bodies and automatically calculating the message length of the message body; Writing the command code, the message body and the message length into corresponding bytes of the protocol data format to generate a corresponding WIFI protocol; Before generating the WIFI protocol, it also includes: The corresponding checksum is calculated according to the number of bytes of the common data segment, the command code, the message body and the message length, and the checksum is incorporated into the checksum field of the protocol data format to generate a WIFI protocol containing the checksum.
6. An electronic device, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the batch processing WIFI protocol generation method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed, the batch processing WIFI protocol generation method according to any one of claims 1 to 4 is implemented.
