Upgrading method, device, equipment and storage medium of optical sensing communication terminal

The communication serial port of the optical sensing communication terminal is connected to the external device, and the upgrade package is analyzed and confirmed, which solves the problem of upgrading the optical sensing communication terminal in a special environment, and realizes an efficient upgrade process.

CN118659970BActive Publication Date: 2024-12-27QUALSEN (GUANGZHOU) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411132676.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-12-27
Estimated Expiration
2044-08-19

AI Technical Summary

Technical Problem

Existing optical sensing communication terminals are difficult to upgrade in special environments, especially because their waterproof performance and installation environment cannot be directly connected to the hardware, and the uncertainty of the fiber optic communication line environment makes it difficult to upgrade directly.

Method used

Connect to external devices through the communication serial port of the optical sensing communication terminal, transmit log data and switch to the reception mode, receive and analyze data packets, determine whether the data packet meets the pre-order conditions, and if it is satisfied, it is confirmed as an upgrade packet and upgrades .

Benefits of technology

The upgrade of optical sensing communication terminals in special environments has been realized, reducing the upgrade cost and improving the upgrade efficiency and convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118659970B_ABST
    Figure CN118659970B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data processing, and discloses an upgrade method, device, equipment and storage medium for an optical sensing communication terminal. The method is applied to an optical sensing communication terminal, and the optical sensing communication terminal is only provided with one communication serial port, and includes: when detecting that an external device transmits a data packet through the communication serial port, stopping the transmission of log data to the external device and switching to a receiving mode, receiving the data packet and parsing it, obtaining a verification file and an upgrade file of the data packet, judging whether the data packet meets a preset order condition based on the verification file, and if so, confirming that the data packet is an upgrade package and responding, and upgrading the optical sensing communication terminal based on the upgrade file. The scheme confirms whether the received data packet is an upgrade package by presetting the data packet format of the upgrade package, thereby realizing the judgment of the upgrade package, and realizing receiving the upgrade package through a communication serial port that sends logs in the current optical sensing communication terminal and upgrading the terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to an upgrade method, device, equipment and storage medium for an optical sensing communication terminal. Background Art

[0002] In the prior art, the upgrade of the optical sensing communication terminal is achieved by updating and expanding the functions of the optical sensing communication terminal by burning new firmware or software programs. In actual applications, since the application scenarios and installation scenarios of the optical sensing communication terminal are all in special environments such as underground, pipe corridors, and underwater, the optical sensing communication terminal cannot be directly connected to the terminal for hardware during debugging and upgrading after installation. In addition, due to the special installation environment of the optical sensing communication terminal, the terminal itself has high requirements for waterproof performance, so a large number of serial ports cannot be set. In general, due to the uncertainty of the environment in which the optical sensing communication terminal is located in the optical fiber communication line, it is not easy to directly obtain the optical sensing communication terminal and directly burn and upgrade the hardware itself. Summary of the invention

[0003] The main purpose of the present invention is to solve the technical problem that the existing optical sensor communication terminal is difficult to perform device upgrade based on the upgrade package under special environment.

[0004] A first aspect of the present invention provides an upgrade method for an optical sensing communication terminal, wherein the optical sensing communication terminal is used to clamp on an optical cable and disturb the optical cable, and the optical sensing communication terminal is only provided with one communication serial port, and the communication serial port is used to connect an external device and transmit data with the external device, and the upgrade method comprises: transmitting log data to the external device through the communication serial port, wherein the log data at least comprises one of sleep data, operation data, and execution data of disturbing the optical cable of the optical sensing communication terminal; when it is detected that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, stopping sending the log data and controlling the communication serial port to switch to a receiving mode; receiving the data packet through the communication serial port, parsing the data packet to obtain a verification file and an upgrade file of the data packet; judging whether the data packet meets a preset orderly condition based on the verification file; if so, confirming that the data packet is an upgrade package, responding to the data packet confirmed as an upgrade package, and upgrading the optical sensing communication terminal based on the upgrade file.

[0005] Optionally, in a first implementation method of the first aspect of the present invention, when it is detected that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, before stopping sending the log data and controlling the communication serial port to switch to a receiving mode, it also includes: setting serial port parameters of the communication serial port, initializing the communication serial port, and creating a data buffer in the optical sensing communication terminal, wherein the data buffer is used to store data packets transmitted through the communication serial port; monitoring the receiving status of the communication serial port through a detection module to determine whether the external device transmits a data packet to the optical sensing communication terminal through the communication serial port.

[0006] Optionally, in a second implementation of the first aspect of the present invention, when it is detected that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, stopping sending the log data and controlling the communication serial port to switch to a receiving mode includes: when it is detected that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, setting a data packet transmission flag, and determining whether the optical sensing communication terminal is in a sending state; if it is in a sending state, enabling a data cache area, and determining whether the optical sensing communication terminal in the sending state is sending the log data; if the log data is being sent, controlling the optical sensing communication terminal to stop sending the log data based on the data packet transmission flag, and controlling the communication serial port to switch to a receiving mode.

[0007] Optionally, in a third implementation method of the first aspect of the present invention, the receiving the data packet through the communication serial port and parsing the data packet to obtain a verification file and an upgrade file of the data packet includes: receiving the data packet through the communication serial port and extracting a data payload of the data packet, wherein the data payload includes a parsing method and a check field of the data packet; performing an integrity check on the data packet based on the check field, and when the check result is that the data packet is complete, parsing and splitting the data packet based on the parsing method to obtain a verification file and an upgrade file of the data packet.

[0008] Optionally, in a fourth implementation method of the first aspect of the present invention, judging whether the data packet meets the preset order condition based on the verification file includes: extracting the header field and the trailer field from the verification file, and matching the header field and the trailer field with a correspondence table of preset data packet types and header and trailer formats to obtain a matching result; when the matching result is that the first judgment result is existence and the second judgment result is existence, confirming that the data packet meets the preset order condition.

[0009] Optionally, in a fifth implementation of the first aspect of the present invention, the packet header field and the packet trailer field are matched with a correspondence table of preset data packet types and header and packet trailer formats to obtain a matching result, including: matching the packet header field with a header format in the correspondence table of preset data packet types and header and packet trailer formats, and judging whether the packet header field exists in the packet header format to obtain a first judgment result; matching the packet trailer field with a packet trailer format in the correspondence table of preset data packet types and header and packet trailer formats, and judging whether the packet trailer field exists in the packet trailer format to obtain a second judgment result; the first judgment result and the second judgment result as a whole obtain a matching result.

[0010] Optionally, in a sixth implementation method of the first aspect of the present invention, confirming that the data packet is an upgrade packet and responding to the data packet confirmed as an upgrade packet include: confirming that a data packet that meets a preset order condition is an upgrade packet, and extracting a packet sequence number and a total number of packets in the upgrade packet, and judging whether the upgrade packet has been sent based on the packet sequence number and the total number of packets; if so, extracting a response packet corresponding to the upgrade packet, and sending the response packet to the external device through the communication serial port to respond to the upgrade packet.

[0011] A second aspect of the present invention provides an upgrade device for an optical sensing communication terminal, wherein the optical sensing communication terminal is used to clamp on an optical cable and disturb the optical cable, and the optical sensing communication terminal is provided with only one communication serial port, and the communication serial port is used to connect an external device and perform data transmission with the external device, and the device comprises:

[0012] A transmission module, used for transmitting log data to the external device through the communication serial port, wherein the log data includes at least one of sleep data, operation data, and execution data of disturbing the optical cable of the optical sensing communication terminal;

[0013] A switching module, configured to stop sending the log data and control the communication serial port to switch to a receiving mode when detecting that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port;

[0014] A parsing module, used to receive the data packet through the communication serial port, and parse the data packet to obtain a verification file and an upgrade file of the data packet;

[0015] A judgment module, used for judging whether the data packet meets a preset order condition based on the verification file;

[0016] The response module is used to confirm that the data packet is an upgrade packet if the conditions are met, respond to the data packet confirmed as the upgrade packet, and upgrade the optical sensor communication terminal based on the upgrade file.

[0017] Optionally, in a first implementation manner of the second aspect of the present invention, the switching module includes:

[0018] a state determination unit, for setting a data packet transmission flag when detecting that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, and determining whether the optical sensing communication terminal is in a sending state; if in a sending state, enabling a data buffer area, and determining whether the optical sensing communication terminal in a sending state is sending the log data;

[0019] A control unit is used to control the optical sensor communication terminal to stop sending the log data based on the data packet transmission flag if the log data is being sent, and control the communication serial port to switch to a receiving mode.

[0020] Optionally, in a second implementation of the second aspect of the present invention, the switching module further includes:

[0021] An initialization unit is used to set the serial port parameters of the communication serial port, initialize the communication serial port, and create a data buffer in the optical sensing communication terminal, wherein the data buffer is used to store data packets transmitted through the communication serial port; the receiving state of the communication serial port is monitored by a detection module to determine whether the external device transmits a data packet to the optical sensing communication terminal through the communication serial port.

[0022] Optionally, in a third implementation of the second aspect of the present invention, the parsing module includes:

[0023] A receiving unit, configured to receive the data packet through the communication serial port and extract a data payload of the data packet, wherein the data payload includes a parsing mode and a check field of the data packet;

[0024] The verification unit is used to perform integrity verification on the data packet based on the verification field, and when the verification result shows that the data packet is complete, parse and split the data packet based on the parsing method to obtain a verification file and an upgrade file of the data packet.

[0025] Optionally, in a fourth implementation of the second aspect of the present invention, the judgment module includes:

[0026] A matching unit, used for extracting a packet header field and a packet tail field from the verification file, and matching the packet header field and the packet tail field with a corresponding relationship table of preset data packet types and packet header and packet tail formats to obtain a matching result;

[0027] A confirmation unit is used to confirm that the data packet meets a preset order condition when the matching result is that the first judgment result is existence and the second judgment result is existence.

[0028] Optionally, in a fifth implementation manner of the second aspect of the present invention, the matching unit is specifically used to: match the packet header field with the packet header format in the correspondence table of preset data packet types and packet header and packet trailer formats, and determine whether the packet header field exists in the packet header format to obtain a first judgment result; match the packet trailer field with the packet trailer format in the correspondence table of preset data packet types and packet header and packet trailer formats, and determine whether the packet trailer field exists in the packet trailer format to obtain a second judgment result; the entire first judgment result and the second judgment result obtain a matching result.

[0029] Optionally, in a sixth implementation of the second aspect of the present invention, the response module includes:

[0030] An extracting unit, configured to confirm that a data packet that meets a preset order condition is an upgrade packet, extract a packet sequence number and a total number of packets in the upgrade packet, and determine whether the upgrade packet has been sent based on the packet sequence number and the total number of packets;

[0031] The sending unit is used to extract the response packet corresponding to the upgrade packet, and send the response packet to the external device through the communication serial port to respond to the upgrade packet.

[0032] The third aspect of the present invention provides an upgrade device for an optical sensing communication terminal, the upgrade device for the optical sensing communication terminal comprising a memory and at least one processor, the memory storing instructions; the at least one processor calls the instructions in the memory so that the upgrade device for the optical sensing communication terminal executes the upgrade method for the optical sensing communication terminal as described above.

[0033] A fourth aspect of the present invention provides a computer-readable storage medium, on which instructions are stored, and when the instructions are executed by a processor, the upgrade method of the optical sensing communication terminal as described above is implemented.

[0034] In the technical solution provided by the present invention, when the optical sensing communication terminal detects that a data packet is transmitted through the communication serial port, the communication serial port is controlled to switch to the receiving mode; the data packet is received through the communication serial port, and the data packet is parsed to obtain the verification file and the upgrade file of the data packet; based on the verification file, it is judged whether the data packet meets the preset order condition; if it meets, the data packet is confirmed to be an upgrade package, and the data packet confirmed to be the upgrade package is responded to, and the upgrade is performed based on the upgrade file. This solution confirms whether the received data packet is an upgrade package by presetting the data packet format of the upgrade package, realizes the judgment of the upgrade package, and realizes the reception of the upgrade package through the serial port that sends the log in the current optical sensing communication terminal, reduces the upgrade cost of the optical sensing communication terminal, and improves the upgrade efficiency and convenience of the optical sensing communication terminal. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of a first embodiment of a method for upgrading an optical sensing communication terminal provided by an embodiment of the present invention;

[0036] Figure 2 A schematic diagram of a second embodiment of the method for upgrading an optical sensing communication terminal provided by an embodiment of the present invention;

[0037] Figure 3 A schematic diagram of a structure of an upgrade device for an optical sensing communication terminal provided by an embodiment of the present invention;

[0038] Figure 4 Another structural schematic diagram of an upgrade device for an optical sensing communication terminal provided by an embodiment of the present invention;

[0039] Figure 5 A schematic diagram of the structure of an upgrade device for an optical sensing communication terminal provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0040] With respect to the existing upgrade method of optical sensing communication terminals, when the present application detects that an external device transmits a data packet through a communication serial port, the present application stops transmitting log data to the external device and switches to a receiving mode, receives and parses the data packet, obtains a verification file and an upgrade file of the data packet, and determines whether the data packet meets a preset order condition based on the verification file. If so, the data packet is confirmed to be an upgrade package and a response is made, and the optical sensing communication terminal is upgraded based on the upgrade file. This scheme pre-sets the data packet format of the upgrade package to confirm whether the received data packet is an upgrade package, thereby realizing the determination of the upgrade package, and realizing the reception of the upgrade package and the terminal upgrade through a communication serial port that sends logs in the current optical sensing communication terminal, and realizing the reception of the upgrade package through the serial port that sends logs in the current optical sensing communication terminal, thereby reducing the upgrade cost of the optical sensing communication terminal and improving the upgrade efficiency of the optical sensing communication terminal.

[0041] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data 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. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0042] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 A schematic diagram of a first embodiment of a method for upgrading an optical sensing communication terminal provided by an embodiment of the present invention, the method specifically comprises the following steps:

[0043] 101. Transmit log data to external devices through the communication serial port.

[0044] The log data includes at least one of the sleep data, operation data, and execution data of disturbing the optical cable of the optical sensing communication terminal. The sleep data records the time, reason, and related status information of the optical sensing communication terminal entering the sleep state during the sleep period. For example, if the terminal automatically enters the sleep state when no data transmission is required, the log can record the timestamp of the start of sleep, the operation status before sleep, the power consumption during sleep, and other information; the operation data covers various parameters and performance indicators of the optical sensing communication terminal under normal working conditions, including but not limited to data transmission rate, signal strength, bit error rate, operating voltage, temperature, etc. For example, if the data transmission rate of the terminal suddenly drops, the problem can be located by analyzing the relevant parameters in the operation data, and corresponding measures can be taken to repair it; the execution data of disturbing the optical cable is that when the optical cable is subjected to external disturbances (such as vibration, bending, stretching, etc.), the optical sensing communication terminal may perform specific operations to deal with these disturbances. The execution data of the disturbed optical cable records the detailed information of these operations, including the type, time, location of the disturbance, and the countermeasures taken by the terminal. For example, if the optical cable is frequently disturbed by vibration at a certain location, the terminal may execute a specific algorithm to reduce the impact of vibration on signal transmission. By analyzing the execution data, the effectiveness of these algorithms can be evaluated and optimized. The optical sensor communication terminal continuously sends disordered log content through the serial port. When the optical sensor communication terminal needs to be upgraded, the host computer sends an upgrade package to the optical sensor communication terminal through the serial port or other communication methods. The optical sensor communication terminal receives the upgrade package and upgrades it.

[0045] The optical sensing communication terminal is used to clamp on the optical cable and disturb the optical cable. The optical sensing communication terminal is only provided with one communication serial port, and the communication serial port is used to connect to an external device and transmit data with the external device. The communication serial port can be extended to the ground or water surface by an extension line, so as to facilitate the external device to connect to the communication serial port. The communication serial port sends and receives bytes according to bits. The extension line is a cable or connector, which is used to extend the communication serial port on the device to another position so as to connect it at a position far away from the original interface. In the optical sensing communication terminal, the communication serial port can be conveniently extended from the device itself to the ground or near the water surface by using an extension line, so as to facilitate the user to connect other devices or cables. For extension to the ground or the water surface, that is, the communication serial port is not limited to the physical position of the optical sensing communication terminal itself, but can be extended to a position that is easier to access or more suitable for connection by using an extension line. The main purpose of the communication serial port is to allow external devices to communicate with the optical sensing communication terminal. After the communication serial port is extended to the ground or the water surface by using an extension line, external devices can be connected at these positions to realize data input or output.

[0046] 102. When it is detected that an external device transmits a data packet to the optical sensor communication terminal through the communication serial port, stop sending log data and control the communication serial port to switch to a receiving mode.

[0047] The optical sensing communication terminal monitors the data packets transmitted through the communication serial port through the built-in sensor or other detection mechanism. After detecting the data packet, the optical sensing communication terminal triggers a signal to notify the serial port controller. The function of the signal is to instruct the serial port controller to switch from the current mode (which may be idle, sending or other modes) to the receiving mode. After receiving the instruction to switch the mode, the serial port controller will perform the corresponding operation and set the communication serial port to the receiving mode. Specifically, the mode of the communication serial port is switched to the receiving mode by adjusting the configuration parameters of the communication serial port, such as baud rate, data bit, stop bit and check bit. In the receiving mode, the communication serial port will start to receive data packets from the sender, and the received data will be converted into digital form and stored in the receiving buffer for subsequent processing. It can be understood that the external device sends an orderly upgrade package to the optical sensing communication terminal through the communication serial port. Before the external device sends the data packet, it needs to establish a connection with the external device through the communication serial port, and after the connection is established, it receives the data packet sent by the external device, and based on the judgment of the orderliness of the data packet, it realizes the judgment of whether the data packet is an upgrade package, and after confirming that it is an upgrade package, the optical sensing communication terminal is upgraded based on the upgrade package.

[0048] 103. Receive a data packet through the communication serial port, parse the data packet, and obtain a verification file and an upgrade file of the data packet.

[0049] When receiving a data packet through the communication serial port and parsing the data packet to obtain the verification file and the upgrade file, the optical sensing communication terminal monitors whether there is a data packet transmission through the communication serial port, triggers the receiving mechanism when the data packet is detected, and the communication serial port switches to the receiving mode to receive the data according to the set parameters such as baud rate, data bit, stop bit and check bit. For the received data packet, the data packet is parsed by the parsing tool to check whether the received data contains a specific frame header, such as AA, BB. The frame header is used to identify the beginning of a frame of data, and the data length field is parsed. The data length field indicates the size of the load data in the current data frame. Further, the received data can also be checked according to the CRC check code in the data packet. Whether the received data is correct. After confirming that the data is complete and correct, the data of the verification file and the upgrade file are extracted from the data packet according to the data length field. For the upgrade file, according to the format and content of the upgrade file, the corresponding upgrade operation is performed, such as updating the firmware, modifying the configuration, etc.

[0050] 104. Determine whether the data packet meets the preset order condition based on the verification file.

[0051] In this embodiment, the format of the upgrade package is pre-defined in the optical sensing communication terminal, and the format may be: upgrade package header + upgrade file + upgrade package tail. Furthermore, relevant information about the upgrade content may be added to the upgrade package. Specifically, the upgrade package is designed into a specific file format, in which the first few lines and the last few lines are orderly file contents, so that the optical sensing communication terminal can recognize and trigger the upgrade process. For example, the upgrade package may have a specific start mark as the content of the first few lines, and an end mark as the content of the last few lines. After parsing the received data packet, the optical sensing communication terminal searches for the specific start mark and end mark. When the start mark and the end mark are identified, it is confirmed that the data packet meets the preset order condition. The verification file is a byte segment used to verify the orderliness of the data packet, including at least a header field and a tail field.

[0052] When the terminal is upgraded based on the upgrade package, the orderliness of the upgrade package is judged for the data packet, and when the preset order condition is not met, the error handling mechanism is triggered. The error handling mechanism includes confirming the transmission information and data packet information of the data packet, and reporting the data packet and suspending the receiving and processing of the data packet based on the corresponding security mechanism. Specifically, if the preset order condition is not met, the error handling mechanism is triggered, including recording error logs, sending alarms, etc., and further security measures may be taken, such as isolating or disabling the file transfer of the source. Alternatively, the information of verification failure and the judgment result of the preset order condition are fed back to the user, and the received data packet that does not belong to the upgrade package is further parsed, the type and content of the data packet are confirmed, and the relevant information is sent to the user, and the user receives the processing result of the data packet that does not belong to the upgrade package. It should be noted that for the received data packet that is not an upgrade package, it should be ensured that it will not cause any damage to the optical sensing communication terminal, for example, setting an isolation file for the received data packet of the non-upgrade package, restricting its access rights or automatically deleting it.

[0053] 105. If the conditions are met, confirm that the data packet is an upgrade packet, respond to the data packet confirmed as the upgrade packet, and upgrade the optical sensor communication terminal based on the upgrade file.

[0054] After receiving the complete upgrade package, the optical sensor communication terminal stops sending disordered logs through the communication serial port and performs corresponding upgrade operations according to the upgrade file. The upgrade process includes software update, configuration modification, etc. After the upgrade is completed, the optical sensor communication terminal resets or reinitializes and resumes sending disordered logs through the serial port. Before stopping the log sending, you can consider backing up the logs being sent to the storage medium.

[0055] In this embodiment, ordinary data packets (such as logs) will not have headers and tails added, only upgrade packages will have headers and tails added. The optical sensor communication terminal continuously sends logs through the serial port, and the log content is in a disordered state. By setting the upgrade package to a file with the first few lines and the last few lines in order, when the optical sensor communication terminal receives the upgrade package, it stops sending logs and performs an upgrade, and continues sending logs after the upgrade is completed.

[0056] In one implementable method, the header of the upgrade package is 0xAA, and the trailer of the upgrade package is 0x55. Furthermore, in addition to the header and trailer, the upgrade package may further include: 1 byte representing the checksum of the entire package, 2 bytes representing the total data length of the upgrade package, 1 byte representing the total number of upgrade packages, 1 byte representing the package number of the current upgrade package, and finally the data field of the entire upgrade package will be encrypted. After receiving a data packet, the optical sensor communication terminal will determine whether the header of the data packet is AA and the tail is 55. If so, it means that the data packet is an upgrade packet, and the next step is to continue analysis. If the further analysis is correct, the optical sensor communication terminal will organize a response packet. The header of the response packet is AA, the tail is 55, and then there is a byte A5 in the data field, indicating that this packet is an upgrade packet responding to the host computer. There is 1 byte in the upgrade packet to indicate the total number of upgrade packets, and 1 byte to indicate the packet sequence number of the current upgrade packet. If the packet sequence number of the data packet received by the optical sensor communication terminal is equal to the total number of packets, it means that the optical sensor communication terminal has received all the upgrade packets sent by the host computer, and the packet sequence number of each upgrade packet sent by the host computer will increase by 1. Specifically, the host computer splits the file to be sent, for example, a file of 30K in size, into 30 data packets, each of which is 1K. 0xAA is added to the header of each data packet and 0x55 is added to the end of the data packet. The host computer then sends the data packet to the optical sensor communication terminal through the communication serial port. The optical sensor communication terminal recognizes that the header of the data packet is 0xAA and the end is 0x55, and considers that the data packet is an upgraded data packet rather than log information.

[0057] It should be noted that the optical sensing communication terminal is upgraded only after receiving all the upgrade packages sent by the host computer; there is 1 byte in the upgrade package to indicate the total number of upgrade packages, and 1 byte to indicate the package number of the current upgrade package. If the package number received by the terminal is equal to the total number of packages, it means that the terminal has received all the upgrade packages sent by the host computer. Specifically, the external device prepares the upgrade package, which is a series of data packets containing update data. Each upgrade package has a unique package number and a byte indicating the total number of upgrade packages. The external device sends the upgrade packages to the optical sensing communication terminal one by one in sequence. The optical sensing communication terminal receives the upgrade packages from the external device. For each received upgrade package, the terminal reads the package number and the total number of packages. The terminal verifies whether the received package number is within the expected range (i.e., not greater than the total number of packages), and checks whether there is any packet loss or disorder. When the terminal receives an upgrade package with a package number equal to the total number of packages, it confirms that all upgrade packages have been received. If the terminal detects any packet loss or disorder, it will request the external device to resend the lost package or the entire upgrade package sequence. After confirming that all upgrade packages have been received and verifying the integrity and order of the packages, the terminal will begin the upgrade process, which includes writing the new software into the memory of the optical sensing communication terminal, restarting the terminal to apply the new software, and performing any post-upgrade configuration or verification steps.

[0058] This solution pre-sets the data packet format of the upgrade package to confirm whether the received data packet is an upgrade package, thereby realizing the determination of the upgrade package and realizing the reception of the upgrade package through the serial port that sends the log in the current optical sensor communication terminal.

[0059] See also Figure 2 , a schematic diagram of a second embodiment of a method for upgrading an optical sensing communication terminal provided by an embodiment of the present invention, the method specifically comprises the following steps:

[0060] 201. Establish a communication connection between the optical sensing communication terminal and an external device.

[0061] The external device is the sender of the upgrade package, and the external device has at least one communication interface, and the communication interface is used to connect to a communication serial port on the optical sensing communication terminal and send the upgrade package to the communication serial port. In practical applications, the external device is an emulator, and the communication interface is a SWD (Serial Wire Debug) interface. The communication serial port on the optical sensing communication terminal can send and receive data to the external device, that is, an I / O interface. When the communication serial port sends data to the external device, the T1 OUT interface sends data to the external device, and there is a T1 IN interface connected to the T1 OUT interface inside the optical sensing communication terminal. When the communication serial port receives data from the external device, the R1 IN interface sends data to the external device, and there is an R1 OUT interface connected to the R1 IN interface inside the optical sensing communication terminal. The emulator is connected to and communicates with the optical sensing communication terminal through the SWD interface.

[0062] 202. Initialize the communication serial port of the optical sensor communication terminal, and detect whether there is a data packet transmission on the communication serial port.

[0063] Initializing the communication serial port includes setting the baud rate, data bit, stop bit, check bit, flow control setting, buffer setting, interrupt setting, data transmission mode selection, etc. After the initialization is completed, set the same serial port parameters as the optical sensor communication terminal, and monitor the communication serial port to wait for the data packet sent by the external device.

[0064] 203. When the optical sensor communication terminal detects that a data packet is transmitted through the communication serial port, the optical sensor communication terminal is controlled to stop sending data, and the communication serial port is controlled to switch to a receiving mode.

[0065] At the hardware level, the communication of the communication serial port is bidirectional, but it is necessary to control when to send and when to receive. When the optical sensor communication terminal needs to send a log, it will configure the serial port to send mode and send the log data. When the optical sensor communication terminal detects that there is data incoming, it will switch to receive mode and read the incoming data. When the optical sensor communication terminal receives data while sending a log, it switches to receive mode through the interrupt service program and uses a buffer to store the data to be sent or received. When the optical sensor communication terminal is sending a log, it can store the received upgrade package data in the buffer until the current log is sent. Use a state machine to manage the sending and receiving status of the serial port, define different states, such as "sending logs", "receiving data packets", etc., and switch states according to the current state and received data. Specifically, the optical sensing communication terminal will monitor the signal on the communication serial port. When it detects that a data packet is transmitted through the serial port line, the optical sensing communication terminal will recognize the signal. Once the data packet is recognized, the optical sensing communication terminal will send an instruction to the serial port controller, requiring it to switch to the receiving mode. The serial port controller will then parse the transmitted data packet according to the configured parameters and convert it into digital form and store it in the receiving buffer.

[0066] 204. Receive a data packet through the communication serial port, and perform integrity check based on the data load of the data packet. When the check result shows that the data packet is complete, parse and split the data packet based on the parsing method to obtain a verification file and an upgrade file of the data packet.

[0067] When the optical sensing communication terminal receives a complete upgrade package, it should stop sending logs and start processing the upgrade package. The upgrade process may include steps such as verifying the integrity of the upgrade package, executing the upgrade operation, and restarting the device. The data packet mainly includes: a packet header, which contains the control information of the data packet, such as the destination address, source address, checksum, etc., which is used to indicate the sender and receiver of the data packet, as well as the type and length of the data packet. The upgrade file is the actual data part carried by the data packet. The packet tail contains additional checksum information, which is used to detect whether the data is erroneous or lost during transmission. For the received data packet, first verify the integrity of the data packet. If the data packet contains checksum information, calculate the checksum value of the received data, compare the calculated checksum value with the checksum value in the data packet, and verify the integrity of the data packet. For the data packet that passes the checksum, parse out the various parts according to the format definition of the data packet, identify the location of the verification file and the upgrade file in the data packet, extract the data of the verification file and the upgrade file from the data packet, and save them to the appropriate file or memory area.

[0068] The specific steps of data packet parsing include: first, check the version field of the data packet header, confirm the protocol of the data packet, confirm the source address and destination address of the data packet, parse the payload of the data packet, and the specific parsing method depends on the protocol type and content of the payload, then check the checksum field in the data packet header, verify the integrity of the data packet, and select the appropriate parsing method according to the format and content of the data packet. For text data, you can use the text parsing package, and for binary data, you can use the binary parsing package, etc.

[0069] 205. Match the header field and the tail field in the verification file with the preset correspondence table between the data packet type and the header and tail format to determine whether the data packet meets the preset order condition.

[0070] Match the header field with the header format in the correspondence table between the preset data packet type and the header and footer format, determine whether the header field exists in the header format, and obtain a first judgment result; match the footer field with the footer format in the correspondence table between the preset data packet type and the header and footer format, determine whether the footer field exists in the footer format, and obtain a second judgment result; integrate the first judgment result and the second judgment result to obtain a matching result. In actual applications, a correspondence table between the preset data packet type and the header and footer format is defined, and the correspondence table includes various data packet types and their corresponding header and footer formats. For example, the correspondence table includes the following fields: data packet type (ID), header format (Header Format), and footer format (Footer Format).

[0071] When a data packet is received, it is parsed into a header field, a data part, and a tail field. The upgrade file is the data part, and the verification file is the header field and the tail field. Extract the header field in the data packet, find the header format corresponding to the current data packet type in the preset correspondence table, match the extracted header field with the preset header format, and judge whether the header field exists in the preset header format to obtain a first judgment result; extract the tail field in the data packet, find the tail format corresponding to the current data packet type in the preset correspondence table, match the extracted tail field with the preset tail format, and judge whether the tail field exists in the preset tail format to obtain a second judgment result; according to the first judgment result and the second judgment result, determine whether the data packet completely matches the preset header and tail formats. If the first judgment result and the second judgment result are both present, that is, the header and the tail match, then the data packet matches successfully, confirming that the data packet meets the preset order condition. If any judgment result is not present, then the data packet fails to match.

[0072] 206. After the upgrade package is received, a response package corresponding to the upgrade package is obtained, and a response is made to the upgrade package based on the response package.

[0073] The structure of the upgrade package is pre-set, including a byte indicating the total number of upgrade packages and a byte indicating the sequence number of the current upgrade package. During the receiving process, the optical sensing communication terminal should continuously track the received package sequence number and compare it with the total number of upgrade packages. In addition to the comparison of the package sequence number and the total number of packages, additional integrity verification mechanisms such as checksum or cyclic redundancy check can also be implemented. The checksum is calculated by summing the data and comparing it with the sender. Furthermore, a suitable timeout period can be set. If the expected upgrade package is not received within a certain period of time, the terminal can request the external device to retransmit the package.

[0074] After the upgrade package is received, the corresponding response package will be obtained from the preset storage area. The response package is generated according to the reception result of the upgrade package by the optical sensing communication terminal. For example, the response package may include the reception result of the upgrade package being successfully received, missing, or wrong. After the data packet meets the preset order condition, it is confirmed as an upgrade package, and the package sequence number and the total number of packages are extracted from the upgrade package. The information is usually located in the header or a specific field of the upgrade package. The package sequence number of the currently received upgrade package is compared with the package sequence number of the received upgrade package. If the current package sequence number is continuously increasing and has reached the total number of packages, it means that the upgrade package has been sent. After confirming that the upgrade package has been sent, the corresponding response package is extracted from a predefined position or based on the protocol rules. The response package contains confirmation information, receiving status or other relevant information for the upgrade package, and the response package is sent to the sender of the upgrade package through the communication serial port. It should be noted that the response package can be preset or generated in real time according to the reception result of the upgrade package by the optical sensing communication terminal.

[0075] This solution pre-sets the data packet format of the upgrade package to confirm whether the received data packet is an upgrade package, thereby realizing the determination of the upgrade package and realizing the reception of the upgrade package through the serial port that sends the log in the current optical sensor communication terminal.

[0076] The above describes the upgrade method of the optical sensor communication terminal in the embodiment of the present invention. The following describes in detail the upgrade device of the optical sensor communication terminal in the embodiment of the present invention from the perspective of modular functional entities. Figure 3 , a schematic diagram of a structure of an upgrade device for an optical sensing communication terminal provided by an embodiment of the present invention, wherein the optical sensing communication terminal is clamped on an optical cable and disturbs the optical cable, the optical sensing communication terminal is provided with only one communication serial port, the communication serial port is used to connect an external device and perform data transmission with the external device, and the device comprises:

[0077] A transmission module 310, configured to transmit log data to the external device through the communication serial port, wherein the log data includes at least one of sleep data, operation data, and execution data of disturbing the optical cable of the optical sensing communication terminal;

[0078] The switching module 320 is used to stop sending the log data and control the communication serial port to switch to a receiving mode when it is detected that the external device transmits a data packet to the optical sensor communication terminal through the communication serial port;

[0079] The parsing module 330 is used to receive the data packet through the communication serial port, and parse the data packet to obtain the verification file and the upgrade file of the data packet;

[0080] A determination module 340 is used to determine whether the data packet meets a preset order condition based on the verification file;

[0081] The response module 350 is used to confirm that the data packet is an upgrade package if the conditions are met, respond to the data packet confirmed as the upgrade package, and upgrade the optical sensor communication terminal based on the upgrade file.

[0082] This solution pre-sets the data packet format of the upgrade package to confirm whether the received data packet is an upgrade package, thereby realizing the determination of the upgrade package and realizing the reception of the upgrade package through the serial port that sends the log in the current optical sensor communication terminal.

[0083] See also Figure 4 , another structural schematic diagram of an upgrade device for an optical sensing communication terminal provided by an embodiment of the present invention, wherein the optical sensing communication terminal is clamped on an optical cable and disturbs the optical cable, the optical sensing communication terminal is provided with only one communication serial port, the communication serial port is used to connect an external device and perform data transmission with the external device, and the device comprises:

[0084] A transmission module 410, configured to transmit log data to the external device through the communication serial port, wherein the log data includes at least one of sleep data, operation data, and execution data of disturbing the optical cable of the optical sensing communication terminal;

[0085] The switching module 420 is used to stop sending the log data and control the communication serial port to switch to a receiving mode when it is detected that the external device transmits a data packet to the optical sensor communication terminal through the communication serial port;

[0086] The parsing module 430 is used to receive the data packet through the communication serial port and parse the data packet to obtain the verification file and the upgrade file of the data packet;

[0087] A determination module 440, configured to determine whether the data packet satisfies a preset order condition based on the verification file;

[0088] The response module 450 is used to confirm that the data packet is an upgrade package if the conditions are met, respond to the data packet confirmed as the upgrade package, and upgrade the optical sensor communication terminal based on the upgrade file.

[0089] In this embodiment, the switching module 420 includes:

[0090] The state determination unit 422 is used to set a data packet transmission flag when detecting that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, and determine whether the optical sensing communication terminal is in a sending state; if in a sending state, enable a data buffer area, and determine whether the optical sensing communication terminal in a sending state is sending the log data;

[0091] The control unit 423 is used to control the optical sensor communication terminal to stop sending the log data based on the data packet transmission flag if the log data is being sent, and control the communication serial port to switch to a receiving mode.

[0092] In this embodiment, the switching module 420 further includes:

[0093] The initialization unit 421 is used to set the serial port parameters of the communication serial port, initialize the communication serial port, and create a data buffer in the optical sensing communication terminal, wherein the data buffer is used to store data packets transmitted through the communication serial port; the receiving state of the communication serial port is monitored by the detection module to determine whether the external device transmits a data packet to the optical sensing communication terminal through the communication serial port.

[0094] In this embodiment, the parsing module 430 includes:

[0095] The receiving unit 431 is used to receive the data packet through the communication serial port and extract the data payload of the data packet, wherein the data payload includes the parsing mode and the check field of the data packet;

[0096] The verification unit 432 is used to perform integrity verification on the data packet based on the verification field, and when the verification result shows that the data packet is complete, parse and split the data packet based on the parsing method to obtain the verification file and the upgrade file of the data packet.

[0097] In this embodiment, the determination module 440 includes:

[0098] A matching unit 441 is used to extract a packet header field and a packet tail field from the verification file, and match the packet header field and the packet tail field with a preset correspondence table between a data packet type and a packet header and packet tail format to obtain a matching result;

[0099] The confirmation unit 442 is used to confirm that the data packet meets the preset order condition when the matching result is that the first judgment result is existence and the second judgment result is existence.

[0100] In this embodiment, the matching unit 441 is specifically used to: match the packet header field with the packet header format in the correspondence table between the preset data packet type and the packet header and packet tail format, and determine whether the packet header field exists in the packet header format to obtain a first judgment result; match the packet tail field with the packet tail format in the correspondence table between the preset data packet type and the packet header and packet tail format, and determine whether the packet tail field exists in the packet tail format to obtain a second judgment result; the first judgment result and the second judgment result are combined to obtain a matching result.

[0101] In this embodiment, the response module 450 includes:

[0102] The extracting unit 451 is used to confirm that the data packet that meets the preset order condition is an upgrade packet, and extract the packet sequence number and the total number of packets in the upgrade packet, and determine whether the upgrade packet has been sent based on the packet sequence number and the total number of packets;

[0103] The sending unit 452 is used to extract the response packet corresponding to the upgrade packet, and send the response packet to the external device through the communication serial port to respond to the upgrade packet.

[0104] When the optical sensing communication terminal detects that a data packet is transmitted through the communication serial port, the scheme controls the communication serial port to switch to the receiving mode; receives the data packet through the communication serial port, and parses the data packet to obtain the verification file and upgrade file of the data packet; determines whether the data packet meets the preset order condition based on the verification file; if it does, confirms that the data packet is an upgrade package, responds to the data packet confirmed as the upgrade package, and performs the upgrade based on the upgrade file. This scheme confirms whether the received data packet is an upgrade package by presetting the data packet format of the upgrade package, realizes the judgment of the upgrade package, and realizes the reception of the upgrade package through the serial port that sends the log in the current optical sensing communication terminal.

[0105] above Figure 3-4 The upgrade device of the optical sensing communication terminal in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The upgrade device of the optical sensing communication terminal in the embodiment of the present invention is described in detail from the perspective of hardware processing.

[0106] See also Figure 5 As shown, the upgrade device of the optical sensing communication terminal includes a processor 500 and a memory 501. The memory 501 stores machine executable instructions that can be executed by the processor 500. The processor 500 executes the machine executable instructions to implement the above-mentioned upgrade method of the optical sensing communication terminal.

[0107] Further, Figure 5 The upgrade device of the optical sensing communication terminal shown further includes a bus 502 and a communication interface 503 , and the processor 500 , the communication interface 503 and the memory 501 are connected via the bus 502 .

[0108] Among them, the memory 501 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), for example, at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 503 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 502 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0109] The processor 500 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 500. The above processor 500 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 501 , and the processor 500 reads the information in the memory 501 and completes the method steps of the above-mentioned embodiment in combination with its hardware.

[0110] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the various steps of the method for upgrading the optical sensing communication terminal provided in the above-mentioned embodiments.

[0111] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described equipment, devices, and units can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0112] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0113] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those 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 thereof may be replaced by equivalents. However, these 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 invention.

Claims

1. A method for upgrading an optical sensing communication terminal, characterized in that: The optical sensing communication terminal is used to clamp on the optical cable and disturb the optical cable. The optical sensing communication terminal is only provided with one communication serial port, and the communication serial port is used to connect to an external device and perform data transmission with the external device. The upgrading method includes: Transmitting log data to the external device through the communication serial port, wherein the log data includes at least one of sleep data, operation data, and execution data of disturbing the optical cable of the optical sensing communication terminal; When it is detected that the external device transmits a data packet to the optical sensor communication terminal through the communication serial port, stop sending the log data and control the communication serial port to switch to a receiving mode; Receiving the data packet through the communication serial port, and parsing the data packet to obtain a verification file and an upgrade file of the data packet; Determining whether the data packet meets a preset order condition based on the verification file; If satisfied, confirming that the data packet is an upgrade package, responding to the data packet confirmed as the upgrade package, and upgrading the optical sensor communication terminal based on the upgrade file; The step of confirming that the data packet is an upgrade packet and responding to the data packet confirmed as an upgrade packet comprises: Confirm that a data packet that meets a preset order condition is an upgrade packet, extract a packet sequence number and a total number of packets in the upgrade packet, and determine whether the upgrade packet has been sent based on the packet sequence number and the total number of packets; If so, extract the response packet corresponding to the upgrade packet, and send the response packet to the external device through the communication serial port to respond to the upgrade packet.

2. The method for upgrading the optical sensing communication terminal according to claim 1, characterized in that: When it is detected that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, before stopping sending the log data and controlling the communication serial port to switch to a receiving mode, the method further includes: Setting serial port parameters of the communication serial port, initializing the communication serial port, and creating a data buffer in the optical sensing communication terminal, wherein the data buffer is used to store data packets transmitted through the communication serial port; The receiving state of the communication serial port is monitored by a detection module to determine whether the external device transmits a data packet to the optical sensor communication terminal through the communication serial port.

3. The method for upgrading the optical sensing communication terminal according to claim 1, characterized in that: When it is detected that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port, stopping sending the log data and controlling the communication serial port to switch to a receiving mode comprises: When it is detected that the external device transmits a data packet to the optical sensor communication terminal through the communication serial port, a data packet transmission flag is set, and it is determined whether the optical sensor communication terminal is in a sending state; If it is in the sending state, the data buffer area is enabled, and it is determined whether the optical sensing communication terminal in the sending state is sending the log data; If the log data is being sent, the optical sensor communication terminal is controlled to stop sending the log data based on the data packet transmission flag, and the communication serial port is controlled to switch to a receiving mode.

4. The method for upgrading an optical sensing communication terminal according to any one of claims 1 to 3, characterized in that: The receiving the data packet through the communication serial port and parsing the data packet to obtain the verification file and the upgrade file of the data packet includes: receiving the data packet through the communication serial port, and extracting the data payload of the data packet, wherein the data payload includes a parsing mode and a check field of the data packet; The data packet is checked for integrity based on the check field, and when the check result shows that the data packet is complete, the data packet is parsed and split based on the parsing method to obtain a verification file and an upgrade file of the data packet.

5. The method for upgrading an optical sensing communication terminal according to any one of claims 1 to 3, characterized in that: The determining whether the data packet satisfies a preset order condition based on the verification file includes: Extracting a packet header field and a packet tail field from the verification file, and matching the packet header field and the packet tail field with a preset correspondence table of data packet types and packet header and packet tail formats to obtain a matching result; When the matching result is that the first judgment result is existence and the second judgment result is existence, it is confirmed that the data packet meets the preset order condition, the first judgment result is the existence or non-existence of the packet header field in the packet header format, and the second judgment result is the existence or non-existence of the packet trailer field in the packet trailer format.

6. The method for upgrading the optical sensing communication terminal according to claim 5, characterized in that: The step of matching the packet header field and the packet tail field with a preset correspondence table between a data packet type and a packet header and packet tail format to obtain a matching result includes: Matching the packet header field with a packet header format in a correspondence table of preset data packet types and packet header and packet tail formats, determining whether the packet header field exists in the packet header format, and obtaining a first determination result; Matching the packet tail field with a packet tail format in a correspondence table of preset data packet types and packet header and packet tail formats, determining whether the packet tail field exists in the packet tail format, and obtaining a second determination result; The first judgment result and the second judgment result are integrated to obtain a matching result.

7. An upgrade device for an optical sensing communication terminal, characterized in that: The optical sensing communication terminal is used to clamp on the optical cable and disturb the optical cable. The optical sensing communication terminal is only provided with one communication serial port, and the communication serial port is used to connect to an external device and perform data transmission with the external device. The upgrading device of the optical sensing communication terminal includes: A transmission module, used for transmitting log data to the external device through the communication serial port, wherein the log data includes at least one of sleep data, operation data, and execution data of disturbing the optical cable of the optical sensing communication terminal; A switching module, configured to stop sending the log data and control the communication serial port to switch to a receiving mode when detecting that the external device transmits a data packet to the optical sensing communication terminal through the communication serial port; A parsing module, used to receive the data packet through the communication serial port, and parse the data packet to obtain a verification file and an upgrade file of the data packet; A judgment module, used for judging whether the data packet meets a preset order condition based on the verification file; A response module, used for confirming that the data packet is an upgrade packet if the conditions are met, responding to the data packet confirmed as the upgrade packet, and upgrading the optical sensor communication terminal based on the upgrade file; The response module comprises: An extracting unit, configured to confirm that a data packet that meets a preset order condition is an upgrade packet, extract a packet sequence number and a total number of packets in the upgrade packet, and determine whether the upgrade packet has been sent based on the packet sequence number and the total number of packets; The sending unit is used to extract the response packet corresponding to the upgrade packet, and send the response packet to the external device through the communication serial port to respond to the upgrade packet.

8. The upgrade device for an optical sensing communication terminal according to claim 7, characterized in that: The judging module comprises: A matching unit, used for extracting a packet header field and a packet tail field from the verification file, and matching the packet header field and the packet tail field with a corresponding relationship table of preset data packet types and packet header and packet tail formats to obtain a matching result; A confirmation unit is used to confirm that the data packet meets a preset order condition when the matching result is that the first judgment result is existence and the second judgment result is existence, the first judgment result is the existence or non-existence of the header field in the header format, and the second judgment result is the existence or non-existence of the trailer field in the trailer format.

9. An upgrade device for an optical sensing communication terminal, characterized in that: The upgrade device of the optical sensing communication terminal includes a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the upgrade device of the optical sensing communication terminal executes the upgrade method of the optical sensing communication terminal as described in any one of claims 1-6.

10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the method for upgrading the optical sensing communication terminal as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Firmware upgrading method and device, chip, electronic equipment and storage medium

    CN116560689A

  • Remote upgrading method and device of end equipment, equipment and storage medium

    CN117519753A