CN111385361A - Cloth inspecting machine communication method and device, electronic equipment and storage medium - Google Patents

Cloth inspecting machine communication method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111385361A
CN111385361A CN202010164017.6A CN202010164017A CN111385361A CN 111385361 A CN111385361 A CN 111385361A CN 202010164017 A CN202010164017 A CN 202010164017A CN 111385361 A CN111385361 A CN 111385361A
Authority
CN
China
Prior art keywords
service
target
message center
message
hardware
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.)
Granted
Application number
CN202010164017.6A
Other languages
Chinese (zh)
Other versions
CN111385361B (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.)
Alnnovation Guangzhou Technology Co ltd
Original Assignee
Alnnovation Guangzhou 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 Alnnovation Guangzhou Technology Co ltd filed Critical Alnnovation Guangzhou Technology Co ltd
Priority to CN202010164017.6A priority Critical patent/CN111385361B/en
Publication of CN111385361A publication Critical patent/CN111385361A/en
Application granted granted Critical
Publication of CN111385361B publication Critical patent/CN111385361B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/1607Details of the supervisory signal
    • 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/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application provides a communication method and device of a cloth inspecting machine, electronic equipment and a storage medium, and belongs to the technical field of hardware communication. The method comprises the following steps: receiving a service request message through a message center, wherein the service request message comprises a source service, one or more target services and service content of each target service; sending the service content of each target service to a file address corresponding to each target service through the message center; and when the message center receives the return success messages of all the target services in the one or more target services, sending the return service success information to the source service through the message center. The method performs message receiving and sending execution and monitoring through the message center, and ensures the communication consistency of the cloth inspecting machine, thereby improving the communication efficiency of the cloth inspecting machine.

Description

Cloth inspecting machine communication method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of hardware communication, in particular to a communication method and device of a cloth inspecting machine, electronic equipment and a storage medium.
Background
The cloth inspecting machine is a set of necessary special equipment for detecting extra-large-breadth, double-breadth and single-breadth cloth such as cotton, wool, hemp, silk, chemical fiber and the like before production in the clothing industry. The cloth inspecting machine automatically completes length recording and package finishing work, is provided with an electronic defect detecting device, and assists cloth inspecting operation and printing output through computer statistical analysis. With the development of software and hardware, there has been an automatic intelligent cloth inspecting machine that replaces manual cloth inspection by visual recognition technology or other recognition technology and performs communication through multiple modules to perform actions.
However, in the current intelligent cloth inspecting machine control system, there are two general architecture modes, one is to directly build a large-scale single application, the other is to split the single application into several independent micro-services, including modules of a front-end interface, a control system, an algorithm system, a hardware control system, and the like, but because of the existence of a large number of mutual communication relations among the services, one service needs to establish network socket communication with several other services, the communication efficiency is low, the management is disordered, once a failure occurs, multiple times of communication are needed to inform each service to roll back, the system complexity is high, and the intelligent cloth inspecting machine is easy to crash, so that the problems of poor communication consistency and low efficiency exist in the intelligent cloth inspecting machine.
Disclosure of Invention
In view of the above, an object of the embodiments of the present application is to provide a method and an apparatus for communication of a cloth inspecting machine, an electronic device, and a storage medium, so as to solve the problems of poor communication consistency and low efficiency in the prior art.
The embodiment of the application provides a communication method of a cloth inspecting machine, which comprises the following steps: receiving a service request message through a message center, wherein the service request message comprises a source service, one or more target services and service content of each target service; sending the service content of each target service to a file address corresponding to each target service through the message center; and when the message center receives the return success messages of all the target services in the one or more target services, sending the return service success information to the source service through the message center.
In the implementation mode, the message center is used for uniformly carrying out communication between the source service and the target service, so that the software and hardware communication efficiency of the cloth inspecting machine is improved, the message center determines that the source service is finished when all target services requested by the source service return successful messages, and then returns the service successful messages to the source service to finish the communication and execution flow of the current source service, so that the communication consistency of the cloth inspecting machine is improved.
Optionally, before sending the service content of each target service to the file address corresponding to each target service through the message center, the method further includes: analyzing the source service, the one or more target services and the service content of each target service in the service request message based on a preset format through the message center; and determining a file address corresponding to each target service through the message center.
In the implementation mode, the source service, the target service and the service content are determined through the message center, the service content is sent to the corresponding file address of the target service through the message center, and file transmission butt joint between each source service and each target service is not needed, so that the communication efficiency and the consistency of the cloth inspecting machine are improved.
Optionally, the sending, by the message center, the service content of each target service to the file address corresponding to each target service includes: sending the service content of each target service to a file address corresponding to each target service through the message center, so that each target service monitors the corresponding file address through a UNIX Domain Socket to acquire the service content from the corresponding file address; after the sending, by the message center, the service content of each target service to the file address corresponding to each target service, the method further includes: and receiving a service result sent by each target service through the message center, wherein the service result sent by each target service is a service result corresponding to the service content acquired by each target service, and the service result comprises a return success message and a return failure message.
In the implementation mode, the target service monitors the corresponding file address through the UNIX Domain Socket to acquire the service content, the network protocol stack is not needed, the packaging and unpacking, the calculation of the checksum, the maintenance of the serial number, the response and the like are not needed, the application layer data is only copied from one process to another process, and the communication efficiency of the cloth inspecting machine is improved.
Optionally, the service request message further includes a message identifier, and the message center determines whether a return success message of all target services in the one or more target services is received by: the message center queries the returned return success message through the message identifier; when the return success messages corresponding to all the target services in the one or more target services exist, determining that the return success messages of all the target services in the one or more target services are received.
In the implementation mode, the message center confirms the returned successful message of the target service through the message identifier, so that the message confirmation accuracy is improved.
Optionally, the one or more target services include a control service, an algorithm service, a collection service, a picture storage service, and/or a hardware control service, and when a target service is a hardware control service, the sending, by the message center, the service content of each target service to the file address corresponding to each target service includes: modifying the service content of the hardware control service into a hardware service type through the message center, and sending the hardware service type to a file address corresponding to the hardware control service; the receiving, by the message center, the service result sent by each target service includes: for a hardware control service in the one or more target services, receiving a service result corresponding to the hardware control service from the hardware control service through the message center, where the service result corresponding to the hardware control service is that when the hardware control service receives a service content of the hardware service type, a hardware detection signal is sent to a programmable logic controller of a cloth inspection machine corresponding to the service content of the hardware service type through a serial port, so that the programmable logic controller sends the hardware detection result signal to the hardware control service through the serial port, and the hardware detection result is a service result corresponding to the hardware control service.
In the implementation manner, when the target service of the source service request is the hardware control service, the hardware control service communicates and controls the corresponding hardware equipment of the cloth inspecting machine through the programmable logic controller, so that the communication of the hardware service is realized.
Optionally, when the message center receives the return success messages of all the target services in the one or more target services, sending, by the message center, return service success information to the source service, where the return service success information includes: sending, by the message center, a confirmation message to the target hardware service when a return success message of all target services of the one or more target services is received and the target hardware service exists in the one or more target services; and after the message center receives the confirmation return information corresponding to the confirmation information sent by the target hardware service, sending a return service success information to the source service through the message center.
In the implementation mode, the target hardware service is secondarily confirmed through the communication between the target hardware service and the target hardware, so that the communication accuracy and the message consistency of the hardware service are improved.
Optionally, the method further comprises: when the message center does not receive the return success messages of all the target services in the one or more target services within the preset time, the message center sends the service content of the target service which does not send the return success messages to the file address corresponding to the target service which does not send the return success messages, or sends the return service failure messages to the source service.
In the implementation mode, the service failure judgment of the preset time is carried out on the target service which is requested to be subjected to the service failure, the blocking is avoided when the service communication does not receive the successful return information, and the communication efficiency is improved.
The embodiment of the present application also provides a cloth inspection machine communication device, the device includes: the system comprises a request receiving module, a service request sending module and a service processing module, wherein the request receiving module is used for receiving a service request message through a message center, and the service request message comprises a source service, one or more target services and service content of each target service; the content sending module is used for sending the service content of each target service to the file address corresponding to each target service through the message center; and the service response module is used for sending the return service success information to the source service through the message center when the message center receives the return success information of all the target services in the one or more target services.
In the implementation mode, the message center is used for uniformly carrying out communication between the source service and the target service, so that the software and hardware communication efficiency of the cloth inspecting machine is improved, the message center determines that the source service is finished when all target services requested by the source service return successful messages, and then returns the service successful messages to the source service to finish the communication and execution flow of the current source service, so that the communication consistency of the cloth inspecting machine is improved.
Optionally, the cloth inspecting machine communication device further includes: the file address determining module is used for analyzing the source service, the one or more target services and the service content of each target service in the service request message based on a preset format through the message center; and determining a file address corresponding to each target service through the message center.
In the implementation mode, the source service, the target service and the service content are determined through the message center, the service content is sent to the corresponding file address of the target service through the message center, and file transmission butt joint between each source service and each target service is not needed, so that the communication efficiency and the consistency of the cloth inspecting machine are improved.
Optionally, the content sending module is specifically configured to: sending the service content of each target service to a file address corresponding to each target service through the message center, so that each target service monitors the corresponding file address through a UNIX Domain Socket to acquire the service content from the corresponding file address; cloth inspection machine communication device still includes: and the result receiving module is used for receiving the service result sent by each target service through the message center, wherein the service result sent by each target service is a service result corresponding to the service content acquired by each target service, and the service result comprises a return success message and a return failure message.
In the implementation mode, the target service monitors the corresponding file address through the UNIX Domain Socket to acquire the service content, the network protocol stack is not needed, the packaging and unpacking, the calculation of the checksum, the maintenance of the serial number, the response and the like are not needed, the application layer data is only copied from one process to another process, and the communication efficiency of the cloth inspecting machine is improved.
Optionally, the result receiving module is specifically configured to: the message center queries the returned return success message through the message identifier; when the return success messages corresponding to all the target services in the one or more target services exist, determining that the return success messages of all the target services in the one or more target services are received.
In the implementation mode, the message center confirms the returned successful message of the target service through the message identifier, so that the message confirmation accuracy is improved.
Optionally, the content sending module is specifically configured to: modifying the service content of the hardware control service into a hardware service type through the message center, and sending the hardware service type to a file address corresponding to the hardware control service; the result receiving module is specifically configured to: for a hardware control service in the one or more target services, receiving a service result corresponding to the hardware control service from the hardware control service through the message center, where the service result corresponding to the hardware control service is that when the hardware control service receives a service content of the hardware service type, a hardware detection signal is sent to a programmable logic controller of a cloth inspection machine corresponding to the service content of the hardware service type through a serial port, so that the programmable logic controller sends the hardware detection result signal to the hardware control service through the serial port, and the hardware detection result is a service result corresponding to the hardware control service.
In the implementation manner, when the target service of the source service request is the hardware control service, the hardware control service communicates and controls the corresponding hardware equipment of the cloth inspecting machine through the programmable logic controller, so that the communication of the hardware service is realized.
Optionally, the service response module is specifically configured to: sending, by the message center, a confirmation message to the target hardware service when a return success message of all target services of the one or more target services is received and the target hardware service exists in the one or more target services; and after the message center receives the confirmation return information corresponding to the confirmation information sent by the target hardware service, sending a return service success information to the source service through the message center.
In the implementation mode, the target hardware service is secondarily confirmed through the communication between the target hardware service and the target hardware, so that the communication accuracy and the message consistency of the hardware service are improved.
Optionally, the result receiving module is specifically configured to: when the message center does not receive the return success messages of all the target services in the one or more target services within the preset time, the message center sends the service content of the target service which does not send the return success messages to the file address corresponding to the target service which does not send the return success messages, or sends the return service failure messages to the source service.
In the implementation mode, the service failure judgment of the preset time is carried out on the target service which is requested to be subjected to the service failure, the blocking is avoided when the service communication does not receive the successful return information, and the communication efficiency is improved.
An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, where the memory stores program instructions, and the processor executes steps in any one of the above implementation manners when reading and executing the program instructions.
An embodiment of the present application further provides a storage medium, where computer program instructions are stored in the storage medium, and when the computer program instructions are read and executed by a processor, the steps in any one of the above implementation manners are performed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a communication method of a cloth inspecting machine according to an embodiment of the present application;
fig. 2 is a schematic flow chart of hardware control service communication according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating a software and hardware communication flow of a hardware control service according to an embodiment of the present disclosure;
fig. 4 is a schematic block diagram of a communications device of a cloth inspecting machine according to an embodiment of the present disclosure.
Icon: 30-a cloth inspecting machine communication device; 31-request receiving module; 32-a content transmission module; 33-service response module.
Detailed Description
The technical solution in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Referring to fig. 1, fig. 1 is a schematic flow chart of a communication method of a cloth inspecting machine according to an embodiment of the present application. The communication method of the cloth inspecting machine comprises the following specific steps:
step S12: a service request message is received through a message center, the service request message including a source service, one or more target services, and service content for each of the target services.
Generally, an intelligent cloth inspecting machine system is built by a micro-service architecture, mainly comprises a control service, an algorithm service, an acquisition service, a picture storage service, a hardware control service and the like, and performs unified message management through a message center. The message center can serve software and processes, and can be message queues such as Kafka, RabbitMQ and RocktetMQ, so that the communication coordination and the communication efficiency of the cloth inspecting machine are improved.
The source service and the target service can be software processes for completing a certain specific function in the intelligent cloth inspecting machine, and the service content can be control, calculation, image acquisition, image storage, hardware control and the like.
It should be understood that the service request information received by the message center includes various types of files, such as source service, target service, service content, and the like, and therefore before the service content of each target service is sent to the corresponding file address through the message center, the source service, one or more target services, and the service content of each target service in the service request message need to be parsed by the message center based on a preset format, so as to determine the file address corresponding to each target service.
Step S14: and sending the service content of each target service to a file address corresponding to each target service through the message center.
Optionally, before performing inter-service communication through the message center, the source service and the target service need to complete registration in the message center and obtain a unique file address, and each target service receives a message by monitoring the file address.
Optionally, the Inter-service Communication in this embodiment may be performed in a UNIX Domain Socket, which is also called an IPC (Inter-Process Communication) Socket, and is used to implement Inter-Process Communication on the same host. Socket was originally designed for network communication, but later an IPC mechanism was developed on the Socket framework, namely UNIX Domain Socket. Although network sockets can also be used for interprocess communication (via a loopback address) on the same host, UNIX Domain sockets are more efficient for IPC: the data of the application layer is only copied from one process to another process without passing through a network protocol stack, packaging and unpacking, calculating a checksum, maintaining a sequence number, responding and the like. The UNIX Domain Socket is full-duplex, the API (Application programming interface) is rich in semantics, and has obvious advantages compared with other IPC mechanisms, and the IPC mechanism becomes the most widely used IPC mechanism at present, for example, communication between an X Window server and a GUI program is through the UNIX Domain Socket.
It should be understood that, after each service content of the source service is transmitted to the target service through the message center, the service result returned by each target service needs to be received through the message center, where the service result sent by each target service is a service result corresponding to the service content acquired by each target service, and specifically, the service result includes a return success message and a return failure message.
Step S16: and when the message center receives the return success messages of all the target services in the one or more target services, sending the return service success information to the source service through the message center.
Optionally, the messages transmitted between the services all carry message identifiers, for example, the service content in the source request service sent by the source service a all carries the unique message identifier of the source request service, and the message identifier may be any character combination such as numbers, letters, and the like. The specific steps of the step S16 for determining the return success message may be as follows: the message center inquires the returned return success message through the message identifier; and when the return success messages corresponding to all the target services in the one or more target services exist, determining that the return success messages of all the target services in the one or more target services are received.
Through the judging steps, the intelligent cloth inspecting machine communication method can determine whether all service contents in the service requested by a certain source service are completely executed or not through the message identification, so that the communication consistency of the intelligent cloth inspecting machine is improved.
The target service received by the message center may be a control service, an algorithm service, an acquisition service, a picture storage service and/or a hardware control service, and when the target service is a hardware service, related hardware of the intelligent cloth inspection machine needs to be controlled and communicated, please refer to fig. 2, where fig. 2 is a schematic flow diagram of hardware control service communication provided in the embodiment of the present application, where the hardware target service communicates with a programmable logic controller connected to the cloth inspection machine through a serial port, the hardware target service transmits a level signal to the programmable logic controller through an Modbus protocol through an RS232 or other serial ports after obtaining the signal by monitoring a Unix Domain Socket file, and the programmable logic controller converts the level signal into a digital quantity signal, a pulse signal, and the like to control related functions of the cloth inspection machine. The specific steps of the hardware control service communication may be as follows:
step S22: and when the target service is the hardware control service, modifying the service content of the hardware control service into a hardware service type through the message center, and sending the hardware service type to a file address corresponding to the hardware control service.
Alternatively, the hardware service type in this implementation may be a "prepare" type.
Step S24: and acquiring corresponding hardware control service content at a file address through a hardware target service based on a UNIX Domain Socket, and sending a hardware detection signal to a programmable logic controller of a cloth inspecting machine corresponding to the hardware control service content through the hardware target service by adopting a serial port.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a software and hardware communication flow of a hardware control service according to an embodiment of the present disclosure. And after the programmable logic controller of the intelligent cloth inspecting machine sends the hardware detection signal to the corresponding hardware equipment of the intelligent cloth inspecting machine, the communication detection of the hardware equipment is completed, and a level signal which represents the normal communication of the hardware equipment is returned to the hardware target service when the communication of the hardware equipment is normal, so that the hardware target service sends the service result to the message center.
The hardware equipment of the intelligent cloth inspecting machine can generally comprise a transmission module, a camera module and the like.
It should be understood that, when a target service such as a hardware target service sends a message to a message center, the message may also be sent to a monitored file address of the message center, and the message feedback of the target service is completed based on UNIX Domain Socket.
Step S26: and sending confirmation information to the target hardware service when the message center receives the return success messages of all the one or more target services and the target hardware service exists in the one or more target services.
Alternatively, the confirmation information in this embodiment may be "confirm" information.
Step S28: and after the message center receives the confirmation return information corresponding to the confirmation information sent by the target hardware service, sending the return service success information to the source service through the message center.
Optionally, in this embodiment, after the message center receives the acknowledgment return information corresponding to the acknowledgment information sent by the target hardware service, a message log may also be recorded.
In a general microservice software system, a retry and rollback mode is generally used for processing final consistency of transactions. However, in the cloth inspecting machine system, once an abnormal condition occurs, the cloth inspecting machine which has started cannot automatically roll back the rolled cloth in the hardware control service. Therefore, the message center must ensure that the hardware service does not roll back after being started, and the hardware service is submitted in two stages through the steps S22-S28, and after the success of other software services is ensured, the completion of the start of the hardware service is confirmed.
Further, when the message center does not receive the return success messages of all the target services in the one or more target services within the preset time, the message center sends the service content of the target service which does not send the return success messages to the file address corresponding to the target service which does not send the return success messages, or sends the return service failure messages to the source service.
Optionally, the message center may poll for return information for the target service.
In addition, the manager can also obtain the message log of the message center through the management background and analyze the log to monitor the running health condition of the system service.
In order to cooperate with the communication method of the cloth inspecting machine, the embodiment of the application further provides a communication device 30 of the cloth inspecting machine.
Referring to fig. 4, fig. 4 is a schematic block diagram of a communications device of a cloth inspecting machine according to an embodiment of the present disclosure.
Cloth inspection machine communication device 30 includes:
a request receiving module 31, configured to receive a service request message through a message center, where the service request message includes a source service, one or more target services, and a service content of each target service;
a content sending module 32, configured to send the service content of each target service to a file address corresponding to each target service through the message center;
and the service response module 33 is configured to, when the message center receives the return success messages of all the target services in the one or more target services, send the return service success information to the source service through the message center.
Optionally, the cloth inspecting machine communication device 30 further includes: the file address determining module is used for analyzing a source service, one or more target services and the service content of each target service in the service request message based on a preset format through the message center; and determining a file address corresponding to each target service through the message center.
Optionally, the content sending module 32 is specifically configured to: sending the service content of each target service to a file address corresponding to each target service through a message center so that each target service monitors the corresponding file address through a UNIX Domain Socket to acquire the service content from the corresponding file address; cloth inspection machine communication device still includes: and the result receiving module is used for receiving the service result sent by each target service through the message center, the service result sent by each target service is a service result corresponding to the service content acquired by each target service, and the service result comprises a return success message and a return failure message.
Optionally, the result receiving module is specifically configured to: the message center inquires the returned return success message through the message identifier; and when the return success messages corresponding to all the target services in the one or more target services exist, determining that the return success messages of all the target services in the one or more target services are received.
Optionally, the content sending module 32 is specifically configured to: modifying the service content of the hardware control service into a hardware service type through a message center, and sending the hardware service type to a file address corresponding to the hardware control service; the result receiving module is specifically configured to: for a hardware control service in one or more target services, a service result corresponding to the hardware control service is received from the hardware control service through a message center, and the service result corresponding to the hardware control service is that when the hardware control service receives service content of a hardware service type, a hardware detection signal is sent to a programmable logic controller of an cloth inspection machine corresponding to the service content of the hardware service type through a serial port, so that the programmable logic controller sends the hardware detection result signal to the hardware control service through the serial port, and the hardware detection result is the service result corresponding to the hardware control service.
Optionally, the service response module 33 is specifically configured to: when a message center receives a return success message of all target services in one or more target services and the target hardware services exist in the one or more target services, sending confirmation information to the target hardware services; and after the message center receives the confirmation return information corresponding to the confirmation information sent by the target hardware service, sending the return service success information to the source service through the message center.
Optionally, the result receiving module is specifically configured to: when the message center does not receive the return success messages of all the target services in the one or more target services within the preset time, the message center sends the service content of the target service which does not send the return success messages to the file address corresponding to the target service which does not send the return success messages, or sends the return service failure messages to the source service.
The embodiment of the application further provides electronic equipment, which comprises a memory and a processor, wherein program instructions are stored in the memory, and when the processor reads and runs the program instructions, the steps in any one of the methods of the cloth inspecting machine communication method provided by the embodiment are executed.
It should be understood that the electronic device may be a Personal Computer (PC), a tablet PC, a smart phone, a Personal Digital Assistant (PDA), or other electronic device having a logical computing function.
The embodiment of the application also provides a readable storage medium, wherein computer program instructions are stored in the readable storage medium, and the computer program instructions are read by a processor and executed to execute the steps in the communication method of the cloth inspecting machine.
To sum up, the embodiment of the present application provides a communication method and apparatus for a cloth inspecting machine, an electronic device, and a storage medium, where the method includes: receiving a service request message through a message center, wherein the service request message comprises a source service, one or more target services and service content of each target service; sending the service content of each target service to a file address corresponding to each target service through the message center; and when the message center receives the return success messages of all the target services in the one or more target services, sending the return service success information to the source service through the message center.
In the implementation mode, the message center is used for uniformly carrying out communication between the source service and the target service, so that the software and hardware communication efficiency of the cloth inspecting machine is improved, the message center determines that the source service is finished when all target services requested by the source service return successful messages, and then returns the service successful messages to the source service to finish the communication and execution flow of the current source service, so that the communication consistency of the cloth inspecting machine is improved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. The apparatus embodiments described above are merely illustrative, and for example, the block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of devices according to various embodiments of the present application. In this regard, each block in the block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams, and combinations of blocks in the block diagrams, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Therefore, the present embodiment further provides a readable storage medium, in which computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the computer program instructions perform the steps of any of the block data storage methods. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a RanDom Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A cloth inspection machine communication method, characterized in that the method comprises:
receiving a service request message through a message center, wherein the service request message comprises a source service, one or more target services and service content of each target service;
sending the service content of each target service to a file address corresponding to each target service through the message center;
and when the message center receives the return success messages of all the target services in the one or more target services, sending the return service success information to the source service through the message center.
2. The method of claim 1, wherein before sending the service content of each target service to the file address corresponding to each target service through the message center, the method further comprises:
analyzing the source service, the one or more target services and the service content of each target service in the service request message based on a preset format through the message center;
and determining a file address corresponding to each target service through the message center.
3. The method of claim 1, wherein the sending, by the message center, the service content of each target service to the file address corresponding to each target service comprises:
sending the service content of each target service to a file address corresponding to each target service through the message center, so that each target service monitors the corresponding file address through a UNIX Domain Socket to acquire the service content from the corresponding file address;
after the sending, by the message center, the service content of each target service to the file address corresponding to each target service, the method further includes:
and receiving a service result sent by each target service through the message center, wherein the service result sent by each target service is a service result corresponding to the service content acquired by each target service, and the service result comprises a return success message and a return failure message.
4. The method of claim 1, wherein the service request message further comprises a message identifier, and wherein the message center determines whether a return success message for all of the one or more target services has been received by:
the message center queries the returned return success message through the message identifier;
when the return success messages corresponding to all the target services in the one or more target services exist, determining that the return success messages of all the target services in the one or more target services are received.
5. The method according to claim 2, wherein the one or more target services include a control service, an algorithm service, a collection service, a picture storage service and/or a hardware control service, and when a target service is a hardware control service, the sending, by the message center, the service content of each target service to the file address corresponding to each target service includes:
modifying the service content of the hardware control service into a hardware service type through the message center, and sending the hardware service type to a file address corresponding to the hardware control service;
the receiving, by the message center, the service result sent by each target service includes:
for a hardware control service in the one or more target services, receiving a service result corresponding to the hardware control service from the hardware control service through the message center, where the service result corresponding to the hardware control service is that when the hardware control service receives a service content of the hardware service type, a hardware detection signal is sent to a programmable logic controller of a cloth inspection machine corresponding to the service content of the hardware service type through a serial port, so that the programmable logic controller sends the hardware detection result signal to the hardware control service through the serial port, and the hardware detection result is a service result corresponding to the hardware control service.
6. The method of claim 5, wherein sending, by the message center, a return service success message to the origin service when the message center receives return success messages for all of the one or more target services comprises:
sending, by the message center, a confirmation message to the target hardware service when a return success message of all target services of the one or more target services is received and the target hardware service exists in the one or more target services;
and after the message center receives the confirmation return information corresponding to the confirmation information sent by the target hardware service, sending a return service success information to the source service through the message center.
7. The method of claim 1, further comprising:
when the message center does not receive the return success messages of all the target services in the one or more target services within the preset time, the message center sends the service content of the target service which does not send the return success messages to the file address corresponding to the target service which does not send the return success messages, or sends the return service failure messages to the source service.
8. A cloth inspection machine communication device, the device comprising:
the system comprises a request receiving module, a service request sending module and a service processing module, wherein the request receiving module is used for receiving a service request message through a message center, and the service request message comprises a source service, one or more target services and service content of each target service;
the content sending module is used for sending the service content of each target service to the file address corresponding to each target service through the message center;
and the service response module is used for sending the return service success information to the source service through the message center when the message center receives the return success information of all the target services in the one or more target services.
9. An electronic device comprising a memory having stored therein program instructions and a processor that, when executed, performs the steps of the method of any of claims 1-7.
10. A storage medium having stored thereon computer program instructions for executing the steps of the method according to any one of claims 1 to 7 when executed by a processor.
CN202010164017.6A 2020-03-10 2020-03-10 Cloth inspecting machine communication method and device, electronic equipment and storage medium Active CN111385361B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010164017.6A CN111385361B (en) 2020-03-10 2020-03-10 Cloth inspecting machine communication method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010164017.6A CN111385361B (en) 2020-03-10 2020-03-10 Cloth inspecting machine communication method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111385361A true CN111385361A (en) 2020-07-07
CN111385361B CN111385361B (en) 2023-04-07

Family

ID=71218725

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010164017.6A Active CN111385361B (en) 2020-03-10 2020-03-10 Cloth inspecting machine communication method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111385361B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415758A (en) * 2018-03-27 2018-08-17 深圳市买买提信息科技有限公司 Distributed transaction coordination approach and device
CN109634800A (en) * 2018-10-19 2019-04-16 深圳平安财富宝投资咨询有限公司 Data processing method, system, terminal and readable storage medium storing program for executing
CN109756564A (en) * 2018-12-20 2019-05-14 广州市百果园信息技术有限公司 Service administering method, device and storage medium, computer equipment
WO2019134306A1 (en) * 2018-01-02 2019-07-11 武汉斗鱼网络科技有限公司 Message processing method, device, terminal apparatus, and readable storage medium
CN110791943A (en) * 2019-11-25 2020-02-14 创新奇智(广州)科技有限公司 Intelligent cloth inspecting machine control system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019134306A1 (en) * 2018-01-02 2019-07-11 武汉斗鱼网络科技有限公司 Message processing method, device, terminal apparatus, and readable storage medium
CN108415758A (en) * 2018-03-27 2018-08-17 深圳市买买提信息科技有限公司 Distributed transaction coordination approach and device
CN109634800A (en) * 2018-10-19 2019-04-16 深圳平安财富宝投资咨询有限公司 Data processing method, system, terminal and readable storage medium storing program for executing
CN109756564A (en) * 2018-12-20 2019-05-14 广州市百果园信息技术有限公司 Service administering method, device and storage medium, computer equipment
CN110791943A (en) * 2019-11-25 2020-02-14 创新奇智(广州)科技有限公司 Intelligent cloth inspecting machine control system

Also Published As

Publication number Publication date
CN111385361B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN105357038B (en) Monitor the method and system of cluster virtual machine
US9893963B2 (en) Dynamic baseline determination for distributed transaction
US7941703B2 (en) Capturing machine state of unstable java program
CN111753169B (en) Data acquisition system based on internet
CN105930226A (en) Data processing method and apparatus
CN111414263A (en) Information processing method, device, server and storage medium
CN109409948B (en) Transaction abnormity detection method, device, equipment and computer readable storage medium
CN114398179A (en) Method and device for acquiring tracking identifier, server and storage medium
CN109218338B (en) Information processing system, method and device
CN111385361B (en) Cloth inspecting machine communication method and device, electronic equipment and storage medium
CN111367934B (en) Data consistency checking method, device, server and medium
CN112527497B (en) Serialized multithreaded data processing system
CN115499493A (en) Asynchronous transaction processing method and device, storage medium and computer equipment
CN116800438A (en) Rebound shell detection method and device
CN114443343A (en) Method, device, equipment and storage medium for service interface to feed back abnormal information
CN111915275A (en) Application operation process management method, device and system
CN112333262A (en) Data updating prompting method and device, computer equipment and readable storage medium
CN111371586A (en) Log data transmission method, device and equipment
CN113448742B (en) Interface data acquisition method and device
KR100428765B1 (en) Management information transmitting system and method in asynchronous transfer mode
CN116521222A (en) Automatic merging method, device, equipment and medium for version control
CN114637758A (en) Transaction processing method and device
CN117908982A (en) Dynamic configuration system and method for edge server
CN114895978A (en) Method, device, medium and equipment for processing state entrusted in report
CN116257855A (en) Container security detection method, server side and client side

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