CN116668464B - Multi-serial port synchronous processing method, device, electronic equipment and medium - Google Patents

Multi-serial port synchronous processing method, device, electronic equipment and medium Download PDF

Info

Publication number
CN116668464B
CN116668464B CN202310927933.4A CN202310927933A CN116668464B CN 116668464 B CN116668464 B CN 116668464B CN 202310927933 A CN202310927933 A CN 202310927933A CN 116668464 B CN116668464 B CN 116668464B
Authority
CN
China
Prior art keywords
service
synchronous
cache queue
preset
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310927933.4A
Other languages
Chinese (zh)
Other versions
CN116668464A (en
Inventor
宋伟
陈晓辉
米娜
王雷雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Jianjie Iot Technology Co ltd
Original Assignee
Zhejiang Jianjie Iot Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Jianjie Iot Technology Co ltd filed Critical Zhejiang Jianjie Iot Technology Co ltd
Priority to CN202310927933.4A priority Critical patent/CN116668464B/en
Publication of CN116668464A publication Critical patent/CN116668464A/en
Application granted granted Critical
Publication of CN116668464B publication Critical patent/CN116668464B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/567Integrating service provisioning from a plurality of service providers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Hardware Redundancy (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application discloses a multi-serial port synchronous processing method, a device, electronic equipment and a medium. The method comprises the following steps: acquiring at least two to-be-processed services, and determining the service types of the at least two to-be-processed services; the service type of the service to be processed comprises real-time service, timing service and synchronous service; storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists or not; and if the synchronization service sequence exists in the preset service cache queue, carrying out synchronization processing on the synchronization service sequence. By adopting the scheme, the service to be processed is stored in a preset service cache queue; traversing a preset service cache queue to determine synchronous service, and setting a corresponding identity code for the synchronous service; the synchronous service of the same identity code is processed preferentially, so that the problem that different services of the multi-serial device cannot be processed synchronously is solved.

Description

Multi-serial port synchronous processing method, device, electronic equipment and medium
Technical Field
The embodiment of the application relates to the technical field of data synchronous processing, in particular to a multi-serial port synchronous processing method, a device, electronic equipment and a medium.
Background
In the energy storage or industrial field, as an intelligent terminal for data collection and device control, an industrial gateway is generally required to access a plurality of serial devices and perform data collection and device control on the accessed serial devices. At present, different devices and different points can be distinguished according to requirements in data acquisition and control to acquire and control.
Because the data acquisition and control period can be set in a self-defined way, synchronization of data acquisition and control can not be achieved among different devices; for example, a plurality of control devices of the same type are connected under the gateway and are respectively connected on different serial ports, but the devices need to be controlled synchronously or data acquisition is needed at the same time. In the prior art, the time difference between data acquisition and equipment control can be reduced as much as possible only by improving the control command or the data acquisition period or frequency, but the synchronization problem cannot be fundamentally solved, and additional system overhead and cost are brought.
Disclosure of Invention
The embodiment of the application provides a multi-serial port synchronous processing method, a device, electronic equipment and a medium, which are used for realizing synchronous processing of different services when multiple serial port equipment accesses exist in the same gateway.
In a first aspect, an embodiment of the present application provides a method for synchronously processing multiple serial ports of an application, including:
acquiring at least two to-be-processed services, and determining the service types of the at least two to-be-processed services; the service type of the service to be processed comprises real-time service, timing service and synchronous service;
storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists or not; the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports;
and if the synchronization service sequence exists in the preset service cache queue, carrying out synchronization processing on the synchronization service sequence.
In a second aspect, an embodiment of the present application further provides a multi-serial port synchronous processing device, including:
the service receiving module is used for acquiring at least two to-be-processed services and determining the service types of the at least two to-be-processed services; the service type of the service to be processed comprises real-time service, timing service and synchronous service;
the service analysis module is used for storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists or not; the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports;
and the service processing module is used for carrying out synchronous processing on the synchronous service sequence if the synchronous service sequence exists in the preset service cache queue.
In a third aspect, an embodiment of the present application further provides an electronic device, including:
one or more processors;
a storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method for synchronous processing of multiple serial ports according to any embodiment of the present application.
In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, where a computer program is stored, where the program when executed by a processor implements the method for synchronous processing of multiple serial ports according to any embodiment of the present application.
The embodiment of the application provides a multi-serial port synchronous processing method, a device, electronic equipment and a medium, which are used for acquiring at least two services to be processed and determining the service types of the at least two services to be processed; the service type of the service to be processed comprises real-time service, timing service and synchronous service; storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists or not; the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports; and if the synchronization service sequence exists in the preset service cache queue, carrying out synchronization processing on the synchronization service sequence. By adopting the technical scheme of the embodiment of the application, the service to be processed is classified and stored in a preset service cache queue; traversing a preset service cache queue to determine synchronous service, and setting a corresponding identity code for the synchronous service; the synchronous service of the same identity code is processed preferentially, so that the problem that different services of the multi-serial device cannot be processed synchronously is solved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
fig. 1 is a schematic flow chart of a multi-serial port synchronous processing method provided in an embodiment of the present application;
fig. 2 is a schematic diagram of a physical relationship between a gateway and a serial port according to an embodiment of the present application;
FIG. 3 is a flow chart of another method for synchronous processing of multiple serial ports according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a service frame encapsulation structure according to an embodiment of the present application;
FIG. 5 is a flow diagram of a sequential processing service provided in an embodiment of the present application;
FIG. 6 is a schematic flow diagram of a service synchronization process provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of a multi-serial port synchronous processing device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The application is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present application are shown in the drawings.
Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts operations (or steps) as a sequential process, many of the operations (or steps) can be performed in parallel, concurrently, or at the same time. Furthermore, the order of the operations may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The technical scheme of the application obtains, stores, uses and processes the data and the like all conform to the relevant regulations of national laws and regulations.
Fig. 1 is a flowchart of a multi-serial port synchronous processing method provided in an embodiment of the present application, where the embodiment is applicable to a case of synchronous processing of synchronous services acquired by a multi-serial port bus, the method of the present embodiment may be performed by a multi-serial port synchronous processing device, and the device may be implemented by using hardware and/or software. The device can be configured in a server for synchronous processing of multiple serial services. The method specifically comprises the following steps:
s110, acquiring at least two to-be-processed services, and determining the service types of the at least two to-be-processed services.
Referring to fig. 2, different serial devices are connected under different serial ports of the industrial gateway, and part of services in the devices need to be used for synchronization service. For example, device 1 and device 2 need to be on-line or off-line simultaneously, and the time difference between on-line and off-line cannot be greater than 50ms; if the requirement cannot be met by conventional design, a synchronous control mechanism for different devices is introduced at the moment, so that the embodiment of the application provides a multi-serial data synchronous processing method.
The method comprises the steps of acquiring at least two to-be-processed services and determining service types, wherein the service types of the to-be-processed services comprise real-time services, timing services and synchronous services. Wherein, the real-time service refers to a service capable of providing timely response under strict time limitation; real-time services need to be completed within a predetermined time and reliability and accuracy of response time need to be ensured. Timing services refer to services that are performed according to a predetermined schedule or plan; the timing service may be triggered and executed according to a predetermined point in time or time interval to meet a particular demand; timing services are typically used for periodic tasks, timing reminders, timing data collection, and the like. The synchronous service refers to a process of transmitting and processing data among a plurality of devices or modules according to a preset time sequence; in a synchronous service, devices or modules maintain synchronous transmission and processing of data by sharing clock signals, using specific data frame formats, flow control mechanisms, state synchronization, or the like. Synchronization services are often used in scenarios where data consistency and timing needs to be maintained, such as multi-device collaboration and data synchronization.
S120, storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists.
Referring to fig. 3, after the at least two to-be-processed services are obtained, the at least two to-be-processed services are stored in a preset service cache queue, the preset service cache queue is processed, and whether a synchronous service sequence exists in the preset service cache queue is determined.
The synchronization service sequence refers to a sequence formed by a plurality of synchronization services according to a certain sequence. In the sequence of synchronous services, each synchronous service has a specific execution time and execution sequence, and the execution time of the previous synchronous service affects the execution time of the subsequent synchronous service. In the embodiment of the application, the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports; for example, if the serial port 1 is connected to the device 1 and the serial port 2 is connected to the device 2, and the device 1 and the device 2 are required to process simultaneously in a specific service, the service sequence between the serial port 1 and the serial port 2 is a synchronous service sequence.
As an optional but non-limiting implementation manner, the storing the at least two pending services in a preset service cache queue includes steps A1-A2:
step A1: and determining the service types of the at least two to-be-processed services and determining serial numbers of the at least two to-be-processed services.
Step A2: and packaging the at least two to-be-processed services, and storing the packaged at least two to-be-processed services in a preset service cache queue.
And at least two synchronous services belonging to the same synchronous service sequence are endowed with the same identity code for encapsulation.
The at least two to-be-processed services also need to be packaged before being stored in a preset service cache service. Service frame structure referring to fig. 4, the first byte "TYPE" represents a service TYPE; wherein, 1 characterizes real-time service, 2 characterizes timing service, and 3 characterizes synchronous service. The second byte "syn_sn" represents the serial number, representing the current service serial number. The third and fourth byte SYN_SN_TOTAL represent the target serial number of the synchronous service, and only the synchronous service is valid; if the current service is a timing service or a real-time service, the third and fourth bytes are empty. The fifth and sixth byte "syn_id" is a synchronous service random ID, and the same synchronous service is the same ID and unique.
In an alternative scheme of the embodiment of the application, the service frame structure is analyzed in the synchronous service processing module, and the first byte in the service frame structure is analyzed to obtain the specific service type of the frame, so as to determine whether the frame is a synchronous service frame; analyzing the second byte to obtain a serial number corresponding to the synchronous service frame, traversing a preset service buffer queue, and obtaining whether the batch of synchronous service requests are in place or not; analyzing the third byte and the fourth byte of the synchronous frame in the buffer queue to obtain serial port equipment serial numbers and target serial port serial numbers related to the synchronous service; and analyzing the fifth byte and the sixth byte of the synchronous service frame to obtain a service frame ID, and brushing and selecting the synchronous service frame of the same sequence.
As an optional but non-limiting implementation manner, the storing the at least two services to be processed in a preset service buffer queue, and traversing the preset service buffer queue to determine whether a synchronous service sequence exists, includes steps B1-B2:
step B1: and constructing a preset service cache queue, and storing the at least two services to be processed into the preset service cache queue according to the receiving sequence.
Step B2: traversing at least two to-be-processed services in the preset service cache queue, and determining whether a synchronous service sequence exists in the preset service cache queue.
A preset service cache queue is constructed and used for storing the service to be processed; adding the received at least two services to be processed into a preset service cache queue according to the receiving sequence; traversing the preset service cache queue, and determining whether synchronous service exists in the preset service cache queue according to a specific value of a first byte in a service frame structure; if it is determined that there is one synchronization service, the preset service cache queue may be continuously traversed to find a possible synchronization service sequence.
As an optional but non-limiting implementation manner, the traversing at least two services to be processed in the preset service cache queue, determining whether a synchronous service sequence exists in the preset service cache queue, includes steps C1-C2:
step C1: if the first synchronous service exists in the preset service cache queue, determining whether a second synchronous service exists in the preset service cache queue; the second synchronization service and the first synchronization service belong to the same synchronization service sequence.
Step C2: if the second synchronous service exists in the preset service cache queue, determining that the synchronous service sequence exists in the preset service cache queue.
Traversing the preset service cache queue, and determining whether a first synchronous service and a second synchronous service exist in the preset service cache queue; the first synchronization service and the second synchronization service belong to the same synchronization service sequence. If the first synchronous service and the second synchronous service exist in the preset service cache queue, a synchronous service sequence exists in the preset service cache queue. In the embodiment of the application, all synchronous services in the same synchronous service sequence are called synchronous service in-place in a preset service cache queue. Determining a target number of synchronous services included in the synchronous service sequence according to the number of target serial numbers representing synchronous services in a third four byte of the service frame structure; traversing a preset service cache queue, and determining whether the number of synchronous services in the preset service cache queue is a target number; and if the number of the synchronous services obtained through traversing is the target number, determining that the synchronous service sequence is in place. For example, determining that the first synchronization service sequence includes 3 synchronization services according to the number of the target serial numbers representing the synchronization services in the third four bytes of the service frame structure; the first synchronization service sequence comprises a first synchronization service, a second synchronization service and a third synchronization service; if a first synchronous service, a second synchronous service and a third synchronous service exist in a preset service cache queue, the first synchronous service sequence is in place; and after the first synchronization service sequence is in place, carrying out synchronization processing on the first synchronization service, the second synchronization service and the third synchronization service.
As an optional but non-limiting implementation manner, the traversing at least two services to be processed in the preset service buffer queue, determining whether a synchronous service sequence exists in the preset service buffer queue, further includes steps D1-D2:
step D1: if the first synchronous service exists in the preset service cache queue, but the second synchronous service does not exist in the preset service cache queue, determining that the synchronous service sequence in the preset service cache queue is not in place.
In an alternative scheme of the embodiment of the present application, if all the synchronization services belonging to the same synchronization service sequence are not cached in the same preset service cache queue, the synchronization service sequence in the preset service cache queue is not located. For example, determining that the second synchronization service sequence includes 2 synchronization services according to the number of the target serial numbers representing the synchronization services in the third four bytes of the service frame structure; the second synchronous service sequence comprises a first synchronous service and a second synchronous service; if the preset service cache queue is traversed, determining that the first synchronous service exists in the preset service cache queue, but the second synchronous service does not exist in the preset service cache queue, and if the synchronous service sequence in the preset service cache queue is not in place.
Step D2: or if at least two services to be processed in the preset service cache queue are traversed, determining that a first synchronous service does not exist in the preset service cache queue, and determining that a synchronous service sequence does not exist in the preset service cache queue.
In an alternative scheme of the embodiment of the present application, when traversing the preset service cache queue, if no synchronization service exists in the preset service cache queue, it is determined that no synchronization service sequence exists in the preset service cache queue.
S130, if the synchronization service sequence exists in the preset service cache queue, performing synchronization processing on the synchronization service sequence.
In which, referring to fig. 5, the existing service processing is generally that all services are processed in sequence, and only one service can be processed at the same time. For example, there are n services in one network management, and the n services are serially processed from service 1 to service n in a preset order. Serial processing cannot meet the requirement that part of the services need to be processed synchronously, so in the embodiment of the application, a processing scheme as shown in fig. 6 is provided. If the synchronization service sequence (e.g. service 2) exists in the preset service buffer queue, the service 2 is preferentially sent to the designated serial device at the same time, and the synchronization service processing is performed first.
As an optional but non-limiting implementation manner, if the synchronization service sequence exists in the preset service buffer queue, the synchronization service sequence is processed synchronously, and the method further includes but is not limited to steps E1-E2:
step E1: and if the synchronous service sequence exists in the preset service cache queue, suspending the executing timing service.
Step E2: and taking out the synchronous service from the preset service cache queue according to the receiving sequence and carrying out synchronous service processing.
In an alternative scheme of the embodiment of the present application, if a synchronization service sequence exists in the preset service buffer queue, the timing service being executed is suspended; and taking out the synchronous service from the preset service cache queue according to the receiving sequence and carrying out synchronous service processing. For example, a first service to be processed is taken out from the preset service cache queue to be a timing service, and a second service to be processed is taken out to be a synchronous service; at this time, the timing service being executed is suspended, other synchronous services belonging to the same synchronous service sequence with the synchronous service are taken out from a preset service cache queue, and the serial port transceiver module is triggered to carry out synchronous processing on the synchronous service in the synchronous service sequence; and recovering the timing processing of the timing service after the synchronization processing of the synchronization service is completed.
As an alternative but non-limiting implementation, after determining that the synchronization service sequence in the preset service buffer queue is not in place or that the synchronization service sequence is not present in the preset service buffer queue, the method includes, but is not limited to, steps F1-F2:
step F1: and if the synchronous service sequence in the preset service cache queue is not in place or the synchronous service sequence does not exist in the preset service cache queue, taking out the target service to be processed from the preset service cache queue according to the receiving sequence.
Step F2: determining the service type of a target to-be-processed service, and determining different service processing modes according to the service type of the target to-be-processed service; the target pending service includes a timing service and a real-time service.
The method comprises the steps that a synchronous service sequence in a preset service cache queue is not located, or the synchronous service sequence does not exist in the preset service cache queue, and then target to-be-processed services are sequentially taken out from the preset service cache queue; and processing according to the service type of the target service to be processed. For example, if the synchronization service sequence is not in place or does not exist in the preset service cache queue, sequentially taking out the target to-be-processed service to be processed; and if the taken target to-be-processed service is the timing service, delivering the timing service to a timer module to finish timing processing of the timing triggering serial port receiving and transmitting module. If the taken target service to be processed is real-time service, the serial port receiving and transmitting module is directly triggered to complete real-time processing.
The multi-serial port synchronous processing method provided by the embodiment of the application comprises the steps of obtaining at least two to-be-processed services and determining the service types of the at least two to-be-processed services; the service type of the service to be processed comprises real-time service, timing service and synchronous service; storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists or not; the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports; and if the synchronization service sequence exists in the preset service cache queue, carrying out synchronization processing on the synchronization service sequence. By adopting the technical scheme of the embodiment of the application, the service to be processed is classified and stored in a preset service cache queue; traversing a preset service cache queue to determine synchronous service, and setting a corresponding identity code for the synchronous service; the synchronous service of the same identity code is processed preferentially, so that the problem that different services of the multi-serial device cannot be processed synchronously is solved.
Fig. 7 is a schematic structural diagram of a multi-serial port synchronous processing device according to an embodiment of the present application, where the technical solution of the present embodiment is applicable to a case of performing synchronous processing on synchronous services acquired by a multi-serial port bus, and the device may be implemented by software and/or hardware and is generally integrated on any electronic device having a network communication function, where the electronic device includes, but is not limited to: server, computer, personal digital assistant, etc. As shown in fig. 7, the multi-serial port synchronous processing device provided in this embodiment may include: a service receiving module 710, a service analyzing module 720, and a service processing module 730; wherein, the liquid crystal display device comprises a liquid crystal display device,
a service receiving module 710, configured to obtain at least two to-be-processed services, and determine service types of the at least two to-be-processed services; the service type of the service to be processed comprises real-time service, timing service and synchronous service;
the service analysis module 720 is configured to store the at least two services to be processed in a preset service cache queue, and traverse the preset service cache queue to determine whether a synchronous service sequence exists; the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports;
and the service processing module 730 is configured to perform synchronization processing on the synchronization service sequence if the synchronization service sequence exists in the preset service buffer queue.
On the basis of the foregoing embodiment, optionally, the service analysis module includes:
determining the service type of the at least two to-be-processed services and determining serial numbers of the at least two to-be-processed services;
packaging the at least two to-be-processed services, and storing the packaged at least two to-be-processed services in a preset service cache queue;
and at least two synchronous services belonging to the same synchronous service sequence are endowed with the same identity code for encapsulation.
On the basis of the foregoing embodiment, optionally, the service analysis module further includes:
constructing a preset service cache queue, and storing the at least two services to be processed into the preset service cache queue according to the receiving sequence;
traversing at least two to-be-processed services in the preset service cache queue, and determining whether a synchronous service sequence exists in the preset service cache queue.
On the basis of the foregoing embodiment, optionally, the service analysis module further includes:
if the first synchronous service exists in the preset service cache queue, determining whether a second synchronous service exists in the preset service cache queue; the second synchronous service and the first synchronous service belong to the same synchronous service sequence;
if the second synchronous service exists in the preset service cache queue, determining that the synchronous service sequence exists in the preset service cache queue.
On the basis of the foregoing embodiment, optionally, the service analysis module further includes:
if the first synchronous service exists in the preset service cache queue, but the second synchronous service does not exist in the preset service cache queue, determining that the synchronous service sequence in the preset service cache queue is not in place;
or if at least two services to be processed in the preset service cache queue are traversed, determining that a first synchronous service does not exist in the preset service cache queue, and determining that a synchronous service sequence does not exist in the preset service cache queue.
On the basis of the foregoing embodiment, optionally, the service processing module includes:
if the synchronous service sequence exists in the preset service cache queue, pausing the timing service being executed;
and taking out the synchronous service from the preset service cache queue according to the receiving sequence and carrying out synchronous service processing.
On the basis of the foregoing embodiment, optionally, the service processing module further includes:
if the synchronous service sequence in the preset service cache queue is not in place or the synchronous service sequence does not exist in the preset service cache queue, taking out target to-be-processed service from the preset service cache queue according to the receiving sequence;
determining the service type of a target to-be-processed service, and determining different service processing modes according to the service type of the target to-be-processed service; the target pending service includes a timing service and a real-time service.
The multi-serial port synchronous processing device provided by the embodiment of the application can execute the multi-serial port synchronous processing method provided by any embodiment of the application, has the corresponding functions and beneficial effects of executing the multi-serial port synchronous processing method, and the detailed process refers to the related operation of the multi-serial port synchronous processing method in the embodiment.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 8, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the multi-serial oral synchronization processing method.
In some embodiments, the multi-string oral synchronization processing method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the multi-string oral synchronization processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the multi-string oral synchronization processing method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present application, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present application are achieved, and the present application is not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (10)

1. A method for synchronous processing of multiple serial ports, the method comprising:
acquiring at least two to-be-processed services, and determining the service types of the at least two to-be-processed services; the service type of the service to be processed comprises real-time service, timing service and synchronous service;
storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists or not; the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports;
if the synchronization service sequence exists in the preset service cache queue, performing synchronization processing on the synchronization service sequence;
traversing the preset service cache queue to determine whether a synchronous service sequence exists, including:
traversing the preset service cache queue, and determining whether a first synchronous service and a second synchronous service exist in the preset service cache queue; the first synchronous service and the second synchronous service belong to the same synchronous service sequence; if the first synchronous service and the second synchronous service exist in the preset service cache queue, a synchronous service sequence exists in the preset service cache queue.
2. The method of claim 1, wherein storing the at least two pending services in a preset service cache queue comprises:
determining the service type of the at least two to-be-processed services and determining serial numbers of the at least two to-be-processed services;
packaging the at least two to-be-processed services, and storing the packaged at least two to-be-processed services in a preset service cache queue;
and at least two synchronous services belonging to the same synchronous service sequence are endowed with the same identity code for encapsulation.
3. The method of claim 1, wherein storing the at least two pending services in a preset service cache queue and traversing the preset service cache queue to determine whether a synchronization service sequence exists comprises:
constructing a preset service cache queue, and storing the at least two services to be processed into the preset service cache queue according to the receiving sequence;
traversing at least two to-be-processed services in the preset service cache queue, and determining whether a synchronous service sequence exists in the preset service cache queue.
4. The method of claim 3, wherein traversing at least two pending services in the preset service cache queue to determine whether a synchronization service sequence exists in the preset service cache queue comprises:
if the first synchronous service exists in the preset service cache queue, determining whether a second synchronous service exists in the preset service cache queue; the second synchronous service and the first synchronous service belong to the same synchronous service sequence;
if the second synchronous service exists in the preset service cache queue, determining that the synchronous service sequence exists in the preset service cache queue.
5. The method of claim 4, wherein traversing at least two pending services in the preset service cache queue to determine whether a synchronization service sequence exists in the preset service cache queue further comprises:
if the first synchronous service exists in the preset service cache queue, but the second synchronous service does not exist in the preset service cache queue, determining that the synchronous service sequence in the preset service cache queue is not in place;
or if at least two services to be processed in the preset service cache queue are traversed, determining that a first synchronous service does not exist in the preset service cache queue, and determining that a synchronous service sequence does not exist in the preset service cache queue.
6. The method of claim 1, wherein if the synchronization service sequence exists in the preset service buffer queue, performing synchronization processing on the synchronization service sequence comprises:
if the synchronous service sequence exists in the preset service cache queue, pausing the timing service being executed;
and taking out the synchronous service from the preset service cache queue according to the receiving sequence and carrying out synchronous service processing.
7. The method of claim 4, wherein after determining that a synchronization service sequence in the preset service cache queue is not in place or that a synchronization service sequence is not present in the preset service cache queue, the method comprises:
if the synchronous service sequence in the preset service cache queue is not in place or the synchronous service sequence does not exist in the preset service cache queue, taking out target to-be-processed service from the preset service cache queue according to the receiving sequence;
determining the service type of a target to-be-processed service, and determining different service processing modes according to the service type of the target to-be-processed service; the target pending service includes a timing service and a real-time service.
8. A multi-serial port synchronous processing device, the device comprising:
the service receiving module is used for acquiring at least two to-be-processed services and determining the service types of the at least two to-be-processed services; the service type of the service to be processed comprises real-time service, timing service and synchronous service;
the service analysis module is used for storing the at least two services to be processed in a preset service cache queue, and traversing the preset service cache queue to determine whether a synchronous service sequence exists or not; the synchronous service sequence is used for representing synchronous service among different devices connected by different serial ports;
the service processing module is used for carrying out synchronous processing on the synchronous service sequence if the synchronous service sequence exists in the preset service cache queue;
wherein, the service analysis module is used for:
traversing the preset service cache queue, and determining whether a first synchronous service and a second synchronous service exist in the preset service cache queue; the first synchronous service and the second synchronous service belong to the same synchronous service sequence; if the first synchronous service and the second synchronous service exist in the preset service cache queue, a synchronous service sequence exists in the preset service cache queue.
9. An electronic device, comprising:
one or more processors;
a storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the multi-string oral synchronization processing method of any of claims 1-7.
10. A storage medium containing computer executable instructions which, when executed by a computer processor, are for performing the multi-string oral synchronization processing method of any one of claims 1-7.
CN202310927933.4A 2023-07-27 2023-07-27 Multi-serial port synchronous processing method, device, electronic equipment and medium Active CN116668464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310927933.4A CN116668464B (en) 2023-07-27 2023-07-27 Multi-serial port synchronous processing method, device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310927933.4A CN116668464B (en) 2023-07-27 2023-07-27 Multi-serial port synchronous processing method, device, electronic equipment and medium

Publications (2)

Publication Number Publication Date
CN116668464A CN116668464A (en) 2023-08-29
CN116668464B true CN116668464B (en) 2023-10-13

Family

ID=87714012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310927933.4A Active CN116668464B (en) 2023-07-27 2023-07-27 Multi-serial port synchronous processing method, device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN116668464B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012006824A1 (en) * 2010-07-15 2012-01-19 中兴通讯股份有限公司 Multi-virtual serial port system and communication method thereof
CN104200640A (en) * 2014-08-22 2014-12-10 中国石油天然气股份有限公司 Remote real-time synchronous integration processing system for data of multiple serial port sources
CN111651256A (en) * 2020-05-31 2020-09-11 西安爱生技术集团公司 Serial communication data synchronization method based on FreeRTOS
CN112380254A (en) * 2020-11-16 2021-02-19 华南理工大学 Data caching system and method of automation equipment
CN113127400A (en) * 2019-12-31 2021-07-16 中国科学院长春光学精密机械与物理研究所 FPGA-based multi-channel serial port server and data transmission method thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012006824A1 (en) * 2010-07-15 2012-01-19 中兴通讯股份有限公司 Multi-virtual serial port system and communication method thereof
CN104200640A (en) * 2014-08-22 2014-12-10 中国石油天然气股份有限公司 Remote real-time synchronous integration processing system for data of multiple serial port sources
CN113127400A (en) * 2019-12-31 2021-07-16 中国科学院长春光学精密机械与物理研究所 FPGA-based multi-channel serial port server and data transmission method thereof
CN111651256A (en) * 2020-05-31 2020-09-11 西安爱生技术集团公司 Serial communication data synchronization method based on FreeRTOS
CN112380254A (en) * 2020-11-16 2021-02-19 华南理工大学 Data caching system and method of automation equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张万方 ; 朱全银 ; 王红艳 ; 丁甜甜 ; .通信终端与Web服务程序数据同步设计.北京联合大学学报(自然科学版).2011,(第02期),全文. *

Also Published As

Publication number Publication date
CN116668464A (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN113327344B (en) Fusion positioning method, device, equipment, storage medium and program product
CN112905314A (en) Asynchronous processing method and device, electronic equipment, storage medium and road side equipment
CN114564435A (en) Inter-core communication method, device and medium for heterogeneous multi-core chip
CN113656423A (en) Method and device for updating data, electronic equipment and storage medium
CN115242731A (en) Message processing method, device, equipment and storage medium
CN116668464B (en) Multi-serial port synchronous processing method, device, electronic equipment and medium
CN112883041A (en) Data updating method and device, electronic equipment and storage medium
CN115438056A (en) Data acquisition method, device, equipment and storage medium
CN114553894B (en) Data synchronization method, device, system and storage medium
CN116107763B (en) Data transmission method, device, equipment and storage medium
CN113470380B (en) Data processing method and device, electronic equipment and readable storage medium
CN117956261A (en) PLC interaction method, system, upper computer, equipment and medium
CN114416040A (en) Page construction method, device, equipment and storage medium
CN118034605A (en) Data processing method and device, electronic equipment and storage medium
CN117499224A (en) Internet of things equipment edge gateway access method, device, equipment and medium
CN115439301A (en) Point cloud data processing method, device, equipment and storage medium
CN116279215A (en) Data processing method and device, electronic equipment and storage medium
CN115145859A (en) Data transmission method and device, electronic equipment and storage medium
CN117453613A (en) Multi-channel serial port communication method, device, system, equipment and storage medium
CN117785264A (en) Interface configuration method, device and storage medium for server operation and maintenance
CN115734326A (en) Short-distance wireless communication method, device, wearable equipment and medium
CN117834911A (en) Buffering method, buffering device, electronic equipment and medium for video coding
CN117193647A (en) Data processing task sending method, data processing device and equipment
CN117565057A (en) Machine ginseng number calibration method, device, equipment and storage medium
CN115934370A (en) Spin lock acquisition method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant