Bus communication method and apparatus, and computer device and readable storage medium
By adopting the MQTT protocol in the bus server, standardized transmission of business data was achieved, solving the problem of complex message parsing under the DBUS framework, improving bus communication quality and reducing costs.
Patent Information
- Application Number
- PCT/CN2024/115113
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-23
- Filing Date
- 2024-08-28
- Publication Date
- 2025-11-27
AI Technical Summary
Existing bus messaging systems, especially the DBUS framework, suffer from complex message parsing and processing, and data transmission quality cannot be guaranteed in the Linux environment.
Using the MQTT protocol, business data from the service provider is obtained through the first external interface of the bus server, transmitted to the gateway plugin for processing through the internal interface, and finally transmitted to the business platform through the second external interface. The publish/subscribe mode and routing address of the MQTT protocol are used to ensure the standardization and consistency of data transmission.
It improves bus communication quality, reduces bus integration and development costs, ensures unified interface between different service providers and gateway plugins, simplifies message flow, and improves system reliability and security.
Smart Images

Figure CN2024115113_27112025_PF_FP_ABST
Abstract
Description
Bus communication method and device, computer equipment and readable storage medium
[0001] Related applications
[0002] The present application claims priority to the Chinese patent application No. 202410648130X, filed on May 23, 2024, and entitled "Bus communication method and device, computer equipment and readable storage medium", the contents of which are hereby incorporated by reference in their entirety. TECHNICAL FIELD
[0003] The present application relates to the field of communication technology, in particular to a bus communication method, device, computer equipment and readable storage medium. BACKGROUND
[0004] Bus message system is a communication mechanism for passing messages and data in distributed systems or microservice architectures.
[0005] Existing bus message systems, especially in Linux environments, widely use the DBUS (Desktop Bus) framework as the core mechanism for inter-process communication. DBUS is a message bus system for inter-application communication, which is an important mechanism for inter-process communication (IPC). It is provided by the freesktop.org project and is widely used in Linux desktop environments to enable inter-process communication and communication between processes and the kernel. The main functions of DBUS include providing a low-latency, low-overhead, high-availability communication mechanism, supporting service discovery, message routing, and selective message reception through matchers. In addition, DBUS has its own protocol, which is designed based on binary data to ensure the efficiency of information transmission.
[0006] However, the message body of DBUS may contain complex data structures and parameters, which makes the parsing and processing of messages relatively complex, and the quality of data transmission cannot be guaranteed.
[0007] SUMMARY
[0008] Therefore, it is necessary to provide a bus communication method, device, computer equipment and readable storage medium to solve the above technical problems.
[0009] In a first aspect, the present application provides a bus communication method applied to a bus server, the bus server comprising a first external interface for connecting a service providing end, a second external interface for connecting a service platform, and an internal interface for connecting a gateway plug-in; the method comprising:
[0010] Based on the MQTT protocol, the service data published by the service providing end is acquired through the first external interface;
[0011] transmitting the service data to the gateway plug-in through the internal interface;
[0012] obtaining plug-in data transmitted by the gateway plug-in through the internal interface; wherein the plug-in data is obtained based on the service data processing; and
[0013] transmitting the plug-in data to the service platform through the second external interface based on the MQTT protocol.
[0014] In one of the embodiments, the number of gateway plug-ins connected by the internal interface is at least two, and the number of service providing ends connected by the first external interface is at least two; and
[0015] transmitting the service data to the gateway plug-in through the internal interface, comprising:
[0016] when obtaining any service query request initiated by the gateway plug-in based on the MQTT protocol, obtaining the service data corresponding to the service query request in the service data provided by each service providing end; and
[0017] transmitting the service data corresponding to the service query request to the gateway plug-in through the internal interface.
[0018] In one of the embodiments, the method further comprises:
[0019] obtaining a first MQTT request initiated by any gateway plug-in based on the MQTT protocol through the internal interface; and
[0020] when the service identification information is contained in the first MQTT request, taking the first MQTT request as the service query request corresponding to the gateway plug-in.
[0021] In one of the embodiments, the service identification information comprises an identifier of a target device corresponding to the service providing end, a request type and related parameter information.
[0022] In one of the embodiments, the number of gateway plug-ins connected by the internal interface is at least two, and the number of network card devices deployed in the service platform is at least two; and
[0023] transmitting the plug-in data to the service platform through the second external interface based on the MQTT protocol, comprising:
[0024] when obtaining a plug-in query request initiated by any network card device in the service platform based on the MQTT protocol, obtaining the plug-in data corresponding to the plug-in query request in the plug-in data provided by each gateway plug-in; and
[0025] transmitting the plug-in data corresponding to the plug-in query request to the network card device through the second external interface based on the MQTT protocol.
[0026] In one of the embodiments, the method further comprises:
[0027] acquiring, by the internal interface, a second MQTT request initiated by any network card device based on the MQTT protocol; and
[0028] when the second MQTT request contains plug-in identification information, the second MQTT request is taken as a plug-in query request corresponding to the network card device.
[0029] In one of the embodiments, the plug-in query request corresponding plug-in data is transmitted to the network card device through the second external interface based on the MQTT protocol, comprising:
[0030] adding the routing address corresponding to the network card device in the plug-in query request corresponding plug-in data to obtain target plug-in data; and
[0031] transmitting the target plug-in data to the network card device through the second external interface based on the MQTT protocol.
[0032] In one of the embodiments, the second external interface comprises a network connection or a communication port supporting the MQTT protocol.
[0033] In one of the embodiments, the routing address comprises a physical address of the network card device.
[0034] In one of the embodiments, the routing address further comprises device account data of the network card device.
[0035] In one of the embodiments, the MQTT protocol adopts a publish / subscribe mode.
[0036] In the second aspect, the application further provides a bus communication device applied to a bus server, the bus server comprising a first external interface for connecting a service providing end, a second external interface for connecting a service platform, and an internal interface for connecting a gateway plug-in; the device comprises:
[0037] an acquiring module for acquiring, by the first external interface, service data published by the service providing end based on the MQTT protocol;
[0038] a first internal transmission module for transmitting the service data to the gateway plug-in through the internal interface;
[0039] a second internal transmission module for acquiring plug-in data transmitted by the gateway plug-in through the internal interface; wherein the plug-in data is obtained based on service data processing; and
[0040] a sending module for transmitting the plug-in data to the service platform through the second external interface based on the MQTT protocol.
[0041] In a third aspect, the present application provides a computer device, comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0042] acquiring, based on the MQTT protocol, the service data published by the service providing end through the first external interface;
[0043] transmitting, through the internal interface, the service data to the gateway plug-in;
[0044] acquiring, through the internal interface, the plug-in data transmitted by the gateway plug-in; wherein the plug-in data is obtained based on processing of the service data; and
[0045] transmitting, based on the MQTT protocol, the plug-in data to the service platform through the second external interface.
[0046] In a fourth aspect, the present application provides a computer readable storage medium, having a computer program stored thereon, and the computer program, when executed by a processor, implements the following steps:
[0047] acquiring, based on the MQTT protocol, the service data published by the service providing end through the first external interface;
[0048] transmitting, through the internal interface, the service data to the gateway plug-in;
[0049] acquiring, through the internal interface, the plug-in data transmitted by the gateway plug-in; wherein the plug-in data is obtained based on processing of the service data; and
[0050] transmitting, based on the MQTT protocol, the plug-in data to the service platform through the second external interface.
[0051] In a fifth aspect, the present application provides a computer program product, comprising a computer program, and the computer program, when executed by a processor, implements the following steps:
[0052] acquiring, based on the MQTT protocol, the service data published by the service providing end through the first external interface;
[0053] transmitting, through the internal interface, the service data to the gateway plug-in;
[0054] acquiring, through the internal interface, the plug-in data transmitted by the gateway plug-in; wherein the plug-in data is obtained based on processing of the service data; and
[0055] transmitting, based on the MQTT protocol, the plug-in data to the service platform through the second external interface.
[0056] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will be apparent from the description, drawings, and claims. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the disclosed drawings without creative effort.
[0058] Figure 1 is an application environment diagram of the bus communication method in one embodiment of this application;
[0059] Figure 2 is a flowchart illustrating a bus communication method in one embodiment of this application;
[0060] Figure 3 is a flowchart illustrating the steps of transmitting service data corresponding to a service query request to the gateway plugin in one embodiment of this application;
[0061] Figure 4 is a flowchart illustrating the step of transmitting the plug-in data corresponding to the plug-in query request to the network card device through a second external interface in one embodiment of this application.
[0062] Figure 5 is a flowchart illustrating the step of transmitting the plug-in data corresponding to the plug-in query request to the network card device through a second external interface in another embodiment of this application.
[0063] Figure 6 is a structural block diagram of a bus communication device in one embodiment of this application;
[0064] Figure 7 is an internal structural diagram of a computer device in one embodiment of this application. Detailed Implementation
[0065] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0066] The bus communication method provided in this application embodiment can be applied to the application environment shown in Figure 1. The bus server includes a first external interface (A interface) for connecting to the service provider, a second external interface (B interface) for connecting to the service platform, and an internal interface for connecting to gateway plugins. Each gateway plugin may include a container management plugin, a control plugin, an FTTR (Fiber to the Room) control plugin, and a local web interface plugin.
[0067] In an exemplary embodiment, as shown in FIG. 2, a bus communication method is provided, which is applied to the bus server in FIG. 1 as an example, including the following steps 202 to 206. Among them:
[0068] Step 201, based on the MQTT (Message Queuing Telemetry Transport) protocol, the business data published by the business provider is obtained through the first external interface.
[0069] Among them, the business provider can be an MQTT client / manufacturer. The MQTT client (manufacturer) is the starting point of the data processing and transmission process, which is responsible for publishing the business data generated by the device to the MQTT network for other systems to subscribe and use. The business data generated by the device can include device status, sensor readings, operation results, etc. The manufacturer needs to ensure that the published data complies with certain formats and standards so that other systems can correctly parse and use these data.
[0070] Specifically, the message queue telemetry transmission MQTT protocol adopts the publish / subscribe mode, which means that the client can subscribe to specific topics and receive notifications when new messages are published on these topics (Topic). This mode decouples the publisher and subscriber of the message, so that they do not need to connect directly or know the existence of each other.
[0071] It can be understood that the topic in the MQTT protocol is a string, which is used to identify the channel of message transmission. The topic of the MQTT protocol does not have a strict type, because the topic is a string identifier used to define the channel of message transmission. The topic can be customized according to the application scenario to meet the specific message delivery requirements. Exemplarily, the topic can include the following types or naming conventions:
[0072] 1) command: this kind of topic is usually used to send control commands or instructions; 2) reply or response: when the reply or response after command execution needs to be received, this kind of topic can be used; 3) report or status: this kind of topic is often used for the publication of device or system status report. 4) config or settings: this kind of topic can be used to send or receive configuration information.
[0073] Step 202, transmit the business data to the gateway plug-in through the internal interface.
[0074] The gateway plug-in is a software component installed on the gateway, which has specific functions for processing, converting or monitoring data flow through the network gateway. For example, the gateway plug-in can process and convert data passing through the gateway. During data transmission, the plug-in can encrypt, compress, format convert, etc. data to meet the data exchange requirements between different systems.
[0075] Specifically, the internal interface is defined within the bus server and is used to transmit data between the server and the gateway plug-in. The gateway plug-in is usually integrated or deployed on the bus server. When the gateway plug-in starts, it establishes a connection with the bus server through the internal interface. Similarly, the gateway plug-in can also send data or responses to the bus server through this interface.
[0076] In this embodiment, the bus server deploys LXC (Linux Container) to deploy each gateway plug-in; LXC provides a lightweight virtualization solution that allows multiple containers to run on a single physical host. This makes the deployment of gateway plug-ins more rapid and flexible. By using LXC, containers containing gateway plug-ins can be easily created and managed, enabling rapid deployment of plug-ins.
[0077] Step 203: Obtain the plug-in data transmitted by the gateway plug-in through the internal interface.
[0078] The plug-in data is based on business data processing.
[0079] Specifically, these data are transmitted to the gateway plug-in through the internal interface. After receiving these data, the gateway plug-in will process them according to its own functions. After processing, the gateway plug-in will send the processed data (i.e. plug-in data) back to the bus server through the internal interface.
[0080] Step 204: Based on the MQTT protocol, transmit the plug-in data to the business platform through the second external interface.
[0081] It can be understood that the plug-in data has been appropriately formatted and encapsulated according to the requirements of the MQTT protocol. This usually involves converting data into MQTT messages and specifying appropriate topics (Topics) so that the business platform can correctly subscribe and receive these messages.
[0082] The second external interface is the connection point between the bus server and the business platform; once the plug-in data is encapsulated as MQTT messages and published through the second external interface, the business platform can receive these data by subscribing to the corresponding topics.
[0083] In the bus communication method, the MQTT protocol is used to ensure consistency and standardization of communication content between the service providing end, the gateway plug-in and the service platform, so that different service providing ends and gateway plug-ins can be uniformly connected, the bus communication quality is improved, and further, the bus integration and development cost is reduced.
[0084] In an exemplary embodiment, as shown in FIG. 3, the number of gateway plug-ins connected by the internal interface is at least two, and the number of service providing ends connected by the first external interface is at least two; step 202 includes step 301 and step 302:
[0085] Step 301, when any gateway plug-in initiates a service query request based on the MQTT protocol, the corresponding service data of the service query request is obtained from the service data provided by each service providing end.
[0086] In this embodiment, any gateway plug-in can publish MQTT requests through the Topic:command topic, subscribe to MQTT replies through the Topic:reply topic, and subscribe to MQTT reports through the Topic:report topic.
[0087] The Topic:command topic publishes MQTT requests, which means that when the gateway plug-in needs to send control instructions, it publishes the service query request to the command Topic through the MQTT protocol. These instructions can include device configuration, state query, firmware update and other requests. The messages published to the command Topic usually contain the identifier of the target device corresponding to the service providing end, the request type and related parameter information.
[0088] The Topic:reply topic subscribes to MQTT replies, which means that in order to receive responses from other system components or devices to the previously sent requests, the gateway plug-in subscribes to the reply Topic. When other components or devices have processed the request, they will publish the result to this Topic. The gateway plug-in can obtain the processing result of the request in real time by listening to this Topic, and then perform corresponding subsequent operations or decision-making.
[0089] The Topic:report topic subscribes to MQTT reports, which means that the gateway plug-in also subscribes to the report Topic to receive state updates, event notifications or regularly reported data from other components or devices. These data can include device running status, sensor readings, error logs, etc. By subscribing to this Topic, the gateway plug-in can master the running status of the entire system in real time, and discover and handle potential problems in a timely manner.
[0090] In the embodiment, a first MQTT request initiated by any gateway plug-in based on the MQTT protocol is acquired through the internal interface; when the first MQTT request contains service identification information, the first MQTT request is taken as a service query request corresponding to the gateway plug-in.
[0091] The service identification information is the message published to the command Topic, and usually contains an identifier of a target device corresponding to a service providing end, a request type, and related parameter information.
[0092] In step 302, the service data corresponding to the service query request is transmitted to the gateway plug-in through the internal interface.
[0093] It can be understood that after the requested service data is acquired, the data is transmitted back to the gateway plug-in initiating the query request through the internal interface. Since the internal interface is connected with at least two gateway plug-ins, the system needs to ensure that the data is accurately sent to the correct gateway plug-in.
[0094] Specifically, a distribution module is arranged in the bus server, and the distribution module subscribes to the Local / command Topic to listen to instructions from the system. When a message is received from the Local / command, the distribution module parses the data body in the message, especially a method field containing the name of the target plug-in. According to the parsed plug-in name, the distribution module forwards the data packet to the special Topic of the corresponding plug-in, so as to ensure that each plug-in only receives the data related to it, and realizes the data isolation between the plug-ins.
[0095] In the embodiment, the MQTT broker plays the role of a message middleware and is responsible for receiving and distributing messages. The gateway plug-ins and other clients communicate and cooperate by publishing and subscribing to different topics. This publish / subscribe mode allows loose coupling communication, because the sender and the receiver do not need to be directly connected or know each other; they only need to focus on the same topic.
[0096] In an exemplary embodiment, the number of gateway plug-ins connected by the internal interface is at least two, and the service platform is deployed with at least two NIC devices. As shown in FIG. 4, step 203 includes step 401 and step 402.
[0097] In step 401, when a plug-in query request initiated by any NIC device in the service platform based on the MQTT protocol is acquired, the plug-in data corresponding to the plug-in query request is acquired from the plug-in data provided by each gateway plug-in.
[0098] It can be understood that in a typical network architecture, a service platform generally refers to a system or platform that provides a specific service function or service, and a network card device is a hardware component responsible for network communication in this system; the service platform provides services to external networks through the network card device. For example, a web server platform uses a network card device to receive client requests and sends responses through the network card device.
[0099] In this embodiment, the network card device acts as an MQTT client and can connect to an MQTT Broker (MQTT broker server) and participate in the MQTT publish / subscribe mode. This enables the network card device to actively initiate requests and receive responses, and communicate asynchronously with other parts of the service platform.
[0100] Specifically, any network card device can publish an MQTT request through the Topic:command topic; can subscribe to MQTT replies through the Topic:reply topic; and can subscribe to MQTT reports through the Topic:report topic.
[0101] When the network card device needs to query information about a certain plug-in, it will publish a plug-in query request through the MQTT protocol on the Topic:command topic, for example, Topic: / / command{network card mac}. This request contains specific query parameters such as plug-in name, version number, etc., which help other components in the service platform (such as servers or middleware) locate and provide corresponding plug-in data.
[0102] The network card device also subscribes to the Topic:reply topic, for example, Topic: / / reply{network card mac}; in order to receive responses to its query requests. When the components in the service platform find the corresponding plug-in data and are ready to respond, they will publish the data to this topic. The network card device as a subscriber will immediately receive these data and perform corresponding processing.
[0103] The network card device also subscribes to the Topic:report topic, for example, Topic: / / report{network card mac}; the network card device can receive real-time status reports of gateway plug-ins such as CPU usage, memory occupation, network traffic, etc. by subscribing to this topic.
[0104] Further, through the internal interface, any network card device initiates a second MQTT request based on the MQTT protocol is obtained.
[0105] Optionally, an MQTT Broker is deployed inside the bus server, and the MQTT Broker is provided with conversion rules for realizing data transmission between the network card device and the gateway plug-in; specifically, the MQTT Broker converts Topic: / / command{network card mac} into Topic: / / {plug-in name}command; the MQTT Broker converts Topic: / / reply{network card mac} into Topic: / / {plug-in name}reply; and the MQTT Broker converts Topic: / / report{network card mac} into Topic: / / {plug-in name}report.
[0106] Correspondingly, when the second MQTT request contains plug-in identification information, the second MQTT request is taken as a plug-in query request corresponding to the network card device.
[0107] At step 402, plug-in data corresponding to the plug-in query request is transmitted to the network card device through the second external interface based on the MQTT protocol.
[0108] Optionally, the plug-in query request is published to a topic subscribed by the network card device, which is usually Topic:reply, because this is the topic that the network card device expects to receive a response. The network card device, as an MQTT subscriber, continuously listens to messages on the Topic:reply topic. When the system publishes an MQTT message containing plug-in data, the network card device immediately receives this message. After receiving the message, the network card device parses the message content, extracts the required plug-in data, and performs subsequent operations or processing according to these data.
[0109] As shown in FIG. 5, the plug-in data corresponding to the plug-in query request is transmitted to the network card device through the second external interface based on the MQTT protocol, including steps 501 and 502:
[0110] At step 501, a routing address corresponding to the network card device is added to the plug-in data corresponding to the plug-in query request, to obtain target plug-in data.
[0111] Specifically, when the business platform processes the plug-in query request of the network card device and finds the corresponding plug-in data, the system adds the routing address of the network card device to these data. This routing address is the unique identifier of the network card device in the network, which can be an IP address, a MAC address, or other types of network identifiers.
[0112] By adding the routing address to the plug-in data, the system can ensure that the response message can be accurately sent back to the network card device that initiates the request, even when there are multiple network card devices in the network.
[0113] Step 502, based on the MQTT protocol, transmit the target plug-in data to the network card device through the second external interface.
[0114] Optionally, once the routing address is added to the original plug-in data, the data becomes "target plug-in data". This means that the data has been specifically marked as to be sent to the network card device with the routing address. Next, based on the MQTT protocol, the target plug-in data is sent to the network card device through the second external interface. In this process, the "second external interface" can refer to a network connection or communication port that supports MQTT. The target plug-in data is packaged into an MQTT message and an appropriate topic (usually a topic subscribed by the network card device, such as Topic: reply) is specified for publishing.
[0115] Correspondingly, the network card device as a subscriber of MQTT will receive the MQTT message containing the target plug-in data. Since the message contains the routing address of the network card device, the network card device can confirm that the message is specifically prepared for it. After receiving the data, the network card device will parse and process it, and perform corresponding operations according to the content of the plug-in data.
[0116] In one implementation, the routing address includes the physical address of the network card device. Based on the conversion rule of the MQTT Broker, the routing address corresponding to the network card device can also be added to the plug-in query request corresponding plug-in data to obtain target plug-in data; based on the MQTT protocol, the target plug-in data is transmitted to the network card device through the second external interface.
[0117] Among them, the conversion rule of the MQTT Broker is as follows:
[0118] 1) Internal Topic: / / {plug-in name} / report to B interface Topic: report / {network card mac} send,
[0119] 2) Internal Topic: / / {plug-in name} / reply to B interface Topic: reply / {network card mac} send,
[0120] 3) Internal Topic: / / {plug-in name} / command to B interface Topic: command / {network card mac} send.
[0121] In another implementation, the routing address includes the physical address of the network card device and the device account data of the network card device.
[0122] Among them, the conversion rule of the MQTT Broker is as follows:
[0123] 1) Internal Topic: / / {plugin name} / report sends to B interface Topic: report / {card mac} {account data},
[0124] 2) Internal Topic: / / {plugin name} / reply sends to B interface Topic: reply / {card mac} {account data},
[0125] 3) Internal Topic: / / {plugin name} / command sends to B interface Topic: command / {card mac} {account data}.
[0126] In this embodiment, by limiting the number of Topics between gateway plugins and business platforms to three, the number and complexity of MQTT messages can be significantly reduced, thereby reducing the processing pressure of the platform. This design simplifies the message flow, enabling the platform to more efficiently process each message. The introduction of the configuration module ensures that each gateway device is properly configured and authenticated before connecting to the MQTT Broker. The configuration module can manage and verify the identity of devices, access permissions, and the Topics that can be published, thereby enhancing the security of devices. In addition, through the intelligent routing of messages by the distribution module, it can ensure that sensitive information is not mistakenly sent to unauthorized devices or systems.
[0127] The distribution module acts like a message router, which can distribute MQTT messages to the correct gateway or plugin based on the type of message, target device, or other rules. This ensures the isolation of messages, i.e., each plugin only receives messages related to its function and is not disturbed by other irrelevant messages. This isolation not only improves the reliability and efficiency of the system, but also reduces potential security risks, as malicious messages are more difficult to penetrate into parts that should not receive them.
[0128] The MQTT Broker acts as a message broker, responsible for receiving and forwarding MQTT messages. It is the core of the entire message delivery system. The configuration module is responsible for the access configuration of devices, permission management, and the subscription and publication rules of Topics. It can ensure that devices meet security requirements before accessing the system and correctly configure their communication parameters. The distribution module intelligently distributes messages to the correct target based on the rules of the configuration module. It plays a role in message filtering and routing, ensuring that messages can accurately and efficiently reach the intended destination.
[0129] In summary, this design effectively reduces the pressure on the platform, improves the security of devices and the isolation of MQTT messages by limiting the number of Topics, introducing configuration and distribution modules. These measures together constitute an efficient, secure and scalable message delivery system.
[0130] It should be understood that, although each step in the flowchart involved in the above embodiments is shown in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in the above embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with other steps or steps or stages in other steps.
[0131] Based on the same inventive concept, the embodiments of the present application also provide a bus communication device for implementing the above-mentioned bus communication method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more bus communication device embodiments provided below can refer to the limitations of the bus communication method described above, which will not be repeated here.
[0132] In an exemplary embodiment, as shown in FIG. 6, a bus communication device is provided, which is applied to a bus server, the bus server including a first external interface for connecting a service providing end, a second external interface for connecting a service platform, and an internal interface for connecting a gateway plug-in; the device includes an acquisition module 11, a first internal transmission module 12, a second internal transmission module 13 and a sending module 14, wherein
[0133] The acquisition module 11 is configured to acquire service data published by the service providing end through the first external interface based on the MQTT protocol.
[0134] The first internal transmission module 12 is configured to transmit the service data to the gateway plug-in through the internal interface.
[0135] The second internal transmission module 13 is configured to acquire plug-in data transmitted by the gateway plug-in through the internal interface, wherein the plug-in data is obtained based on processing of the service data.
[0136] The sending module 14 is configured to transmit the plug-in data to the service platform through the second external interface based on the MQTT protocol.
[0137] In one of the embodiments, the number of gateway plug-ins connected by the internal interface is at least two, the number of service providing ends connected by the first external interface is at least two, and the first internal transmission module 12 is further configured to: when a service query request initiated by any gateway plug-in based on the MQTT protocol is acquired, acquire the service data corresponding to the service query request from the service data provided by each service providing end;
[0138] The service data corresponding to the service query request is transmitted to the gateway plug-in through the internal interface.
[0139] In one of the embodiments, the apparatus further comprises a first request module configured to:
[0140] The first MQTT request initiated by any gateway plug-in based on the MQTT protocol is acquired through the internal interface.
[0141] When the service identification information is contained in the first MQTT request, the first MQTT request is taken as the service query request corresponding to the gateway plug-in.
[0142] In one of the embodiments, the number of gateway plug-ins connected by the internal interface is at least two, and the number of network card devices deployed in the service platform is at least two;
[0143] Correspondingly, the second internal transmission module 13 is further configured to: when a plug-in query request initiated by any network card device in the service platform based on the MQTT protocol is acquired, acquire the plug-in data corresponding to the plug-in query request from the plug-in data provided by each gateway plug-in;
[0144] The plug-in data corresponding to the plug-in query request is transmitted to the network card device through the second external interface based on the MQTT protocol.
[0145] In one of the embodiments, the apparatus further comprises a second request module configured to:
[0146] The second MQTT request initiated by any network card device based on the MQTT protocol is acquired through the internal interface.
[0147] When the plug-in identification information is contained in the second MQTT request, the second MQTT request is taken as the plug-in query request corresponding to the network card device.
[0148] In one of the embodiments, the plug-in data corresponding to the plug-in query request is transmitted to the network card device through the second external interface based on the MQTT protocol, which comprises:
[0149] add the routing address corresponding to the network card device in the plug-in data corresponding to the plug-in query request to obtain target plug-in data;
[0150] transmit the target plug-in data to the network card device through the second external interface based on the MQTT protocol.
[0151] In one of the embodiments, the routing address includes the physical address of the network card device.
[0152] In one of the embodiments, the routing address further includes the device account data of the network card device.
[0153] Each of the modules in the bus communication device can be realized by software, hardware and combinations thereof in whole or in part. Each of the modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each of the modules.
[0154] In one exemplary embodiment, a computer device is provided, which can be a server, i.e., a bus server in the present application, and its internal structure diagram can be shown in FIG. 7. The computer device includes a processor, a memory, an input / output interface (I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is configured to store bus communication method data. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with external terminals through network connection. The computer program is executed by the processor to implement a bus communication method.
[0155] Those skilled in the art can understand that the structure shown in FIG. 7 is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0156] In one exemplary embodiment, a computer device is provided, which includes a memory and a processor, and the memory stores a computer program. The processor executes the computer program to implement the following steps:
[0157] obtain service data published by a service provider through a first external interface based on the MQTT protocol;
[0158] transmit the service data to a gateway plug-in through an internal interface;
[0159] obtain plug-in data transmitted by the gateway plug-in through the internal interface, wherein the plug-in data is obtained based on the service data;
[0160] transmit the plug-in data to a service platform through a second external interface based on the MQTT protocol.
[0161] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the number of gateway plug-ins connected to the internal interface is at least two, and the number of service providers connected to the first external interface is at least two; the step of transmitting the service data to the gateway plug-in through the internal interface comprises the following steps: when a service query request initiated by any gateway plug-in based on the MQTT protocol is obtained, the service data corresponding to the service query request is obtained from the service data provided by each service provider; and the service data corresponding to the service query request is transmitted to the gateway plug-in through the internal interface.
[0162] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the first MQTT request initiated by any gateway plug-in based on the MQTT protocol is obtained through the internal interface; and when the service identification information is contained in the first MQTT request, the first MQTT request is taken as the service query request corresponding to the gateway plug-in.
[0163] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the number of gateway plug-ins connected to the internal interface is at least two, and the number of network card devices deployed in the service platform is at least two; the step of transmitting the plug-in data to the service platform through the second external interface based on the MQTT protocol comprises the following steps: when a plug-in query request initiated by any network card device in the service platform based on the MQTT protocol is obtained, the plug-in data corresponding to the plug-in query request is obtained from the plug-in data provided by each gateway plug-in; and the plug-in data corresponding to the plug-in query request is transmitted to the network card device through the second external interface based on the MQTT protocol.
[0164] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the second MQTT request initiated by any network card device based on the MQTT protocol is obtained through the internal interface; and when the plug-in identification information is contained in the second MQTT request, the second MQTT request is taken as the plug-in query request corresponding to the network card device.
[0165] In one embodiment, the processor, when executing the computer program, also implements the following steps: transmitting, based on the MQTT protocol, the plug-in data corresponding to the plug-in query request to the network card device through the second external interface, including: adding the routing address corresponding to the network card device in the plug-in data corresponding to the plug-in query request to obtain target plug-in data; and transmitting, based on the MQTT protocol, the target plug-in data to the network card device through the second external interface.
[0166] In one embodiment, the routing address includes the physical address of the network card device.
[0167] In one embodiment, the routing address further includes the device account data of the network card device.
[0168] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program, when executed by a processor, implements the following steps:
[0169] acquiring, based on the MQTT protocol, service data published by a service providing end through a first external interface;
[0170] transmitting, through an internal interface, the service data to a gateway plug-in;
[0171] acquiring, through the internal interface, plug-in data transmitted by the gateway plug-in; wherein the plug-in data is obtained based on processing of the service data;
[0172] transmitting, based on the MQTT protocol, the plug-in data to a service platform through a second external interface.
[0173] In one embodiment, the computer program, when executed by the processor, also implements the following steps: the number of gateway plug-ins connected to the internal interface is at least two, and the number of service providing ends connected to the first external interface is at least two; the step of transmitting, through the internal interface, the service data to the gateway plug-in includes: when a service query request initiated by any gateway plug-in based on the MQTT protocol is acquired, acquiring the service data corresponding to the service query request from the service data provided by each service providing end; and transmitting, through the internal interface, the service data corresponding to the service query request to the gateway plug-in.
[0174] In one embodiment, the computer program, when executed by the processor, also implements the following steps: acquiring, through the internal interface, a first MQTT request initiated by any gateway plug-in based on the MQTT protocol; and when the first MQTT request contains service identification information, taking the first MQTT request as a service query request corresponding to the gateway plug-in.
[0175] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the number of gateway plug-ins connected by the internal interface is at least two, and the number of network card devices deployed in the service platform is at least two; the plug-in data is transmitted to the service platform through the second external interface based on the MQTT protocol, including: when the plug-in query request corresponding to the plug-in data is obtained in the plug-in data provided by each gateway plug-in, the plug-in query request corresponding to the plug-in data is transmitted to the network card device based on the MQTT protocol through the second external interface.
[0176] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the second MQTT request initiated by any network card device based on the MQTT protocol is obtained through the internal interface; when the second MQTT request contains plug-in identification information, the second MQTT request is taken as the plug-in query request corresponding to the network card device.
[0177] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the plug-in data corresponding to the plug-in query request is transmitted to the network card device through the second external interface based on the MQTT protocol, including: the routing address corresponding to the network card device is added in the plug-in data corresponding to the plug-in query request to obtain target plug-in data; the target plug-in data is transmitted to the network card device through the second external interface based on the MQTT protocol.
[0178] In one embodiment, the routing address includes the physical address of the network card device.
[0179] In one embodiment, the routing address further includes the device account data of the network card device.
[0180] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the following steps:
[0181] The service data published by the service providing end is obtained through the first external interface based on the MQTT protocol;
[0182] The service data is transmitted to the gateway plug-in through the internal interface;
[0183] The plug-in data transmitted by the gateway plug-in is obtained through the internal interface; wherein, the plug-in data is obtained based on the service data processing;
[0184] The plug-in data is transmitted to the service platform through the second external interface based on the MQTT protocol.
[0185] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the number of gateway plug-ins connected by the internal interface is at least two, and the number of service providing ends connected by the first external interface is at least two; the transmission of the service data to the gateway plug-in through the internal interface comprises: when a service query request initiated by any gateway plug-in based on the MQTT protocol is acquired, the service data corresponding to the service query request is acquired from the service data provided by each service providing end; and the service data corresponding to the service query request is transmitted to the gateway plug-in through the internal interface.
[0186] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the first MQTT request initiated by any gateway plug-in based on the MQTT protocol is acquired through the internal interface; and when the service identification information is contained in the first MQTT request, the first MQTT request is taken as the service query request corresponding to the gateway plug-in.
[0187] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the number of gateway plug-ins connected by the internal interface is at least two, and the number of network card devices deployed in the service platform is at least two; the transmission of the plug-in data to the service platform based on the MQTT protocol through the second external interface comprises: when a plug-in query request initiated by any network card device based on the MQTT protocol is acquired, the plug-in data corresponding to the plug-in query request is acquired from the plug-in data provided by each gateway plug-in; and the plug-in data corresponding to the plug-in query request is transmitted to the network card device based on the MQTT protocol through the second external interface.
[0188] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the second MQTT request initiated by any network card device based on the MQTT protocol is acquired through the internal interface; and when the plug-in identification information is contained in the second MQTT request, the second MQTT request is taken as the plug-in query request corresponding to the network card device.
[0189] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the transmission of the plug-in data corresponding to the plug-in query request to the network card device based on the MQTT protocol through the second external interface comprises: the routing address corresponding to the network card device is added in the plug-in data corresponding to the plug-in query request to obtain target plug-in data; and the target plug-in data is transmitted to the network card device based on the MQTT protocol through the second external interface.
[0190] In one embodiment, the routing address comprises the physical address of the network card device.
[0191] In one embodiment, the routing address further comprises device account data of the network card device.
[0192] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant regulations.
[0193] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In the embodiments provided by the present application, any reference to the memory, database or other medium can include at least one of a non-volatile memory and a volatile memory. The non-volatile memory can include a read-only memory (Read-Only Memory, ROM), a magnetic tape, a floppy disk, a flash memory, an optical storage, a high-density embedded non-volatile memory, a resistive random access memory (Resistive Random Access Memory, ReRAM), a magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), a ferroelectric memory (Ferroelectric Random Access Memory, FRAM), a phase change memory (Phase Change Memory, PCM), a graphene memory, etc. The volatile memory can include a random access memory (Random Access Memory, RAM) or an external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided by the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided by the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (Artificial Intelligence, AI) processor, etc., without being limited thereto.
[0194] Any combination of the technical features in the above-described embodiments can be made, and for the sake of brevity, not all possible combinations are described, however, it is to be understood that the application embraces all such possible combinations.
[0195] The above-described embodiments only express several implementation manners of the application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the patent scope of the application. It should be pointed out that, for ordinary skilled persons in the art, some modifications and improvements can be made without departing from the concept of the application, and these all belong to the protection scope of the application. Therefore, the patent protection scope of the application should be subject to the appended claims.
Claims
1. A bus communication method applied to a bus server, the bus server comprising a first external interface for connecting a service provider, a second external interface for connecting a service platform, and an internal interface for connecting a gateway plug-in; the method comprising: obtaining service data published by the service provider through the first external interface based on an MQTT (Message Queue Telemetry Transport) protocol; transmitting the service data to the gateway plug-in through the internal interface; obtaining plug-in data transmitted by the gateway plug-in through the internal interface, wherein the plug-in data is obtained based on processing of the service data; and transmitting the plug-in data to the service platform through the second external interface based on the MQTT protocol. The number of gateway plug-ins connected by the internal interface is at least two, and the number of service providers connected by the first external interface is at least two.
2. The method of claim 1, wherein, The method further comprises: when a service query request initiated by any gateway plug-in based on the MQTT protocol is obtained, obtaining service data corresponding to the service query request from service data provided by each service provider; and transmitting the service data corresponding to the service query request to the gateway plug-in through the internal interface. The method further comprises: obtaining a first MQTT request initiated by any gateway plug-in based on the MQTT protocol through the internal interface; and when service identification information is contained in the first MQTT request, regarding the first MQTT request as a service query request corresponding to the gateway plug-in.
3. The method of claim 2, wherein, The service identification information comprises an identifier of a target device corresponding to the service provider, a request type, and related parameter information. The number of gateway plug-ins connected by the internal interface is at least two, and the number of network card devices deployed in the service platform is at least two. The method further comprises:
4. The method of claim 3, wherein, when a plug-in query request initiated by any network card device in the service platform based on the MQTT protocol is obtained, obtaining plug-in data corresponding to the plug-in query request from plug-in data provided by each gateway plug-in; and 5. The method of claim 1, wherein, transmitting the plug-in data corresponding to the plug-in query request to the network card device through the second external interface based on the MQTT protocol. The method further comprises: obtaining a second MQTT request initiated by any network card device based on the MQTT protocol through the internal interface; and when plug-in identification information is contained in the second MQTT request, regarding the second MQTT request as a plug-in query request corresponding to the network card device. The method further comprises: in the plug-in data corresponding to the plug-in query request, adding a routing address corresponding to the network card device to obtain target plug-in data; and 6. The method of claim 5, wherein, 7. The method of claim 5, wherein, The second external interface comprises a network connection or a communication port supporting the MQTT protocol.
8. The method of claim 7, wherein, The routing address comprises a physical address of the network card device.
9. The method of claim 7, wherein, The routing address further comprises device account data of the network card device.
10. The method of claim 9, wherein, The MQTT protocol adopts a publish / subscribe mode.
11. The method according to any one of claims 1 to 10, wherein, 12.A bus communication apparatus applied to a bus server, the bus server comprising a first external interface for connecting a service provider, a second external interface for connecting a service platform, and an internal interface for connecting a gateway plug-in; the apparatus comprising: an acquisition module for acquiring, via the first external interface, service data published by the service provider based on the MQTT protocol; a first internal transmission module for transmitting, via the internal interface, the service data to the gateway plug-in; a second internal transmission module for acquiring, via the internal interface, plug-in data transmitted by the gateway plug-in, wherein the plug-in data is obtained based on processing of the service data; and a sending module for transmitting, via the second external interface, the plug-in data to the service platform based on the MQTT protocol. 13.A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor, when executing the computer program, implements the steps of the method according to any one of claims 1 to 11. 14.A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11. 15.A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Internet of things comprehensive experiment and application development platform based on open source ecological system, and architecture
CN108809972A
Internet of Things adaptation method and system, computer equipment and storage medium
CN110971614A
Internet of Things middleware data processing method and system, storage medium and terminal
CN111580985A
Communication method, device and gateway
CN114172929A
Internet of Things equipment access method and device, electronic equipment and storage medium
CN116016005A